Blame view

fs/mount.h 2.88 KB
b2dba1af3   Al Viro   vfs: new internal...
1
  #include <linux/mount.h>
0226f4923   Al Viro   vfs: take /proc/*...
2
3
4
5
6
  #include <linux/seq_file.h>
  #include <linux/poll.h>
  
  struct mnt_namespace {
  	atomic_t		count;
98f842e67   Eric W. Biederman   proc: Usable inod...
7
  	unsigned int		proc_inum;
be08d6d26   Al Viro   switch mnt_namesp...
8
  	struct mount *	root;
0226f4923   Al Viro   vfs: take /proc/*...
9
  	struct list_head	list;
771b13716   Eric W. Biederman   vfs: Add a user n...
10
  	struct user_namespace	*user_ns;
8823c079b   Eric W. Biederman   vfs: Add setns su...
11
  	u64			seq;	/* Sequence number to prevent loops */
0226f4923   Al Viro   vfs: take /proc/*...
12
  	wait_queue_head_t poll;
c7999c362   Al Viro   reduce m_start() ...
13
  	u64 event;
0226f4923   Al Viro   vfs: take /proc/*...
14
  };
b2dba1af3   Al Viro   vfs: new internal...
15

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

f7a99c5b7   Al Viro   get rid of ->mnt_...
69
70
71
  static inline int is_mounted(struct vfsmount *mnt)
  {
  	/* neither detached nor internal? */
260a459d2   Eric W. Biederman   vfs: Is mounted s...
72
  	return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns);
f7a99c5b7   Al Viro   get rid of ->mnt_...
73
  }
474279dc0   Al Viro   split __lookup_mn...
74
75
  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/*...
76

48a066e72   Al Viro   RCU'd vfsmounts
77
  extern bool legitimize_mnt(struct vfsmount *, unsigned);
0226f4923   Al Viro   vfs: take /proc/*...
78
79
80
81
  static inline void get_mnt_ns(struct mnt_namespace *ns)
  {
  	atomic_inc(&ns->count);
  }
48a066e72   Al Viro   RCU'd vfsmounts
82
  extern seqlock_t mount_lock;
719ea2fbb   Al Viro   new helpers: lock...
83
84
85
  
  static inline void lock_mount_hash(void)
  {
48a066e72   Al Viro   RCU'd vfsmounts
86
  	write_seqlock(&mount_lock);
719ea2fbb   Al Viro   new helpers: lock...
87
88
89
90
  }
  
  static inline void unlock_mount_hash(void)
  {
48a066e72   Al Viro   RCU'd vfsmounts
91
  	write_sequnlock(&mount_lock);
719ea2fbb   Al Viro   new helpers: lock...
92
  }
0226f4923   Al Viro   vfs: take /proc/*...
93
  struct proc_mounts {
6ce6e24e7   Al Viro   get rid of magic ...
94
  	struct seq_file m;
0226f4923   Al Viro   vfs: take /proc/*...
95
96
97
  	struct mnt_namespace *ns;
  	struct path root;
  	int (*show)(struct seq_file *, struct vfsmount *);
c7999c362   Al Viro   reduce m_start() ...
98
99
100
  	void *cached_mount;
  	u64 cached_event;
  	loff_t cached_index;
0226f4923   Al Viro   vfs: take /proc/*...
101
  };
6ce6e24e7   Al Viro   get rid of magic ...
102
  #define proc_mounts(p) (container_of((p), struct proc_mounts, m))
0226f4923   Al Viro   vfs: take /proc/*...
103
  extern const struct seq_operations mounts_op;