xref: /openbmc/linux/fs/mount.h (revision 39f7c4db)
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;
7be08d6d2SAl Viro 	struct mount *	root;
80226f492SAl Viro 	struct list_head	list;
90226f492SAl Viro 	wait_queue_head_t poll;
100226f492SAl Viro 	int event;
110226f492SAl Viro };
12b2dba1afSAl Viro 
1368e8a9feSAl Viro struct mnt_pcp {
1468e8a9feSAl Viro 	int mnt_count;
1568e8a9feSAl Viro 	int mnt_writers;
1668e8a9feSAl Viro };
1768e8a9feSAl Viro 
187d6fec45SAl Viro struct mount {
191b8e5564SAl Viro 	struct list_head mnt_hash;
200714a533SAl Viro 	struct mount *mnt_parent;
21a73324daSAl Viro 	struct dentry *mnt_mountpoint;
227d6fec45SAl Viro 	struct vfsmount mnt;
2368e8a9feSAl Viro #ifdef CONFIG_SMP
2468e8a9feSAl Viro 	struct mnt_pcp __percpu *mnt_pcp;
2568e8a9feSAl Viro 	atomic_t mnt_longterm;		/* how many of the refs are longterm */
2668e8a9feSAl Viro #else
2768e8a9feSAl Viro 	int mnt_count;
2868e8a9feSAl Viro 	int mnt_writers;
2968e8a9feSAl Viro #endif
306b41d536SAl Viro 	struct list_head mnt_mounts;	/* list of children, anchored here */
316b41d536SAl Viro 	struct list_head mnt_child;	/* and going through their mnt_child */
3239f7c4dbSMiklos Szeredi 	struct list_head mnt_instance;	/* mount instance on sb->s_mounts */
3352ba1621SAl Viro 	const char *mnt_devname;	/* Name of device e.g. /dev/dsk/hda1 */
341a4eeaf2SAl Viro 	struct list_head mnt_list;
356776db3dSAl Viro 	struct list_head mnt_expire;	/* link in fs-specific expiry list */
366776db3dSAl Viro 	struct list_head mnt_share;	/* circular list of shared mounts */
376776db3dSAl Viro 	struct list_head mnt_slave_list;/* list of slave mounts */
386776db3dSAl Viro 	struct list_head mnt_slave;	/* slave list entry */
3932301920SAl Viro 	struct mount *mnt_master;	/* slave is on master->mnt_slave_list */
40143c8c91SAl Viro 	struct mnt_namespace *mnt_ns;	/* containing namespace */
41c63181e6SAl Viro #ifdef CONFIG_FSNOTIFY
42c63181e6SAl Viro 	struct hlist_head mnt_fsnotify_marks;
43c63181e6SAl Viro 	__u32 mnt_fsnotify_mask;
44c63181e6SAl Viro #endif
4515169fe7SAl Viro 	int mnt_id;			/* mount identifier */
4615169fe7SAl Viro 	int mnt_group_id;		/* peer group identifier */
47863d684fSAl Viro 	int mnt_expiry_mark;		/* true if marked for expiry */
48863d684fSAl Viro 	int mnt_pinned;
49863d684fSAl Viro 	int mnt_ghosts;
507d6fec45SAl Viro };
517d6fec45SAl Viro 
527d6fec45SAl Viro static inline struct mount *real_mount(struct vfsmount *mnt)
537d6fec45SAl Viro {
547d6fec45SAl Viro 	return container_of(mnt, struct mount, mnt);
557d6fec45SAl Viro }
567d6fec45SAl Viro 
57676da58dSAl Viro static inline int mnt_has_parent(struct mount *mnt)
58b2dba1afSAl Viro {
590714a533SAl Viro 	return mnt != mnt->mnt_parent;
60b2dba1afSAl Viro }
61c7105365SAl Viro 
62c7105365SAl Viro extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
630226f492SAl Viro 
640226f492SAl Viro static inline void get_mnt_ns(struct mnt_namespace *ns)
650226f492SAl Viro {
660226f492SAl Viro 	atomic_inc(&ns->count);
670226f492SAl Viro }
680226f492SAl Viro 
690226f492SAl Viro struct proc_mounts {
700226f492SAl Viro 	struct seq_file m; /* must be the first element */
710226f492SAl Viro 	struct mnt_namespace *ns;
720226f492SAl Viro 	struct path root;
730226f492SAl Viro 	int (*show)(struct seq_file *, struct vfsmount *);
740226f492SAl Viro };
750226f492SAl Viro 
760226f492SAl Viro extern const struct seq_operations mounts_op;
77