From 751a2cd05bfeb7d1948f912446187a063b251c19 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 5 Nov 2001 10:33:45 +0000 Subject: [PATCH] Define a new mount flag "MNT_JAILDEVFS" Collect the magic combination of flags which can be updated into a macro in sys/mount.h rather than inlining them (twice!) in vfs_syscalls.c --- sys/kern/vfs_extattr.c | 10 ++-------- sys/kern/vfs_syscalls.c | 10 ++-------- sys/sys/mount.h | 13 +++++++++++-- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index cb82b083935..696c92e37c5 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -365,14 +365,8 @@ update: mp->mnt_flag |= MNT_RDONLY; else if (mp->mnt_flag & MNT_RDONLY) mp->mnt_kern_flag |= MNTK_WANTRDWR; - mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME | - MNT_NOSYMFOLLOW | MNT_IGNORE | - MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR); - mp->mnt_flag |= fsflags & (MNT_NOSUID | MNT_NOEXEC | - MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | - MNT_NOSYMFOLLOW | MNT_IGNORE | - MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR); + mp->mnt_flag &=~ MNT_UPDATEMASK; + mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE); /* * Mount the filesystem. * XXX The final recipients of VFS_MOUNT just overwrite the ndp they diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index cb82b083935..696c92e37c5 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -365,14 +365,8 @@ update: mp->mnt_flag |= MNT_RDONLY; else if (mp->mnt_flag & MNT_RDONLY) mp->mnt_kern_flag |= MNTK_WANTRDWR; - mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME | - MNT_NOSYMFOLLOW | MNT_IGNORE | - MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR); - mp->mnt_flag |= fsflags & (MNT_NOSUID | MNT_NOEXEC | - MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE | - MNT_NOSYMFOLLOW | MNT_IGNORE | - MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR); + mp->mnt_flag &=~ MNT_UPDATEMASK; + mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE); /* * Mount the filesystem. * XXX The final recipients of VFS_MOUNT just overwrite the ndp they diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 8b0d0120078..e2b856157c0 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -153,6 +153,7 @@ struct mount { #define MNT_SUIDDIR 0x00100000 /* special handling of SUID on dirs */ #define MNT_SOFTDEP 0x00200000 /* soft updates being done */ #define MNT_NOSYMFOLLOW 0x00400000 /* do not follow symlinks */ +#define MNT_JAILDEVFS 0x02000000 /* Jail friendly DEVFS behaviour */ #define MNT_NOATIME 0x10000000 /* disable update of file access time */ #define MNT_NOCLUSTERR 0x40000000 /* disable cluster read */ #define MNT_NOCLUSTERW 0x80000000 /* disable cluster write */ @@ -190,7 +191,16 @@ struct mount { MNT_LOCAL | MNT_USER | MNT_QUOTA | \ MNT_ROOTFS | MNT_NOATIME | MNT_NOCLUSTERR| \ MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP | \ - MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW) + MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW | \ + MNT_JAILDEVFS) + +/* Mask of flags that can be updated */ +#define MNT_UPDATEMASK (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | \ + MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | \ + MNT_NOATIME | \ + MNT_NOSYMFOLLOW | MNT_IGNORE | MNT_JAILDEVFS | \ + MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR) + /* * External filesystem command modifier flags. * Unmount can use the MNT_FORCE flag. @@ -206,7 +216,6 @@ struct mount { /* * Still available */ -#define MNT_SPARE1 0x02000000 #define MNT_SPARE2 0x04000000 #define MNT_SPARE3 0x08000000 /*