11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Definitions for mount interface. This describes the in the kernel build 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * linkedlist with mounted filesystems. 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Author: Marco van Wieringen <mvw@planets.elm.net> 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _LINUX_MOUNT_H 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _LINUX_MOUNT_H 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 12d53d9f16ea95a91ad4aa114809dcde486ca4000dAndrew Morton#include <linux/types.h> 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/list.h> 143d733633a633065729c9e4e254b2e5442c00ef7eDave Hansen#include <linux/nodemask.h> 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/spinlock.h> 16b3e19d924b6eaf2ca7d22cba99a517c5171007b6Nick Piggin#include <linux/seqlock.h> 1760063497a95e716c9a689af3be2687d261f115b4Arun Sharma#include <linux/atomic.h> 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 19726c334223180e3c0197cc980a432681370d4bafDavid Howellsstruct super_block; 20726c334223180e3c0197cc980a432681370d4bafDavid Howellsstruct vfsmount; 21726c334223180e3c0197cc980a432681370d4bafDavid Howellsstruct dentry; 226b3286ed1169d74fea401367d6d4d6c6ec758a81Kirill Korotaevstruct mnt_namespace; 23726c334223180e3c0197cc980a432681370d4bafDavid Howells 2407b20889e3052c7e77d6a6a54e7e83446eb1ba84Ram Pai#define MNT_NOSUID 0x01 2507b20889e3052c7e77d6a6a54e7e83446eb1ba84Ram Pai#define MNT_NODEV 0x02 2607b20889e3052c7e77d6a6a54e7e83446eb1ba84Ram Pai#define MNT_NOEXEC 0x04 27fc33a7bb9c6dd8f6e4a014976200f8fdabb3a45cChristoph Hellwig#define MNT_NOATIME 0x08 28fc33a7bb9c6dd8f6e4a014976200f8fdabb3a45cChristoph Hellwig#define MNT_NODIRATIME 0x10 2947ae32d6a54955a041cdc30b06d0bb16e75f68d5Valerie Henson#define MNT_RELATIME 0x20 302e4b7fcd926006531935a4c79a5e9349fe51125bDave Hansen#define MNT_READONLY 0x40 /* does the user want this to be r/o? */ 31bf066c7db775a04bd761f8ea206f5522d0cf40ffMiklos Szeredi 325528f911b4c43a5de5da34bcbd7e3f2a62503617Trond Myklebust#define MNT_SHRINKABLE 0x100 33d3ef3d7351ccfbef3e5d926efc5ee332136f40d4npiggin@suse.de#define MNT_WRITE_HOLD 0x200 345528f911b4c43a5de5da34bcbd7e3f2a62503617Trond Myklebust 35fc33a7bb9c6dd8f6e4a014976200f8fdabb3a45cChristoph Hellwig#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 36fc33a7bb9c6dd8f6e4a014976200f8fdabb3a45cChristoph Hellwig#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 37495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora/* 38495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora * MNT_SHARED_MASK is the set of flags that should be cleared when a 39495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora * mount becomes shared. Currently, this is only the flag that says a 40495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora * mount cannot be bind mounted, since this is how we create a mount 41495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora * that shares events with another mount. If you add a new MNT_* 42495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora * flag, consider how it interacts with shared mounts. 43495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora */ 44495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora#define MNT_SHARED_MASK (MNT_UNBINDABLE) 45a6138db815df5ee542d848318e5dae681590fccdEric W. Biederman#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \ 46a6138db815df5ee542d848318e5dae681590fccdEric W. Biederman | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \ 47a6138db815df5ee542d848318e5dae681590fccdEric W. Biederman | MNT_READONLY) 489566d6742852c527bf5af38af5cbb878dad75705Eric W. Biederman#define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME ) 49495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora 50f2ebb3a921c1ca1e2ddd9242e95a1989a50c4c68Al Viro#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \ 51f2ebb3a921c1ca1e2ddd9242e95a1989a50c4c68Al Viro MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED) 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 538089352a13b785d4e0df63d87bd2b71c76bb9aeeAl Viro#define MNT_INTERNAL 0x4000 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 559566d6742852c527bf5af38af5cbb878dad75705Eric W. Biederman#define MNT_LOCK_ATIME 0x040000 569566d6742852c527bf5af38af5cbb878dad75705Eric W. Biederman#define MNT_LOCK_NOEXEC 0x080000 579566d6742852c527bf5af38af5cbb878dad75705Eric W. Biederman#define MNT_LOCK_NOSUID 0x100000 589566d6742852c527bf5af38af5cbb878dad75705Eric W. Biederman#define MNT_LOCK_NODEV 0x200000 5990563b198e4c6674c63672fae1923da467215f45Eric W. Biederman#define MNT_LOCK_READONLY 0x400000 605ff9d8a65ce80efb509ce4e8051394e9ed2cd942Eric W. Biederman#define MNT_LOCKED 0x800000 6148a066e72d970a3e225a9c18690d570c736fc455Al Viro#define MNT_DOOMED 0x1000000 6248a066e72d970a3e225a9c18690d570c736fc455Al Viro#define MNT_SYNC_UMOUNT 0x2000000 63f2ebb3a921c1ca1e2ddd9242e95a1989a50c4c68Al Viro#define MNT_MARKED 0x4000000 6490563b198e4c6674c63672fae1923da467215f45Eric W. Biederman 6507b20889e3052c7e77d6a6a54e7e83446eb1ba84Ram Paistruct vfsmount { 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct dentry *mnt_root; /* root of the mounted tree */ 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct super_block *mnt_sb; /* pointer to superblock */ 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mnt_flags; 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 7196029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.destruct file; /* forward dec */ 723064c3563ba4c23e2c7a47254ec056ed9ba0098aAl Virostruct path; 7396029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.de 748366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern int mnt_want_write(struct vfsmount *mnt); 7596029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.deextern int mnt_want_write_file(struct file *file); 7696029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.deextern int mnt_clone_write(struct vfsmount *mnt); 778366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern void mnt_drop_write(struct vfsmount *mnt); 782a79f17e4a641a2f463cb512cb0ec349844a147bAl Viroextern void mnt_drop_write_file(struct file *file); 79b3e19d924b6eaf2ca7d22cba99a517c5171007b6Nick Pigginextern void mntput(struct vfsmount *mnt); 80b3e19d924b6eaf2ca7d22cba99a517c5171007b6Nick Pigginextern struct vfsmount *mntget(struct vfsmount *mnt); 813064c3563ba4c23e2c7a47254ec056ed9ba0098aAl Viroextern struct vfsmount *mnt_clone_internal(struct path *path); 828366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern int __mnt_is_readonly(struct vfsmount *mnt); 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 84c771d683a62e5d36bc46036f5c07f4f5bb7dda61Miklos Szeredistruct path; 85c771d683a62e5d36bc46036f5c07f4f5bb7dda61Miklos Szerediextern struct vfsmount *clone_private_mount(struct path *path); 86c771d683a62e5d36bc46036f5c07f4f5bb7dda61Miklos Szeredi 87bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebuststruct file_system_type; 88bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebustextern struct vfsmount *vfs_kern_mount(struct file_system_type *type, 89bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust int flags, const char *name, 90bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust void *data); 91bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust 92ea5b778a8b98c85a87d66bf844904f9c3802b869David Howellsextern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list); 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void mark_mounts_for_expiry(struct list_head *mounts); 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 95d53d9f16ea95a91ad4aa114809dcde486ca4000dAndrew Mortonextern dev_t name_to_dev_t(char *name); 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _LINUX_MOUNT_H */ 98