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 <[EMAIL PROTECTED]>
---
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
[email protected]
http://list.linux-vserver.org/mailman/listinfo/vserver