Blame view

fs/mount.h 3.46 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;
8823c079b   Eric W. Biederman   vfs: Add setns su...
13
  	u64			seq;	/* Sequence number to prevent loops */
0226f4923   Al Viro   vfs: take /proc/*...
14
  	wait_queue_head_t poll;
c7999c362   Al Viro   reduce m_start() ...
15
  	u64 event;
0226f4923   Al Viro   vfs: take /proc/*...
16
  };
b2dba1af3   Al Viro   vfs: new internal...
17

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

f7a99c5b7   Al Viro   get rid of ->mnt_...
77
78
79
  static inline int is_mounted(struct vfsmount *mnt)
  {
  	/* neither detached nor internal? */
260a459d2   Eric W. Biederman   vfs: Is mounted s...
80
  	return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns);
f7a99c5b7   Al Viro   get rid of ->mnt_...
81
  }
474279dc0   Al Viro   split __lookup_mn...
82
83
  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/*...
84

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