1 #include <linux/mount.h>
2 #include <linux/seq_file.h>
3 #include <linux/poll.h>
4 #include <linux/ns_common.h>
10 struct list_head list
;
11 struct user_namespace
*user_ns
;
12 u64 seq
; /* Sequence number to prevent loops */
13 wait_queue_head_t poll
;
23 struct hlist_node m_hash
;
24 struct dentry
*m_dentry
;
25 struct hlist_head m_list
;
30 struct hlist_node mnt_hash
;
31 struct mount
*mnt_parent
;
32 struct dentry
*mnt_mountpoint
;
35 struct rcu_head mnt_rcu
;
36 struct llist_node mnt_llist
;
39 struct mnt_pcp __percpu
*mnt_pcp
;
44 struct list_head mnt_mounts
; /* list of children, anchored here */
45 struct list_head mnt_child
; /* and going through their mnt_child */
46 struct list_head mnt_instance
; /* mount instance on sb->s_mounts */
47 const char *mnt_devname
; /* Name of device e.g. /dev/dsk/hda1 */
48 struct list_head mnt_list
;
49 struct list_head mnt_expire
; /* link in fs-specific expiry list */
50 struct list_head mnt_share
; /* circular list of shared mounts */
51 struct list_head mnt_slave_list
;/* list of slave mounts */
52 struct list_head mnt_slave
; /* slave list entry */
53 struct mount
*mnt_master
; /* slave is on master->mnt_slave_list */
54 struct mnt_namespace
*mnt_ns
; /* containing namespace */
55 struct mountpoint
*mnt_mp
; /* where is it mounted */
56 struct hlist_node mnt_mp_list
; /* list mounts with the same mountpoint */
57 #ifdef CONFIG_FSNOTIFY
58 struct hlist_head mnt_fsnotify_marks
;
59 __u32 mnt_fsnotify_mask
;
61 int mnt_id
; /* mount identifier */
62 int mnt_group_id
; /* peer group identifier */
63 int mnt_expiry_mark
; /* true if marked for expiry */
64 struct hlist_head mnt_pins
;
65 struct path mnt_ex_mountpoint
;
68 #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
70 static inline struct mount
*real_mount(struct vfsmount
*mnt
)
72 return container_of(mnt
, struct mount
, mnt
);
75 static inline int mnt_has_parent(struct mount
*mnt
)
77 return mnt
!= mnt
->mnt_parent
;
80 static inline int is_mounted(struct vfsmount
*mnt
)
82 /* neither detached nor internal? */
83 return !IS_ERR_OR_NULL(real_mount(mnt
)->mnt_ns
);
86 extern struct mount
*__lookup_mnt(struct vfsmount
*, struct dentry
*);
87 extern struct mount
*__lookup_mnt_last(struct vfsmount
*, struct dentry
*);
89 extern bool legitimize_mnt(struct vfsmount
*, unsigned);
91 extern void __detach_mounts(struct dentry
*dentry
);
93 static inline void detach_mounts(struct dentry
*dentry
)
95 if (!d_mountpoint(dentry
))
97 __detach_mounts(dentry
);
100 static inline void get_mnt_ns(struct mnt_namespace
*ns
)
102 atomic_inc(&ns
->count
);
105 extern seqlock_t mount_lock
;
107 static inline void lock_mount_hash(void)
109 write_seqlock(&mount_lock
);
112 static inline void unlock_mount_hash(void)
114 write_sequnlock(&mount_lock
);
119 struct mnt_namespace
*ns
;
121 int (*show
)(struct seq_file
*, struct vfsmount
*);
127 #define proc_mounts(p) (container_of((p), struct proc_mounts, m))
129 extern const struct seq_operations mounts_op
;
131 extern bool __is_local_mountpoint(struct dentry
*dentry
);
132 static inline bool is_local_mountpoint(struct dentry
*dentry
)
134 if (!d_mountpoint(dentry
))
137 return __is_local_mountpoint(dentry
);