diff options
author | Ian Kent <raven@themaw.net> | 2011-01-14 13:46:19 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-15 20:07:41 -0500 |
commit | 71e469db242c2eeb00faf9caf7d9e00150c00a6e (patch) | |
tree | 8fdb7f6900edca6f2973f9ae64331895112f017e /fs/autofs4/root.c | |
parent | e61da20a50d21725ff27571a6dff9468e4fb7146 (diff) |
autofs4: Clean up dentry operations
There are now two distinct dentry operations uses. One for dentrys
that trigger mounts and one for dentrys that do not.
Rationalize the use of these dentry operations and rename them to
reflect their function.
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r-- | fs/autofs4/root.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 52af410a831d..62c1229a4d31 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -35,6 +35,8 @@ static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); | |||
35 | #endif | 35 | #endif |
36 | static int autofs4_dir_open(struct inode *inode, struct file *file); | 36 | static int autofs4_dir_open(struct inode *inode, struct file *file); |
37 | static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); | 37 | static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); |
38 | static struct vfsmount *autofs4_d_automount(struct path *); | ||
39 | static int autofs4_d_manage(struct dentry *, bool); | ||
38 | 40 | ||
39 | const struct file_operations autofs4_root_operations = { | 41 | const struct file_operations autofs4_root_operations = { |
40 | .open = dcache_dir_open, | 42 | .open = dcache_dir_open, |
@@ -64,6 +66,18 @@ const struct inode_operations autofs4_dir_inode_operations = { | |||
64 | .rmdir = autofs4_dir_rmdir, | 66 | .rmdir = autofs4_dir_rmdir, |
65 | }; | 67 | }; |
66 | 68 | ||
69 | /* For dentries that don't initiate mounting */ | ||
70 | const struct dentry_operations autofs4_dentry_operations = { | ||
71 | .d_release = autofs4_dentry_release, | ||
72 | }; | ||
73 | |||
74 | /* For dentries that do initiate mounting */ | ||
75 | const struct dentry_operations autofs4_mount_dentry_operations = { | ||
76 | .d_automount = autofs4_d_automount, | ||
77 | .d_manage = autofs4_d_manage, | ||
78 | .d_release = autofs4_dentry_release, | ||
79 | }; | ||
80 | |||
67 | static void autofs4_add_active(struct dentry *dentry) | 81 | static void autofs4_add_active(struct dentry *dentry) |
68 | { | 82 | { |
69 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 83 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
@@ -158,18 +172,6 @@ void autofs4_dentry_release(struct dentry *de) | |||
158 | } | 172 | } |
159 | } | 173 | } |
160 | 174 | ||
161 | /* For dentries of directories in the root dir */ | ||
162 | static const struct dentry_operations autofs4_root_dentry_operations = { | ||
163 | .d_release = autofs4_dentry_release, | ||
164 | }; | ||
165 | |||
166 | /* For other dentries */ | ||
167 | static const struct dentry_operations autofs4_dentry_operations = { | ||
168 | .d_automount = autofs4_d_automount, | ||
169 | .d_manage = autofs4_d_manage, | ||
170 | .d_release = autofs4_dentry_release, | ||
171 | }; | ||
172 | |||
173 | static struct dentry *autofs4_lookup_active(struct dentry *dentry) | 175 | static struct dentry *autofs4_lookup_active(struct dentry *dentry) |
174 | { | 176 | { |
175 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 177 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
@@ -337,7 +339,7 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path) | |||
337 | return path->dentry; | 339 | return path->dentry; |
338 | } | 340 | } |
339 | 341 | ||
340 | struct vfsmount *autofs4_d_automount(struct path *path) | 342 | static struct vfsmount *autofs4_d_automount(struct path *path) |
341 | { | 343 | { |
342 | struct dentry *dentry = path->dentry; | 344 | struct dentry *dentry = path->dentry; |
343 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 345 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
@@ -501,7 +503,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
501 | if (active) { | 503 | if (active) { |
502 | return active; | 504 | return active; |
503 | } else { | 505 | } else { |
504 | d_set_d_op(dentry, &autofs4_root_dentry_operations); | 506 | d_set_d_op(dentry, &autofs4_dentry_operations); |
505 | 507 | ||
506 | /* | 508 | /* |
507 | * A dentry that is not within the root can never trigger a | 509 | * A dentry that is not within the root can never trigger a |
@@ -514,7 +516,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s | |||
514 | 516 | ||
515 | /* Mark entries in the root as mount triggers */ | 517 | /* Mark entries in the root as mount triggers */ |
516 | if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) { | 518 | if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) { |
517 | d_set_d_op(dentry, &autofs4_dentry_operations); | 519 | d_set_d_op(dentry, &autofs4_mount_dentry_operations); |
518 | __managed_dentry_set_managed(dentry); | 520 | __managed_dentry_set_managed(dentry); |
519 | } | 521 | } |
520 | 522 | ||
@@ -573,6 +575,8 @@ static int autofs4_dir_symlink(struct inode *dir, | |||
573 | } | 575 | } |
574 | d_add(dentry, inode); | 576 | d_add(dentry, inode); |
575 | 577 | ||
578 | d_set_d_op(dentry, &autofs4_dentry_operations); | ||
579 | |||
576 | dentry->d_fsdata = ino; | 580 | dentry->d_fsdata = ino; |
577 | ino->dentry = dget(dentry); | 581 | ino->dentry = dget(dentry); |
578 | atomic_inc(&ino->count); | 582 | atomic_inc(&ino->count); |
@@ -791,7 +795,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) | |||
791 | int is_autofs4_dentry(struct dentry *dentry) | 795 | int is_autofs4_dentry(struct dentry *dentry) |
792 | { | 796 | { |
793 | return dentry && dentry->d_inode && | 797 | return dentry && dentry->d_inode && |
794 | (dentry->d_op == &autofs4_root_dentry_operations || | 798 | (dentry->d_op == &autofs4_mount_dentry_operations || |
795 | dentry->d_op == &autofs4_dentry_operations) && | 799 | dentry->d_op == &autofs4_dentry_operations) && |
796 | dentry->d_fsdata != NULL; | 800 | dentry->d_fsdata != NULL; |
797 | } | 801 | } |