[Vserver] [PATCH 2/5] [fs] BME: add MNT_RDONLY flag

From: Sam Vilain <sam.vilain_at_catalyst.net.nz>
Date: Fri 24 Feb 2006 - 02:40:50 GMT
Message-Id: <20060224024050.16279.22272.stgit@wilber.wgtn.cat-it.co.nz>

Add an extra flag to the mount flags (along with noatime, noexec,
etc) for a read-only mount. Note that this will only affect bind
mounts as normally this is performed through the inode.

Signed-off-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 Fri Feb 24 02:56:52 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 24 Feb 2006 - 02:56:54 GMT by hypermail 2.1.8