diff options
Diffstat (limited to 'fs/autofs4/autofs_i.h')
-rw-r--r-- | fs/autofs4/autofs_i.h | 132 |
1 files changed, 87 insertions, 45 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 3d283abf67d7..475f9c597cb7 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/auto_fs4.h> | 16 | #include <linux/auto_fs4.h> |
17 | #include <linux/auto_dev-ioctl.h> | 17 | #include <linux/auto_dev-ioctl.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | #include <linux/spinlock.h> | ||
19 | #include <linux/list.h> | 20 | #include <linux/list.h> |
20 | 21 | ||
21 | /* This is the range of ioctl() numbers we claim as ours */ | 22 | /* This is the range of ioctl() numbers we claim as ours */ |
@@ -85,18 +86,9 @@ struct autofs_info { | |||
85 | 86 | ||
86 | uid_t uid; | 87 | uid_t uid; |
87 | gid_t gid; | 88 | gid_t gid; |
88 | |||
89 | mode_t mode; | ||
90 | size_t size; | ||
91 | |||
92 | void (*free)(struct autofs_info *); | ||
93 | union { | ||
94 | const char *symlink; | ||
95 | } u; | ||
96 | }; | 89 | }; |
97 | 90 | ||
98 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ | 91 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ |
99 | #define AUTOFS_INF_MOUNTPOINT (1<<1) /* mountpoint status for direct expire */ | ||
100 | #define AUTOFS_INF_PENDING (1<<2) /* dentry pending mount */ | 92 | #define AUTOFS_INF_PENDING (1<<2) /* dentry pending mount */ |
101 | 93 | ||
102 | struct autofs_wait_queue { | 94 | struct autofs_wait_queue { |
@@ -173,14 +165,7 @@ static inline int autofs4_ispending(struct dentry *dentry) | |||
173 | return 0; | 165 | return 0; |
174 | } | 166 | } |
175 | 167 | ||
176 | static inline void autofs4_copy_atime(struct file *src, struct file *dst) | 168 | struct inode *autofs4_get_inode(struct super_block *, mode_t); |
177 | { | ||
178 | dst->f_path.dentry->d_inode->i_atime = | ||
179 | src->f_path.dentry->d_inode->i_atime; | ||
180 | return; | ||
181 | } | ||
182 | |||
183 | struct inode *autofs4_get_inode(struct super_block *, struct autofs_info *); | ||
184 | void autofs4_free_ino(struct autofs_info *); | 169 | void autofs4_free_ino(struct autofs_info *); |
185 | 170 | ||
186 | /* Expiration */ | 171 | /* Expiration */ |
@@ -209,16 +194,89 @@ void autofs_dev_ioctl_exit(void); | |||
209 | 194 | ||
210 | extern const struct inode_operations autofs4_symlink_inode_operations; | 195 | extern const struct inode_operations autofs4_symlink_inode_operations; |
211 | extern const struct inode_operations autofs4_dir_inode_operations; | 196 | extern const struct inode_operations autofs4_dir_inode_operations; |
212 | extern const struct inode_operations autofs4_root_inode_operations; | ||
213 | extern const struct inode_operations autofs4_indirect_root_inode_operations; | ||
214 | extern const struct inode_operations autofs4_direct_root_inode_operations; | ||
215 | extern const struct file_operations autofs4_dir_operations; | 197 | extern const struct file_operations autofs4_dir_operations; |
216 | extern const struct file_operations autofs4_root_operations; | 198 | extern const struct file_operations autofs4_root_operations; |
199 | extern const struct dentry_operations autofs4_dentry_operations; | ||
200 | |||
201 | /* VFS automount flags management functions */ | ||
202 | |||
203 | static inline void __managed_dentry_set_automount(struct dentry *dentry) | ||
204 | { | ||
205 | dentry->d_flags |= DCACHE_NEED_AUTOMOUNT; | ||
206 | } | ||
207 | |||
208 | static inline void managed_dentry_set_automount(struct dentry *dentry) | ||
209 | { | ||
210 | spin_lock(&dentry->d_lock); | ||
211 | __managed_dentry_set_automount(dentry); | ||
212 | spin_unlock(&dentry->d_lock); | ||
213 | } | ||
214 | |||
215 | static inline void __managed_dentry_clear_automount(struct dentry *dentry) | ||
216 | { | ||
217 | dentry->d_flags &= ~DCACHE_NEED_AUTOMOUNT; | ||
218 | } | ||
219 | |||
220 | static inline void managed_dentry_clear_automount(struct dentry *dentry) | ||
221 | { | ||
222 | spin_lock(&dentry->d_lock); | ||
223 | __managed_dentry_clear_automount(dentry); | ||
224 | spin_unlock(&dentry->d_lock); | ||
225 | } | ||
226 | |||
227 | static inline void __managed_dentry_set_transit(struct dentry *dentry) | ||
228 | { | ||
229 | dentry->d_flags |= DCACHE_MANAGE_TRANSIT; | ||
230 | } | ||
231 | |||
232 | static inline void managed_dentry_set_transit(struct dentry *dentry) | ||
233 | { | ||
234 | spin_lock(&dentry->d_lock); | ||
235 | __managed_dentry_set_transit(dentry); | ||
236 | spin_unlock(&dentry->d_lock); | ||
237 | } | ||
238 | |||
239 | static inline void __managed_dentry_clear_transit(struct dentry *dentry) | ||
240 | { | ||
241 | dentry->d_flags &= ~DCACHE_MANAGE_TRANSIT; | ||
242 | } | ||
243 | |||
244 | static inline void managed_dentry_clear_transit(struct dentry *dentry) | ||
245 | { | ||
246 | spin_lock(&dentry->d_lock); | ||
247 | __managed_dentry_clear_transit(dentry); | ||
248 | spin_unlock(&dentry->d_lock); | ||
249 | } | ||
250 | |||
251 | static inline void __managed_dentry_set_managed(struct dentry *dentry) | ||
252 | { | ||
253 | dentry->d_flags |= (DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT); | ||
254 | } | ||
255 | |||
256 | static inline void managed_dentry_set_managed(struct dentry *dentry) | ||
257 | { | ||
258 | spin_lock(&dentry->d_lock); | ||
259 | __managed_dentry_set_managed(dentry); | ||
260 | spin_unlock(&dentry->d_lock); | ||
261 | } | ||
262 | |||
263 | static inline void __managed_dentry_clear_managed(struct dentry *dentry) | ||
264 | { | ||
265 | dentry->d_flags &= ~(DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT); | ||
266 | } | ||
267 | |||
268 | static inline void managed_dentry_clear_managed(struct dentry *dentry) | ||
269 | { | ||
270 | spin_lock(&dentry->d_lock); | ||
271 | __managed_dentry_clear_managed(dentry); | ||
272 | spin_unlock(&dentry->d_lock); | ||
273 | } | ||
217 | 274 | ||
218 | /* Initializing function */ | 275 | /* Initializing function */ |
219 | 276 | ||
220 | int autofs4_fill_super(struct super_block *, void *, int); | 277 | int autofs4_fill_super(struct super_block *, void *, int); |
221 | struct autofs_info *autofs4_init_ino(struct autofs_info *, struct autofs_sb_info *sbi, mode_t mode); | 278 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); |
279 | void autofs4_clean_ino(struct autofs_info *); | ||
222 | 280 | ||
223 | /* Queue management functions */ | 281 | /* Queue management functions */ |
224 | 282 | ||
@@ -226,19 +284,6 @@ int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | |||
226 | int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); | 284 | int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); |
227 | void autofs4_catatonic_mode(struct autofs_sb_info *); | 285 | void autofs4_catatonic_mode(struct autofs_sb_info *); |
228 | 286 | ||
229 | static inline int autofs4_follow_mount(struct path *path) | ||
230 | { | ||
231 | int res = 0; | ||
232 | |||
233 | while (d_mountpoint(path->dentry)) { | ||
234 | int followed = follow_down(path); | ||
235 | if (!followed) | ||
236 | break; | ||
237 | res = 1; | ||
238 | } | ||
239 | return res; | ||
240 | } | ||
241 | |||
242 | static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) | 287 | static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) |
243 | { | 288 | { |
244 | return new_encode_dev(sbi->sb->s_dev); | 289 | return new_encode_dev(sbi->sb->s_dev); |
@@ -254,17 +299,15 @@ static inline int simple_positive(struct dentry *dentry) | |||
254 | return dentry->d_inode && !d_unhashed(dentry); | 299 | return dentry->d_inode && !d_unhashed(dentry); |
255 | } | 300 | } |
256 | 301 | ||
257 | static inline int __simple_empty(struct dentry *dentry) | 302 | static inline void __autofs4_add_expiring(struct dentry *dentry) |
258 | { | 303 | { |
259 | struct dentry *child; | 304 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
260 | int ret = 0; | 305 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
261 | 306 | if (ino) { | |
262 | list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) | 307 | if (list_empty(&ino->expiring)) |
263 | if (simple_positive(child)) | 308 | list_add(&ino->expiring, &sbi->expiring_list); |
264 | goto out; | 309 | } |
265 | ret = 1; | 310 | return; |
266 | out: | ||
267 | return ret; | ||
268 | } | 311 | } |
269 | 312 | ||
270 | static inline void autofs4_add_expiring(struct dentry *dentry) | 313 | static inline void autofs4_add_expiring(struct dentry *dentry) |
@@ -293,5 +336,4 @@ static inline void autofs4_del_expiring(struct dentry *dentry) | |||
293 | return; | 336 | return; |
294 | } | 337 | } |
295 | 338 | ||
296 | void autofs4_dentry_release(struct dentry *); | ||
297 | extern void autofs4_kill_sb(struct super_block *); | 339 | extern void autofs4_kill_sb(struct super_block *); |