1b2dba1afSAl Viro #include <linux/mount.h> 20226f492SAl Viro #include <linux/seq_file.h> 30226f492SAl Viro #include <linux/poll.h> 40226f492SAl Viro 50226f492SAl Viro struct mnt_namespace { 60226f492SAl Viro atomic_t count; 798f842e6SEric W. Biederman unsigned int proc_inum; 8be08d6d2SAl Viro struct mount * root; 90226f492SAl Viro struct list_head list; 10771b1371SEric W. Biederman struct user_namespace *user_ns; 118823c079SEric W. Biederman u64 seq; /* Sequence number to prevent loops */ 120226f492SAl Viro wait_queue_head_t poll; 130226f492SAl Viro int event; 140226f492SAl Viro }; 15b2dba1afSAl Viro 1668e8a9feSAl Viro struct mnt_pcp { 1768e8a9feSAl Viro int mnt_count; 1868e8a9feSAl Viro int mnt_writers; 1968e8a9feSAl Viro }; 2068e8a9feSAl Viro 2184d17192SAl Viro struct mountpoint { 2284d17192SAl Viro struct list_head m_hash; 2384d17192SAl Viro struct dentry *m_dentry; 2484d17192SAl Viro int m_count; 2584d17192SAl Viro }; 2684d17192SAl Viro 277d6fec45SAl Viro struct mount { 281b8e5564SAl Viro struct list_head mnt_hash; 290714a533SAl Viro struct mount *mnt_parent; 30a73324daSAl Viro struct dentry *mnt_mountpoint; 317d6fec45SAl Viro struct vfsmount mnt; 3268e8a9feSAl Viro #ifdef CONFIG_SMP 3368e8a9feSAl Viro struct mnt_pcp __percpu *mnt_pcp; 3468e8a9feSAl Viro #else 3568e8a9feSAl Viro int mnt_count; 3668e8a9feSAl Viro int mnt_writers; 3768e8a9feSAl Viro #endif 386b41d536SAl Viro struct list_head mnt_mounts; /* list of children, anchored here */ 396b41d536SAl Viro struct list_head mnt_child; /* and going through their mnt_child */ 4039f7c4dbSMiklos Szeredi struct list_head mnt_instance; /* mount instance on sb->s_mounts */ 4152ba1621SAl Viro const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 421a4eeaf2SAl Viro struct list_head mnt_list; 436776db3dSAl Viro struct list_head mnt_expire; /* link in fs-specific expiry list */ 446776db3dSAl Viro struct list_head mnt_share; /* circular list of shared mounts */ 456776db3dSAl Viro struct list_head mnt_slave_list;/* list of slave mounts */ 466776db3dSAl Viro struct list_head mnt_slave; /* slave list entry */ 4732301920SAl Viro struct mount *mnt_master; /* slave is on master->mnt_slave_list */ 48143c8c91SAl Viro struct mnt_namespace *mnt_ns; /* containing namespace */ 4984d17192SAl Viro struct mountpoint *mnt_mp; /* where is it mounted */ 50c63181e6SAl Viro #ifdef CONFIG_FSNOTIFY 51c63181e6SAl Viro struct hlist_head mnt_fsnotify_marks; 52c63181e6SAl Viro __u32 mnt_fsnotify_mask; 53c63181e6SAl Viro #endif 5415169fe7SAl Viro int mnt_id; /* mount identifier */ 5515169fe7SAl Viro int mnt_group_id; /* peer group identifier */ 56863d684fSAl Viro int mnt_expiry_mark; /* true if marked for expiry */ 57863d684fSAl Viro int mnt_pinned; 58863d684fSAl Viro int mnt_ghosts; 597d6fec45SAl Viro }; 607d6fec45SAl Viro 61f7a99c5bSAl Viro #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ 62f7a99c5bSAl Viro 637d6fec45SAl Viro static inline struct mount *real_mount(struct vfsmount *mnt) 647d6fec45SAl Viro { 657d6fec45SAl Viro return container_of(mnt, struct mount, mnt); 667d6fec45SAl Viro } 677d6fec45SAl Viro 68676da58dSAl Viro static inline int mnt_has_parent(struct mount *mnt) 69b2dba1afSAl Viro { 700714a533SAl Viro return mnt != mnt->mnt_parent; 71b2dba1afSAl Viro } 72c7105365SAl Viro 73f7a99c5bSAl Viro static inline int is_mounted(struct vfsmount *mnt) 74f7a99c5bSAl Viro { 75f7a99c5bSAl Viro /* neither detached nor internal? */ 76f7a99c5bSAl Viro return !IS_ERR_OR_NULL(real_mount(mnt)); 77f7a99c5bSAl Viro } 78f7a99c5bSAl Viro 79c7105365SAl Viro extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int); 800226f492SAl Viro 810226f492SAl Viro static inline void get_mnt_ns(struct mnt_namespace *ns) 820226f492SAl Viro { 830226f492SAl Viro atomic_inc(&ns->count); 840226f492SAl Viro } 850226f492SAl Viro 860226f492SAl Viro struct proc_mounts { 876ce6e24eSAl Viro struct seq_file m; 880226f492SAl Viro struct mnt_namespace *ns; 890226f492SAl Viro struct path root; 900226f492SAl Viro int (*show)(struct seq_file *, struct vfsmount *); 910226f492SAl Viro }; 920226f492SAl Viro 936ce6e24eSAl Viro #define proc_mounts(p) (container_of((p), struct proc_mounts, m)) 946ce6e24eSAl Viro 950226f492SAl Viro extern const struct seq_operations mounts_op; 96