Blame view

fs/mount.h 3.58 KB
b2dba1af3   Al Viro   vfs: new internal...
1
  #include <linux/mount.h>
0226f4923   Al Viro   vfs: take /proc/*...
2
3
  #include <linux/seq_file.h>
  #include <linux/poll.h>
435d5f4bb   Al Viro   common object emb...
4
  #include <linux/ns_common.h>
87b95ce09   Al Viro   switch the IO-tri...
5
  #include <linux/fs_pin.h>
0226f4923   Al Viro   vfs: take /proc/*...
6
7
8
  
  struct mnt_namespace {
  	atomic_t		count;
435d5f4bb   Al Viro   common object emb...
9
  	struct ns_common	ns;
be08d6d26   Al Viro   switch mnt_namesp...
10
  	struct mount *	root;
0226f4923   Al Viro   vfs: take /proc/*...
11
  	struct list_head	list;
771b13716   Eric W. Biederman   vfs: Add a user n...
12
  	struct user_namespace	*user_ns;
537f7ccb3   Eric W. Biederman   mntns: Add a limi...
13
  	struct ucounts		*ucounts;
8823c079b   Eric W. Biederman   vfs: Add setns su...
14
  	u64			seq;	/* Sequence number to prevent loops */
0226f4923   Al Viro   vfs: take /proc/*...
15
  	wait_queue_head_t poll;
c7999c362   Al Viro   reduce m_start() ...
16
  	u64 event;
d29216842   Eric W. Biederman   mnt: Add a per mo...
17
18
  	unsigned int		mounts; /* # of mounts in the namespace */
  	unsigned int		pending_mounts;
0226f4923   Al Viro   vfs: take /proc/*...
19
  };
b2dba1af3   Al Viro   vfs: new internal...
20

68e8a9fea   Al Viro   vfs: all counters...
21
22
23
24
  struct mnt_pcp {
  	int mnt_count;
  	int mnt_writers;
  };
84d17192d   Al Viro   get rid of full-h...
25
  struct mountpoint {
0818bf27c   Al Viro   resizable namespa...
26
  	struct hlist_node m_hash;
84d17192d   Al Viro   get rid of full-h...
27
  	struct dentry *m_dentry;
0a5eb7c81   Eric W. Biederman   vfs: Keep a list ...
28
  	struct hlist_head m_list;
84d17192d   Al Viro   get rid of full-h...
29
30
  	int m_count;
  };
7d6fec45a   Al Viro   vfs: start hiding...
31
  struct mount {
38129a13e   Al Viro   switch mnt_hash t...
32
  	struct hlist_node mnt_hash;
0714a5338   Al Viro   vfs: now it can b...
33
  	struct mount *mnt_parent;
a73324da7   Al Viro   vfs: move mnt_mou...
34
  	struct dentry *mnt_mountpoint;
7d6fec45a   Al Viro   vfs: start hiding...
35
  	struct vfsmount mnt;
9ea459e11   Al Viro   delayed mntput
36
37
38
39
  	union {
  		struct rcu_head mnt_rcu;
  		struct llist_node mnt_llist;
  	};
68e8a9fea   Al Viro   vfs: all counters...
40
41
  #ifdef CONFIG_SMP
  	struct mnt_pcp __percpu *mnt_pcp;
68e8a9fea   Al Viro   vfs: all counters...
42
43
44
45
  #else
  	int mnt_count;
  	int mnt_writers;
  #endif
6b41d536f   Al Viro   vfs: take mnt_chi...
46
47
  	struct list_head mnt_mounts;	/* list of children, anchored here */
  	struct list_head mnt_child;	/* and going through their mnt_child */
39f7c4db1   Miklos Szeredi   vfs: keep list of...
48
  	struct list_head mnt_instance;	/* mount instance on sb->s_mounts */
52ba1621d   Al Viro   vfs: move mnt_dev...
49
  	const char *mnt_devname;	/* Name of device e.g. /dev/dsk/hda1 */
1a4eeaf2a   Al Viro   vfs: move mnt_lis...
50
  	struct list_head mnt_list;
6776db3d3   Al Viro   vfs: take mnt_sha...
51
52
53
54
  	struct list_head mnt_expire;	/* link in fs-specific expiry list */
  	struct list_head mnt_share;	/* circular list of shared mounts */
  	struct list_head mnt_slave_list;/* list of slave mounts */
  	struct list_head mnt_slave;	/* slave list entry */
32301920f   Al Viro   vfs: and now we c...
55
  	struct mount *mnt_master;	/* slave is on master->mnt_slave_list */
143c8c91c   Al Viro   vfs: mnt_ns moved...
56
  	struct mnt_namespace *mnt_ns;	/* containing namespace */
84d17192d   Al Viro   get rid of full-h...
57
  	struct mountpoint *mnt_mp;	/* where is it mounted */
0a5eb7c81   Eric W. Biederman   vfs: Keep a list ...
58
  	struct hlist_node mnt_mp_list;	/* list mounts with the same mountpoint */
c63181e6b   Al Viro   vfs: move fsnotif...
59
60
61
62
  #ifdef CONFIG_FSNOTIFY
  	struct hlist_head mnt_fsnotify_marks;
  	__u32 mnt_fsnotify_mask;
  #endif
15169fe78   Al Viro   vfs: mnt_id/mnt_g...
63
64
  	int mnt_id;			/* mount identifier */
  	int mnt_group_id;		/* peer group identifier */
863d684f9   Al Viro   vfs: move the res...
65
  	int mnt_expiry_mark;		/* true if marked for expiry */
215752fce   Al Viro   acct: get rid of ...
66
  	struct hlist_head mnt_pins;
87b95ce09   Al Viro   switch the IO-tri...
67
68
  	struct fs_pin mnt_umount;
  	struct dentry *mnt_ex_mountpoint;
7d6fec45a   Al Viro   vfs: start hiding...
69
  };
f7a99c5b7   Al Viro   get rid of ->mnt_...
70
  #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
7d6fec45a   Al Viro   vfs: start hiding...
71
72
73
74
  static inline struct mount *real_mount(struct vfsmount *mnt)
  {
  	return container_of(mnt, struct mount, mnt);
  }
676da58df   Al Viro   vfs: spread struc...
75
  static inline int mnt_has_parent(struct mount *mnt)
b2dba1af3   Al Viro   vfs: new internal...
76
  {
0714a5338   Al Viro   vfs: now it can b...
77
  	return mnt != mnt->mnt_parent;
b2dba1af3   Al Viro   vfs: new internal...
78
  }
c71053659   Al Viro   vfs: spread struc...
79

f7a99c5b7   Al Viro   get rid of ->mnt_...
80
81
82
  static inline int is_mounted(struct vfsmount *mnt)
  {
  	/* neither detached nor internal? */
260a459d2   Eric W. Biederman   vfs: Is mounted s...
83
  	return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns);
f7a99c5b7   Al Viro   get rid of ->mnt_...
84
  }
474279dc0   Al Viro   split __lookup_mn...
85
86
  extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *);
  extern struct mount *__lookup_mnt_last(struct vfsmount *, struct dentry *);
0226f4923   Al Viro   vfs: take /proc/*...
87

294d71ff2   Al Viro   new helper: __leg...
88
  extern int __legitimize_mnt(struct vfsmount *, unsigned);
48a066e72   Al Viro   RCU'd vfsmounts
89
  extern bool legitimize_mnt(struct vfsmount *, unsigned);
80b5dce8c   Eric W. Biederman   vfs: Add a functi...
90
91
92
93
94
95
96
97
  extern void __detach_mounts(struct dentry *dentry);
  
  static inline void detach_mounts(struct dentry *dentry)
  {
  	if (!d_mountpoint(dentry))
  		return;
  	__detach_mounts(dentry);
  }
0226f4923   Al Viro   vfs: take /proc/*...
98
99
100
101
  static inline void get_mnt_ns(struct mnt_namespace *ns)
  {
  	atomic_inc(&ns->count);
  }
48a066e72   Al Viro   RCU'd vfsmounts
102
  extern seqlock_t mount_lock;
719ea2fbb   Al Viro   new helpers: lock...
103
104
105
  
  static inline void lock_mount_hash(void)
  {
48a066e72   Al Viro   RCU'd vfsmounts
106
  	write_seqlock(&mount_lock);
719ea2fbb   Al Viro   new helpers: lock...
107
108
109
110
  }
  
  static inline void unlock_mount_hash(void)
  {
48a066e72   Al Viro   RCU'd vfsmounts
111
  	write_sequnlock(&mount_lock);
719ea2fbb   Al Viro   new helpers: lock...
112
  }
0226f4923   Al Viro   vfs: take /proc/*...
113
  struct proc_mounts {
0226f4923   Al Viro   vfs: take /proc/*...
114
115
116
  	struct mnt_namespace *ns;
  	struct path root;
  	int (*show)(struct seq_file *, struct vfsmount *);
c7999c362   Al Viro   reduce m_start() ...
117
118
119
  	void *cached_mount;
  	u64 cached_event;
  	loff_t cached_index;
0226f4923   Al Viro   vfs: take /proc/*...
120
121
122
  };
  
  extern const struct seq_operations mounts_op;
7af1364ff   Eric W. Biederman   vfs: Don't allow ...
123
124
125
126
127
128
129
130
131
  
  extern bool __is_local_mountpoint(struct dentry *dentry);
  static inline bool is_local_mountpoint(struct dentry *dentry)
  {
  	if (!d_mountpoint(dentry))
  		return false;
  
  	return __is_local_mountpoint(dentry);
  }