diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-14 21:54:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-14 21:54:01 -0400 |
commit | 0f0d12728e56c94d3289c6831243b6faeae8a19d (patch) | |
tree | bd52fd4ed6fba2a0d8bb95e7fc33f51ac299001d /include/linux/fs.h | |
parent | 581bfce969cbfc7ce43ee92273be9cb7c3fdfa61 (diff) | |
parent | e462ec50cb5fad19f6003a3d8087f4a0945dd2b1 (diff) |
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull mount flag updates from Al Viro:
"Another chunk of fmount preparations from dhowells; only trivial
conflicts for that part. It separates MS_... bits (very grotty
mount(2) ABI) from the struct super_block ->s_flags (kernel-internal,
only a small subset of MS_... stuff).
This does *not* convert the filesystems to new constants; only the
infrastructure is done here. The next step in that series is where the
conflicts would be; that's the conversion of filesystems. It's purely
mechanical and it's better done after the merge, so if you could run
something like
list=$(for i in MS_RDONLY MS_NOSUID MS_NODEV MS_NOEXEC MS_SYNCHRONOUS MS_MANDLOCK MS_DIRSYNC MS_NOATIME MS_NODIRATIME MS_SILENT MS_POSIXACL MS_KERNMOUNT MS_I_VERSION MS_LAZYTIME; do git grep -l $i fs drivers/staging/lustre drivers/mtd ipc mm include/linux; done|sort|uniq|grep -v '^fs/namespace.c$')
sed -i -e 's/\<MS_RDONLY\>/SB_RDONLY/g' \
-e 's/\<MS_NOSUID\>/SB_NOSUID/g' \
-e 's/\<MS_NODEV\>/SB_NODEV/g' \
-e 's/\<MS_NOEXEC\>/SB_NOEXEC/g' \
-e 's/\<MS_SYNCHRONOUS\>/SB_SYNCHRONOUS/g' \
-e 's/\<MS_MANDLOCK\>/SB_MANDLOCK/g' \
-e 's/\<MS_DIRSYNC\>/SB_DIRSYNC/g' \
-e 's/\<MS_NOATIME\>/SB_NOATIME/g' \
-e 's/\<MS_NODIRATIME\>/SB_NODIRATIME/g' \
-e 's/\<MS_SILENT\>/SB_SILENT/g' \
-e 's/\<MS_POSIXACL\>/SB_POSIXACL/g' \
-e 's/\<MS_KERNMOUNT\>/SB_KERNMOUNT/g' \
-e 's/\<MS_I_VERSION\>/SB_I_VERSION/g' \
-e 's/\<MS_LAZYTIME\>/SB_LAZYTIME/g' \
$list
and commit it with something along the lines of 'convert filesystems
away from use of MS_... constants' as commit message, it would save a
quite a bit of headache next cycle"
* 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
VFS: Differentiate mount flags (MS_*) from internal superblock flags
VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)
vfs: Add sb_rdonly(sb) to query the MS_RDONLY flag on s_flags
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6e187cba94c3..b4ae080f41a6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1271,6 +1271,33 @@ extern pid_t f_getown(struct file *filp); | |||
1271 | extern int send_sigurg(struct fown_struct *fown); | 1271 | extern int send_sigurg(struct fown_struct *fown); |
1272 | 1272 | ||
1273 | /* | 1273 | /* |
1274 | * sb->s_flags. Note that these mirror the equivalent MS_* flags where | ||
1275 | * represented in both. | ||
1276 | */ | ||
1277 | #define SB_RDONLY 1 /* Mount read-only */ | ||
1278 | #define SB_NOSUID 2 /* Ignore suid and sgid bits */ | ||
1279 | #define SB_NODEV 4 /* Disallow access to device special files */ | ||
1280 | #define SB_NOEXEC 8 /* Disallow program execution */ | ||
1281 | #define SB_SYNCHRONOUS 16 /* Writes are synced at once */ | ||
1282 | #define SB_MANDLOCK 64 /* Allow mandatory locks on an FS */ | ||
1283 | #define SB_DIRSYNC 128 /* Directory modifications are synchronous */ | ||
1284 | #define SB_NOATIME 1024 /* Do not update access times. */ | ||
1285 | #define SB_NODIRATIME 2048 /* Do not update directory access times */ | ||
1286 | #define SB_SILENT 32768 | ||
1287 | #define SB_POSIXACL (1<<16) /* VFS does not apply the umask */ | ||
1288 | #define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */ | ||
1289 | #define SB_I_VERSION (1<<23) /* Update inode I_version field */ | ||
1290 | #define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ | ||
1291 | |||
1292 | /* These sb flags are internal to the kernel */ | ||
1293 | #define SB_SUBMOUNT (1<<26) | ||
1294 | #define SB_NOREMOTELOCK (1<<27) | ||
1295 | #define SB_NOSEC (1<<28) | ||
1296 | #define SB_BORN (1<<29) | ||
1297 | #define SB_ACTIVE (1<<30) | ||
1298 | #define SB_NOUSER (1<<31) | ||
1299 | |||
1300 | /* | ||
1274 | * Umount options | 1301 | * Umount options |
1275 | */ | 1302 | */ |
1276 | 1303 | ||
@@ -1833,7 +1860,7 @@ struct super_operations { | |||
1833 | * possible to override it selectively if you really wanted to with some | 1860 | * possible to override it selectively if you really wanted to with some |
1834 | * ioctl() that is not currently implemented. | 1861 | * ioctl() that is not currently implemented. |
1835 | * | 1862 | * |
1836 | * Exception: MS_RDONLY is always applied to the entire file system. | 1863 | * Exception: SB_RDONLY is always applied to the entire file system. |
1837 | * | 1864 | * |
1838 | * Unfortunately, it is possible to change a filesystems flags with it mounted | 1865 | * Unfortunately, it is possible to change a filesystems flags with it mounted |
1839 | * with files in use. This means that all of the inodes will not have their | 1866 | * with files in use. This means that all of the inodes will not have their |
@@ -1842,19 +1869,20 @@ struct super_operations { | |||
1842 | */ | 1869 | */ |
1843 | #define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg)) | 1870 | #define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg)) |
1844 | 1871 | ||
1845 | #define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) | 1872 | static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & MS_RDONLY; } |
1846 | #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ | 1873 | #define IS_RDONLY(inode) sb_rdonly((inode)->i_sb) |
1874 | #define IS_SYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS) || \ | ||
1847 | ((inode)->i_flags & S_SYNC)) | 1875 | ((inode)->i_flags & S_SYNC)) |
1848 | #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ | 1876 | #define IS_DIRSYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS|SB_DIRSYNC) || \ |
1849 | ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) | 1877 | ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) |
1850 | #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) | 1878 | #define IS_MANDLOCK(inode) __IS_FLG(inode, SB_MANDLOCK) |
1851 | #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) | 1879 | #define IS_NOATIME(inode) __IS_FLG(inode, SB_RDONLY|SB_NOATIME) |
1852 | #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) | 1880 | #define IS_I_VERSION(inode) __IS_FLG(inode, SB_I_VERSION) |
1853 | 1881 | ||
1854 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) | 1882 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) |
1855 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) | 1883 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) |
1856 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) | 1884 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) |
1857 | #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) | 1885 | #define IS_POSIXACL(inode) __IS_FLG(inode, SB_POSIXACL) |
1858 | 1886 | ||
1859 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) | 1887 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) |
1860 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) | 1888 | #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
@@ -2175,7 +2203,7 @@ static inline int __mandatory_lock(struct inode *ino) | |||
2175 | } | 2203 | } |
2176 | 2204 | ||
2177 | /* | 2205 | /* |
2178 | * ... and these candidates should be on MS_MANDLOCK mounted fs, | 2206 | * ... and these candidates should be on SB_MANDLOCK mounted fs, |
2179 | * otherwise these will be advisory locks | 2207 | * otherwise these will be advisory locks |
2180 | */ | 2208 | */ |
2181 | 2209 | ||
@@ -3291,7 +3319,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode) | |||
3291 | 3319 | ||
3292 | static inline void inode_has_no_xattr(struct inode *inode) | 3320 | static inline void inode_has_no_xattr(struct inode *inode) |
3293 | { | 3321 | { |
3294 | if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) | 3322 | if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC)) |
3295 | inode->i_flags |= S_NOSEC; | 3323 | inode->i_flags |= S_NOSEC; |
3296 | } | 3324 | } |
3297 | 3325 | ||