[Vserver] [PATCH 02/10] vfs: add MNT_RDONLY flag and accompanying MNT_IS_RDONLY macro

From: Sam Vilain <sam.vilain_at_catalyst.net.nz>
Date: Mon 27 Feb 2006 - 05:25:30 GMT
Message-Id: <20060227052530.21148.23150.stgit@wilber.wgtn.cat-it.co.nz>

From: Herbert Pƶtzl <herbert@13thfloor.at>

Previously, it was down the the filesystem to know whether it is
mounted read-only, and was of no interest to the VFS. We want
per-mount read-only.

Add an extra flag to the list of per-vfsmount flags for read-only, and
a macro to test it. Also, make sure the new flag is put in the right
place to make it to do_loopback. It is also by side effect passed to
do_remount and do_new_mount, it is of little discernable effect as the
underlying mount will be read-only.

Acked-by: Sam Vilain <sam.vilain@catalyst.net.nz>

---
 fs/namespace.c        |    2 ++
 include/linux/mount.h |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 1094e54..b12ea35 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1289,6 +1289,8 @@ long do_mount(char *dev_name, char *dir_
 		((char *)data_page)[PAGE_SIZE - 1] = 0;
 
 	/* Separate the per-mountpoint flags */
+	if (flags & MS_RDONLY)
+		mnt_flags |= MNT_RDONLY;
 	if (flags & MS_NOSUID)
 		mnt_flags |= MNT_NOSUID;
 	if (flags & MS_NODEV)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b7472ae..c485c2b 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -22,6 +22,9 @@
 #define MNT_NOEXEC	0x04
 #define MNT_NOATIME	0x08
 #define MNT_NODIRATIME	0x10
+#define MNT_RDONLY	0x20
+
+#define MNT_IS_RDONLY(m)	((m) && ((m)->mnt_flags & MNT_RDONLY))
 
 #define MNT_SHARED	0x1000	/* if the vfsmount is a shared mount */
 #define MNT_UNBINDABLE	0x2000	/* if the vfsmount is a unbindable mount */
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Mon Feb 27 05:43:52 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 27 Feb 2006 - 05:43:54 GMT by hypermail 2.1.8