0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_MOUNT_H
0011 #define _LINUX_MOUNT_H
0012
0013 #include <linux/types.h>
0014 #include <asm/barrier.h>
0015
0016 struct super_block;
0017 struct dentry;
0018 struct user_namespace;
0019 struct file_system_type;
0020 struct fs_context;
0021 struct file;
0022 struct path;
0023
0024 #define MNT_NOSUID 0x01
0025 #define MNT_NODEV 0x02
0026 #define MNT_NOEXEC 0x04
0027 #define MNT_NOATIME 0x08
0028 #define MNT_NODIRATIME 0x10
0029 #define MNT_RELATIME 0x20
0030 #define MNT_READONLY 0x40
0031 #define MNT_NOSYMFOLLOW 0x80
0032
0033 #define MNT_SHRINKABLE 0x100
0034 #define MNT_WRITE_HOLD 0x200
0035
0036 #define MNT_SHARED 0x1000
0037 #define MNT_UNBINDABLE 0x2000
0038
0039
0040
0041
0042
0043
0044
0045 #define MNT_SHARED_MASK (MNT_UNBINDABLE)
0046 #define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
0047 | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
0048 | MNT_READONLY | MNT_NOSYMFOLLOW)
0049 #define MNT_ATIME_MASK (MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME )
0050
0051 #define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
0052 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED | \
0053 MNT_CURSOR)
0054
0055 #define MNT_INTERNAL 0x4000
0056
0057 #define MNT_LOCK_ATIME 0x040000
0058 #define MNT_LOCK_NOEXEC 0x080000
0059 #define MNT_LOCK_NOSUID 0x100000
0060 #define MNT_LOCK_NODEV 0x200000
0061 #define MNT_LOCK_READONLY 0x400000
0062 #define MNT_LOCKED 0x800000
0063 #define MNT_DOOMED 0x1000000
0064 #define MNT_SYNC_UMOUNT 0x2000000
0065 #define MNT_MARKED 0x4000000
0066 #define MNT_UMOUNT 0x8000000
0067 #define MNT_CURSOR 0x10000000
0068
0069 struct vfsmount {
0070 struct dentry *mnt_root;
0071 struct super_block *mnt_sb;
0072 int mnt_flags;
0073 struct user_namespace *mnt_userns;
0074 } __randomize_layout;
0075
0076 static inline struct user_namespace *mnt_user_ns(const struct vfsmount *mnt)
0077 {
0078
0079 return smp_load_acquire(&mnt->mnt_userns);
0080 }
0081
0082 extern int mnt_want_write(struct vfsmount *mnt);
0083 extern int mnt_want_write_file(struct file *file);
0084 extern void mnt_drop_write(struct vfsmount *mnt);
0085 extern void mnt_drop_write_file(struct file *file);
0086 extern void mntput(struct vfsmount *mnt);
0087 extern struct vfsmount *mntget(struct vfsmount *mnt);
0088 extern struct vfsmount *mnt_clone_internal(const struct path *path);
0089 extern bool __mnt_is_readonly(struct vfsmount *mnt);
0090 extern bool mnt_may_suid(struct vfsmount *mnt);
0091
0092 extern struct vfsmount *clone_private_mount(const struct path *path);
0093 extern int __mnt_want_write(struct vfsmount *);
0094 extern void __mnt_drop_write(struct vfsmount *);
0095
0096 extern struct vfsmount *fc_mount(struct fs_context *fc);
0097 extern struct vfsmount *vfs_create_mount(struct fs_context *fc);
0098 extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
0099 int flags, const char *name,
0100 void *data);
0101 extern struct vfsmount *vfs_submount(const struct dentry *mountpoint,
0102 struct file_system_type *type,
0103 const char *name, void *data);
0104
0105 extern void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list);
0106 extern void mark_mounts_for_expiry(struct list_head *mounts);
0107
0108 extern dev_t name_to_dev_t(const char *name);
0109 extern bool path_is_mountpoint(const struct path *path);
0110
0111 extern bool our_mnt(struct vfsmount *mnt);
0112
0113 extern struct vfsmount *kern_mount(struct file_system_type *);
0114 extern void kern_unmount(struct vfsmount *mnt);
0115 extern int may_umount_tree(struct vfsmount *);
0116 extern int may_umount(struct vfsmount *);
0117 extern long do_mount(const char *, const char __user *,
0118 const char *, unsigned long, void *);
0119 extern struct vfsmount *collect_mounts(const struct path *);
0120 extern void drop_collected_mounts(struct vfsmount *);
0121 extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
0122 struct vfsmount *);
0123 extern void kern_unmount_array(struct vfsmount *mnt[], unsigned int num);
0124
0125 #endif