Blame view
fs/mount.h
4.18 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
b2dba1af3 vfs: new internal... |
2 |
#include <linux/mount.h> |
0226f4923 vfs: take /proc/*... |
3 4 |
#include <linux/seq_file.h> #include <linux/poll.h> |
435d5f4bb common object emb... |
5 |
#include <linux/ns_common.h> |
87b95ce09 switch the IO-tri... |
6 |
#include <linux/fs_pin.h> |
0226f4923 vfs: take /proc/*... |
7 8 9 |
struct mnt_namespace { atomic_t count; |
435d5f4bb common object emb... |
10 |
struct ns_common ns; |
be08d6d26 switch mnt_namesp... |
11 |
struct mount * root; |
9f6c61f96 proc/mounts: add ... |
12 13 14 15 16 |
/* * Traversal and modification of .list is protected by either * - taking namespace_sem for write, OR * - taking namespace_sem for read AND taking .ns_lock. */ |
0226f4923 vfs: take /proc/*... |
17 |
struct list_head list; |
9f6c61f96 proc/mounts: add ... |
18 |
spinlock_t ns_lock; |
771b13716 vfs: Add a user n... |
19 |
struct user_namespace *user_ns; |
537f7ccb3 mntns: Add a limi... |
20 |
struct ucounts *ucounts; |
8823c079b vfs: Add setns su... |
21 |
u64 seq; /* Sequence number to prevent loops */ |
0226f4923 vfs: take /proc/*... |
22 |
wait_queue_head_t poll; |
c7999c362 reduce m_start() ... |
23 |
u64 event; |
d29216842 mnt: Add a per mo... |
24 25 |
unsigned int mounts; /* # of mounts in the namespace */ unsigned int pending_mounts; |
3859a271a randstruct: Mark ... |
26 |
} __randomize_layout; |
b2dba1af3 vfs: new internal... |
27 |
|
68e8a9fea vfs: all counters... |
28 29 30 31 |
struct mnt_pcp { int mnt_count; int mnt_writers; }; |
84d17192d get rid of full-h... |
32 |
struct mountpoint { |
0818bf27c resizable namespa... |
33 |
struct hlist_node m_hash; |
84d17192d get rid of full-h... |
34 |
struct dentry *m_dentry; |
0a5eb7c81 vfs: Keep a list ... |
35 |
struct hlist_head m_list; |
84d17192d get rid of full-h... |
36 37 |
int m_count; }; |
7d6fec45a vfs: start hiding... |
38 |
struct mount { |
38129a13e switch mnt_hash t... |
39 |
struct hlist_node mnt_hash; |
0714a5338 vfs: now it can b... |
40 |
struct mount *mnt_parent; |
a73324da7 vfs: move mnt_mou... |
41 |
struct dentry *mnt_mountpoint; |
7d6fec45a vfs: start hiding... |
42 |
struct vfsmount mnt; |
9ea459e11 delayed mntput |
43 44 45 46 |
union { struct rcu_head mnt_rcu; struct llist_node mnt_llist; }; |
68e8a9fea vfs: all counters... |
47 48 |
#ifdef CONFIG_SMP struct mnt_pcp __percpu *mnt_pcp; |
68e8a9fea vfs: all counters... |
49 50 51 52 |
#else int mnt_count; int mnt_writers; #endif |
6b41d536f vfs: take mnt_chi... |
53 54 |
struct list_head mnt_mounts; /* list of children, anchored here */ struct list_head mnt_child; /* and going through their mnt_child */ |
39f7c4db1 vfs: keep list of... |
55 |
struct list_head mnt_instance; /* mount instance on sb->s_mounts */ |
52ba1621d vfs: move mnt_dev... |
56 |
const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ |
1a4eeaf2a vfs: move mnt_lis... |
57 |
struct list_head mnt_list; |
6776db3d3 vfs: take mnt_sha... |
58 59 60 61 |
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 vfs: and now we c... |
62 |
struct mount *mnt_master; /* slave is on master->mnt_slave_list */ |
143c8c91c vfs: mnt_ns moved... |
63 |
struct mnt_namespace *mnt_ns; /* containing namespace */ |
84d17192d get rid of full-h... |
64 |
struct mountpoint *mnt_mp; /* where is it mounted */ |
56cbb429d switch the remnan... |
65 66 67 68 |
union { struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */ struct hlist_node mnt_umount; }; |
99b19d164 mnt: In propgate_... |
69 |
struct list_head mnt_umounting; /* list entry for umount propagation */ |
c63181e6b vfs: move fsnotif... |
70 |
#ifdef CONFIG_FSNOTIFY |
08991e83b fsnotify: Free fs... |
71 |
struct fsnotify_mark_connector __rcu *mnt_fsnotify_marks; |
c63181e6b vfs: move fsnotif... |
72 73 |
__u32 mnt_fsnotify_mask; #endif |
15169fe78 vfs: mnt_id/mnt_g... |
74 75 |
int mnt_id; /* mount identifier */ int mnt_group_id; /* peer group identifier */ |
863d684f9 vfs: move the res... |
76 |
int mnt_expiry_mark; /* true if marked for expiry */ |
215752fce acct: get rid of ... |
77 |
struct hlist_head mnt_pins; |
56cbb429d switch the remnan... |
78 |
struct hlist_head mnt_stuck_children; |
3859a271a randstruct: Mark ... |
79 |
} __randomize_layout; |
7d6fec45a vfs: start hiding... |
80 |
|
f7a99c5b7 get rid of ->mnt_... |
81 |
#define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ |
7d6fec45a vfs: start hiding... |
82 83 84 85 |
static inline struct mount *real_mount(struct vfsmount *mnt) { return container_of(mnt, struct mount, mnt); } |
676da58df vfs: spread struc... |
86 |
static inline int mnt_has_parent(struct mount *mnt) |
b2dba1af3 vfs: new internal... |
87 |
{ |
0714a5338 vfs: now it can b... |
88 |
return mnt != mnt->mnt_parent; |
b2dba1af3 vfs: new internal... |
89 |
} |
c71053659 vfs: spread struc... |
90 |
|
f7a99c5b7 get rid of ->mnt_... |
91 92 93 |
static inline int is_mounted(struct vfsmount *mnt) { /* neither detached nor internal? */ |
260a459d2 vfs: Is mounted s... |
94 |
return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns); |
f7a99c5b7 get rid of ->mnt_... |
95 |
} |
474279dc0 split __lookup_mn... |
96 |
extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); |
0226f4923 vfs: take /proc/*... |
97 |
|
294d71ff2 new helper: __leg... |
98 |
extern int __legitimize_mnt(struct vfsmount *, unsigned); |
48a066e72 RCU'd vfsmounts |
99 |
extern bool legitimize_mnt(struct vfsmount *, unsigned); |
c6609c0a1 vfs: add path_is_... |
100 101 102 103 104 |
static inline bool __path_is_mountpoint(const struct path *path) { struct mount *m = __lookup_mnt(path->mnt, path->dentry); return m && likely(!(m->mnt.mnt_flags & MNT_SYNC_UMOUNT)); } |
80b5dce8c vfs: Add a functi... |
105 106 107 108 109 110 111 112 |
extern void __detach_mounts(struct dentry *dentry); static inline void detach_mounts(struct dentry *dentry) { if (!d_mountpoint(dentry)) return; __detach_mounts(dentry); } |
0226f4923 vfs: take /proc/*... |
113 114 115 116 |
static inline void get_mnt_ns(struct mnt_namespace *ns) { atomic_inc(&ns->count); } |
48a066e72 RCU'd vfsmounts |
117 |
extern seqlock_t mount_lock; |
719ea2fbb new helpers: lock... |
118 119 120 |
static inline void lock_mount_hash(void) { |
48a066e72 RCU'd vfsmounts |
121 |
write_seqlock(&mount_lock); |
719ea2fbb new helpers: lock... |
122 123 124 125 |
} static inline void unlock_mount_hash(void) { |
48a066e72 RCU'd vfsmounts |
126 |
write_sequnlock(&mount_lock); |
719ea2fbb new helpers: lock... |
127 |
} |
0226f4923 vfs: take /proc/*... |
128 |
struct proc_mounts { |
0226f4923 vfs: take /proc/*... |
129 130 131 |
struct mnt_namespace *ns; struct path root; int (*show)(struct seq_file *, struct vfsmount *); |
9f6c61f96 proc/mounts: add ... |
132 |
struct mount cursor; |
0226f4923 vfs: take /proc/*... |
133 134 135 |
}; extern const struct seq_operations mounts_op; |
7af1364ff vfs: Don't allow ... |
136 137 138 139 140 141 142 143 144 |
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); } |
74e831221 saner handling of... |
145 146 147 148 149 |
static inline bool is_anon_ns(struct mnt_namespace *ns) { return ns->seq == 0; } |
9f6c61f96 proc/mounts: add ... |
150 151 |
extern void mnt_cursor_del(struct mnt_namespace *ns, struct mount *cursor); |