Blame view
fs/mount.h
3.58 KB
b2dba1af3
|
1 |
#include <linux/mount.h> |
0226f4923
|
2 3 |
#include <linux/seq_file.h> #include <linux/poll.h> |
435d5f4bb
|
4 |
#include <linux/ns_common.h> |
87b95ce09
|
5 |
#include <linux/fs_pin.h> |
0226f4923
|
6 7 8 |
struct mnt_namespace { atomic_t count; |
435d5f4bb
|
9 |
struct ns_common ns; |
be08d6d26
|
10 |
struct mount * root; |
0226f4923
|
11 |
struct list_head list; |
771b13716
|
12 |
struct user_namespace *user_ns; |
537f7ccb3
|
13 |
struct ucounts *ucounts; |
8823c079b
|
14 |
u64 seq; /* Sequence number to prevent loops */ |
0226f4923
|
15 |
wait_queue_head_t poll; |
c7999c362
|
16 |
u64 event; |
d29216842
|
17 18 |
unsigned int mounts; /* # of mounts in the namespace */ unsigned int pending_mounts; |
0226f4923
|
19 |
}; |
b2dba1af3
|
20 |
|
68e8a9fea
|
21 22 23 24 |
struct mnt_pcp { int mnt_count; int mnt_writers; }; |
84d17192d
|
25 |
struct mountpoint { |
0818bf27c
|
26 |
struct hlist_node m_hash; |
84d17192d
|
27 |
struct dentry *m_dentry; |
0a5eb7c81
|
28 |
struct hlist_head m_list; |
84d17192d
|
29 30 |
int m_count; }; |
7d6fec45a
|
31 |
struct mount { |
38129a13e
|
32 |
struct hlist_node mnt_hash; |
0714a5338
|
33 |
struct mount *mnt_parent; |
a73324da7
|
34 |
struct dentry *mnt_mountpoint; |
7d6fec45a
|
35 |
struct vfsmount mnt; |
9ea459e11
|
36 37 38 39 |
union { struct rcu_head mnt_rcu; struct llist_node mnt_llist; }; |
68e8a9fea
|
40 41 |
#ifdef CONFIG_SMP struct mnt_pcp __percpu *mnt_pcp; |
68e8a9fea
|
42 43 44 45 |
#else int mnt_count; int mnt_writers; #endif |
6b41d536f
|
46 47 |
struct list_head mnt_mounts; /* list of children, anchored here */ struct list_head mnt_child; /* and going through their mnt_child */ |
39f7c4db1
|
48 |
struct list_head mnt_instance; /* mount instance on sb->s_mounts */ |
52ba1621d
|
49 |
const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ |
1a4eeaf2a
|
50 |
struct list_head mnt_list; |
6776db3d3
|
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
|
55 |
struct mount *mnt_master; /* slave is on master->mnt_slave_list */ |
143c8c91c
|
56 |
struct mnt_namespace *mnt_ns; /* containing namespace */ |
84d17192d
|
57 |
struct mountpoint *mnt_mp; /* where is it mounted */ |
0a5eb7c81
|
58 |
struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */ |
c63181e6b
|
59 60 61 62 |
#ifdef CONFIG_FSNOTIFY struct hlist_head mnt_fsnotify_marks; __u32 mnt_fsnotify_mask; #endif |
15169fe78
|
63 64 |
int mnt_id; /* mount identifier */ int mnt_group_id; /* peer group identifier */ |
863d684f9
|
65 |
int mnt_expiry_mark; /* true if marked for expiry */ |
215752fce
|
66 |
struct hlist_head mnt_pins; |
87b95ce09
|
67 68 |
struct fs_pin mnt_umount; struct dentry *mnt_ex_mountpoint; |
7d6fec45a
|
69 |
}; |
f7a99c5b7
|
70 |
#define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ |
7d6fec45a
|
71 72 73 74 |
static inline struct mount *real_mount(struct vfsmount *mnt) { return container_of(mnt, struct mount, mnt); } |
676da58df
|
75 |
static inline int mnt_has_parent(struct mount *mnt) |
b2dba1af3
|
76 |
{ |
0714a5338
|
77 |
return mnt != mnt->mnt_parent; |
b2dba1af3
|
78 |
} |
c71053659
|
79 |
|
f7a99c5b7
|
80 81 82 |
static inline int is_mounted(struct vfsmount *mnt) { /* neither detached nor internal? */ |
260a459d2
|
83 |
return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns); |
f7a99c5b7
|
84 |
} |
474279dc0
|
85 86 |
extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); extern struct mount *__lookup_mnt_last(struct vfsmount *, struct dentry *); |
0226f4923
|
87 |
|
294d71ff2
|
88 |
extern int __legitimize_mnt(struct vfsmount *, unsigned); |
48a066e72
|
89 |
extern bool legitimize_mnt(struct vfsmount *, unsigned); |
80b5dce8c
|
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
|
98 99 100 101 |
static inline void get_mnt_ns(struct mnt_namespace *ns) { atomic_inc(&ns->count); } |
48a066e72
|
102 |
extern seqlock_t mount_lock; |
719ea2fbb
|
103 104 105 |
static inline void lock_mount_hash(void) { |
48a066e72
|
106 |
write_seqlock(&mount_lock); |
719ea2fbb
|
107 108 109 110 |
} static inline void unlock_mount_hash(void) { |
48a066e72
|
111 |
write_sequnlock(&mount_lock); |
719ea2fbb
|
112 |
} |
0226f4923
|
113 |
struct proc_mounts { |
0226f4923
|
114 115 116 |
struct mnt_namespace *ns; struct path root; int (*show)(struct seq_file *, struct vfsmount *); |
c7999c362
|
117 118 119 |
void *cached_mount; u64 cached_event; loff_t cached_index; |
0226f4923
|
120 121 122 |
}; extern const struct seq_operations mounts_op; |
7af1364ff
|
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); } |