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)
45495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora#define MNT_PROPAGATION_MASK	(MNT_SHARED | MNT_UNBINDABLE)
46495d6c9c6595ec7b37910dfd42634839431d21fdValerie Aurora
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
488089352a13b785d4e0df63d87bd2b71c76bb9aeeAl Viro#define MNT_INTERNAL	0x4000
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
5007b20889e3052c7e77d6a6a54e7e83446eb1ba84Ram Paistruct vfsmount {
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct dentry *mnt_root;	/* root of the mounted tree */
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	struct super_block *mnt_sb;	/* pointer to superblock */
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int mnt_flags;
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
5696029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.destruct file; /* forward dec */
5796029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.de
588366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern int mnt_want_write(struct vfsmount *mnt);
5996029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.deextern int mnt_want_write_file(struct file *file);
6096029c4e09ccbd73a6d0ed2b29e80bf2586ad7efnpiggin@suse.deextern int mnt_clone_write(struct vfsmount *mnt);
618366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern void mnt_drop_write(struct vfsmount *mnt);
622a79f17e4a641a2f463cb512cb0ec349844a147bAl Viroextern void mnt_drop_write_file(struct file *file);
63b3e19d924b6eaf2ca7d22cba99a517c5171007b6Nick Pigginextern void mntput(struct vfsmount *mnt);
64b3e19d924b6eaf2ca7d22cba99a517c5171007b6Nick Pigginextern struct vfsmount *mntget(struct vfsmount *mnt);
657b7b1ace2d9d06d76bce7481a045c22ed75e35ddAl Viroextern void mnt_pin(struct vfsmount *mnt);
667b7b1ace2d9d06d76bce7481a045c22ed75e35ddAl Viroextern void mnt_unpin(struct vfsmount *mnt);
678366025eb80dfa0d8d94b286d53027081c280ef1Dave Hansenextern int __mnt_is_readonly(struct vfsmount *mnt);
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
69bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebuststruct file_system_type;
70bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebustextern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
71bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust				      int flags, const char *name,
72bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust				      void *data);
73bb4a58bf46473e3e83d84054bbc110db3a0f85e4Trond Myklebust
74ea5b778a8b98c85a87d66bf844904f9c3802b869David Howellsextern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void mark_mounts_for_expiry(struct list_head *mounts);
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
77d53d9f16ea95a91ad4aa114809dcde486ca4000dAndrew Mortonextern dev_t name_to_dev_t(char *name);
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _LINUX_MOUNT_H */
80