summaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
authorIan Kent <raven@themaw.net>2018-06-07 20:11:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-07 20:34:39 -0400
commit47206e012a0ad05f358342c083cc6021160b61f9 (patch)
tree300cc5c210e2d9d7401088d5196d6b5fc2e3961e /fs/autofs4/root.c
parentef8b42f78e883cb72fd781c2eff3a42d89c1c0c3 (diff)
autofs4: use autofs instead of autofs4 everywhere
Update naming within autofs source to be consistent by changing occurrences of autofs4 to autofs. Link: http://lkml.kernel.org/r/152626703688.28589.8315406711135226803.stgit@pluto.themaw.net Signed-off-by: Ian Kent <raven@themaw.net> Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c271
1 files changed, 135 insertions, 136 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index b12e37f27530..a4b36e44f73c 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -19,62 +19,62 @@
19 19
20#include "autofs_i.h" 20#include "autofs_i.h"
21 21
22static int autofs4_dir_symlink(struct inode *, struct dentry *, const char *); 22static int autofs_dir_symlink(struct inode *, struct dentry *, const char *);
23static int autofs4_dir_unlink(struct inode *, struct dentry *); 23static int autofs_dir_unlink(struct inode *, struct dentry *);
24static int autofs4_dir_rmdir(struct inode *, struct dentry *); 24static int autofs_dir_rmdir(struct inode *, struct dentry *);
25static int autofs4_dir_mkdir(struct inode *, struct dentry *, umode_t); 25static int autofs_dir_mkdir(struct inode *, struct dentry *, umode_t);
26static long autofs4_root_ioctl(struct file *, unsigned int, unsigned long); 26static long autofs_root_ioctl(struct file *, unsigned int, unsigned long);
27#ifdef CONFIG_COMPAT 27#ifdef CONFIG_COMPAT
28static long autofs4_root_compat_ioctl(struct file *, 28static long autofs_root_compat_ioctl(struct file *,
29 unsigned int, unsigned long); 29 unsigned int, unsigned long);
30#endif 30#endif
31static int autofs4_dir_open(struct inode *inode, struct file *file); 31static int autofs_dir_open(struct inode *inode, struct file *file);
32static struct dentry *autofs4_lookup(struct inode *, 32static struct dentry *autofs_lookup(struct inode *,
33 struct dentry *, unsigned int); 33 struct dentry *, unsigned int);
34static struct vfsmount *autofs4_d_automount(struct path *); 34static struct vfsmount *autofs_d_automount(struct path *);
35static int autofs4_d_manage(const struct path *, bool); 35static int autofs_d_manage(const struct path *, bool);
36static void autofs4_dentry_release(struct dentry *); 36static void autofs_dentry_release(struct dentry *);
37 37
38const struct file_operations autofs4_root_operations = { 38const struct file_operations autofs_root_operations = {
39 .open = dcache_dir_open, 39 .open = dcache_dir_open,
40 .release = dcache_dir_close, 40 .release = dcache_dir_close,
41 .read = generic_read_dir, 41 .read = generic_read_dir,
42 .iterate_shared = dcache_readdir, 42 .iterate_shared = dcache_readdir,
43 .llseek = dcache_dir_lseek, 43 .llseek = dcache_dir_lseek,
44 .unlocked_ioctl = autofs4_root_ioctl, 44 .unlocked_ioctl = autofs_root_ioctl,
45#ifdef CONFIG_COMPAT 45#ifdef CONFIG_COMPAT
46 .compat_ioctl = autofs4_root_compat_ioctl, 46 .compat_ioctl = autofs_root_compat_ioctl,
47#endif 47#endif
48}; 48};
49 49
50const struct file_operations autofs4_dir_operations = { 50const struct file_operations autofs_dir_operations = {
51 .open = autofs4_dir_open, 51 .open = autofs_dir_open,
52 .release = dcache_dir_close, 52 .release = dcache_dir_close,
53 .read = generic_read_dir, 53 .read = generic_read_dir,
54 .iterate_shared = dcache_readdir, 54 .iterate_shared = dcache_readdir,
55 .llseek = dcache_dir_lseek, 55 .llseek = dcache_dir_lseek,
56}; 56};
57 57
58const struct inode_operations autofs4_dir_inode_operations = { 58const struct inode_operations autofs_dir_inode_operations = {
59 .lookup = autofs4_lookup, 59 .lookup = autofs_lookup,
60 .unlink = autofs4_dir_unlink, 60 .unlink = autofs_dir_unlink,
61 .symlink = autofs4_dir_symlink, 61 .symlink = autofs_dir_symlink,
62 .mkdir = autofs4_dir_mkdir, 62 .mkdir = autofs_dir_mkdir,
63 .rmdir = autofs4_dir_rmdir, 63 .rmdir = autofs_dir_rmdir,
64}; 64};
65 65
66const struct dentry_operations autofs4_dentry_operations = { 66const struct dentry_operations autofs_dentry_operations = {
67 .d_automount = autofs4_d_automount, 67 .d_automount = autofs_d_automount,
68 .d_manage = autofs4_d_manage, 68 .d_manage = autofs_d_manage,
69 .d_release = autofs4_dentry_release, 69 .d_release = autofs_dentry_release,
70}; 70};
71 71
72static void autofs4_add_active(struct dentry *dentry) 72static void autofs_add_active(struct dentry *dentry)
73{ 73{
74 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 74 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
75 struct autofs_info *ino; 75 struct autofs_info *ino;
76 76
77 ino = autofs4_dentry_ino(dentry); 77 ino = autofs_dentry_ino(dentry);
78 if (ino) { 78 if (ino) {
79 spin_lock(&sbi->lookup_lock); 79 spin_lock(&sbi->lookup_lock);
80 if (!ino->active_count) { 80 if (!ino->active_count) {
@@ -86,12 +86,12 @@ static void autofs4_add_active(struct dentry *dentry)
86 } 86 }
87} 87}
88 88
89static void autofs4_del_active(struct dentry *dentry) 89static void autofs_del_active(struct dentry *dentry)
90{ 90{
91 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 91 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
92 struct autofs_info *ino; 92 struct autofs_info *ino;
93 93
94 ino = autofs4_dentry_ino(dentry); 94 ino = autofs_dentry_ino(dentry);
95 if (ino) { 95 if (ino) {
96 spin_lock(&sbi->lookup_lock); 96 spin_lock(&sbi->lookup_lock);
97 ino->active_count--; 97 ino->active_count--;
@@ -103,14 +103,14 @@ static void autofs4_del_active(struct dentry *dentry)
103 } 103 }
104} 104}
105 105
106static int autofs4_dir_open(struct inode *inode, struct file *file) 106static int autofs_dir_open(struct inode *inode, struct file *file)
107{ 107{
108 struct dentry *dentry = file->f_path.dentry; 108 struct dentry *dentry = file->f_path.dentry;
109 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 109 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
110 110
111 pr_debug("file=%p dentry=%p %pd\n", file, dentry, dentry); 111 pr_debug("file=%p dentry=%p %pd\n", file, dentry, dentry);
112 112
113 if (autofs4_oz_mode(sbi)) 113 if (autofs_oz_mode(sbi))
114 goto out; 114 goto out;
115 115
116 /* 116 /*
@@ -133,10 +133,10 @@ out:
133 return dcache_dir_open(inode, file); 133 return dcache_dir_open(inode, file);
134} 134}
135 135
136static void autofs4_dentry_release(struct dentry *de) 136static void autofs_dentry_release(struct dentry *de)
137{ 137{
138 struct autofs_info *ino = autofs4_dentry_ino(de); 138 struct autofs_info *ino = autofs_dentry_ino(de);
139 struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb); 139 struct autofs_sb_info *sbi = autofs_sbi(de->d_sb);
140 140
141 pr_debug("releasing %p\n", de); 141 pr_debug("releasing %p\n", de);
142 142
@@ -152,12 +152,12 @@ static void autofs4_dentry_release(struct dentry *de)
152 spin_unlock(&sbi->lookup_lock); 152 spin_unlock(&sbi->lookup_lock);
153 } 153 }
154 154
155 autofs4_free_ino(ino); 155 autofs_free_ino(ino);
156} 156}
157 157
158static struct dentry *autofs4_lookup_active(struct dentry *dentry) 158static struct dentry *autofs_lookup_active(struct dentry *dentry)
159{ 159{
160 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 160 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
161 struct dentry *parent = dentry->d_parent; 161 struct dentry *parent = dentry->d_parent;
162 const struct qstr *name = &dentry->d_name; 162 const struct qstr *name = &dentry->d_name;
163 unsigned int len = name->len; 163 unsigned int len = name->len;
@@ -209,10 +209,10 @@ next:
209 return NULL; 209 return NULL;
210} 210}
211 211
212static struct dentry *autofs4_lookup_expiring(struct dentry *dentry, 212static struct dentry *autofs_lookup_expiring(struct dentry *dentry,
213 bool rcu_walk) 213 bool rcu_walk)
214{ 214{
215 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 215 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
216 struct dentry *parent = dentry->d_parent; 216 struct dentry *parent = dentry->d_parent;
217 const struct qstr *name = &dentry->d_name; 217 const struct qstr *name = &dentry->d_name;
218 unsigned int len = name->len; 218 unsigned int len = name->len;
@@ -269,17 +269,17 @@ next:
269 return NULL; 269 return NULL;
270} 270}
271 271
272static int autofs4_mount_wait(const struct path *path, bool rcu_walk) 272static int autofs_mount_wait(const struct path *path, bool rcu_walk)
273{ 273{
274 struct autofs_sb_info *sbi = autofs4_sbi(path->dentry->d_sb); 274 struct autofs_sb_info *sbi = autofs_sbi(path->dentry->d_sb);
275 struct autofs_info *ino = autofs4_dentry_ino(path->dentry); 275 struct autofs_info *ino = autofs_dentry_ino(path->dentry);
276 int status = 0; 276 int status = 0;
277 277
278 if (ino->flags & AUTOFS_INF_PENDING) { 278 if (ino->flags & AUTOFS_INF_PENDING) {
279 if (rcu_walk) 279 if (rcu_walk)
280 return -ECHILD; 280 return -ECHILD;
281 pr_debug("waiting for mount name=%pd\n", path->dentry); 281 pr_debug("waiting for mount name=%pd\n", path->dentry);
282 status = autofs4_wait(sbi, path, NFY_MOUNT); 282 status = autofs_wait(sbi, path, NFY_MOUNT);
283 pr_debug("mount wait done status=%d\n", status); 283 pr_debug("mount wait done status=%d\n", status);
284 } 284 }
285 ino->last_used = jiffies; 285 ino->last_used = jiffies;
@@ -291,11 +291,11 @@ static int do_expire_wait(const struct path *path, bool rcu_walk)
291 struct dentry *dentry = path->dentry; 291 struct dentry *dentry = path->dentry;
292 struct dentry *expiring; 292 struct dentry *expiring;
293 293
294 expiring = autofs4_lookup_expiring(dentry, rcu_walk); 294 expiring = autofs_lookup_expiring(dentry, rcu_walk);
295 if (IS_ERR(expiring)) 295 if (IS_ERR(expiring))
296 return PTR_ERR(expiring); 296 return PTR_ERR(expiring);
297 if (!expiring) 297 if (!expiring)
298 return autofs4_expire_wait(path, rcu_walk); 298 return autofs_expire_wait(path, rcu_walk);
299 else { 299 else {
300 const struct path this = { .mnt = path->mnt, .dentry = expiring }; 300 const struct path this = { .mnt = path->mnt, .dentry = expiring };
301 /* 301 /*
@@ -303,17 +303,17 @@ static int do_expire_wait(const struct path *path, bool rcu_walk)
303 * be quite complete, but the directory has been removed 303 * be quite complete, but the directory has been removed
304 * so it must have been successful, just wait for it. 304 * so it must have been successful, just wait for it.
305 */ 305 */
306 autofs4_expire_wait(&this, 0); 306 autofs_expire_wait(&this, 0);
307 autofs4_del_expiring(expiring); 307 autofs_del_expiring(expiring);
308 dput(expiring); 308 dput(expiring);
309 } 309 }
310 return 0; 310 return 0;
311} 311}
312 312
313static struct dentry *autofs4_mountpoint_changed(struct path *path) 313static struct dentry *autofs_mountpoint_changed(struct path *path)
314{ 314{
315 struct dentry *dentry = path->dentry; 315 struct dentry *dentry = path->dentry;
316 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 316 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
317 317
318 /* 318 /*
319 * If this is an indirect mount the dentry could have gone away 319 * If this is an indirect mount the dentry could have gone away
@@ -327,7 +327,7 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
327 new = d_lookup(parent, &dentry->d_name); 327 new = d_lookup(parent, &dentry->d_name);
328 if (!new) 328 if (!new)
329 return NULL; 329 return NULL;
330 ino = autofs4_dentry_ino(new); 330 ino = autofs_dentry_ino(new);
331 ino->last_used = jiffies; 331 ino->last_used = jiffies;
332 dput(path->dentry); 332 dput(path->dentry);
333 path->dentry = new; 333 path->dentry = new;
@@ -335,17 +335,17 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path)
335 return path->dentry; 335 return path->dentry;
336} 336}
337 337
338static struct vfsmount *autofs4_d_automount(struct path *path) 338static struct vfsmount *autofs_d_automount(struct path *path)
339{ 339{
340 struct dentry *dentry = path->dentry; 340 struct dentry *dentry = path->dentry;
341 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 341 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
342 struct autofs_info *ino = autofs4_dentry_ino(dentry); 342 struct autofs_info *ino = autofs_dentry_ino(dentry);
343 int status; 343 int status;
344 344
345 pr_debug("dentry=%p %pd\n", dentry, dentry); 345 pr_debug("dentry=%p %pd\n", dentry, dentry);
346 346
347 /* The daemon never triggers a mount. */ 347 /* The daemon never triggers a mount. */
348 if (autofs4_oz_mode(sbi)) 348 if (autofs_oz_mode(sbi))
349 return NULL; 349 return NULL;
350 350
351 /* 351 /*
@@ -364,7 +364,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
364 spin_lock(&sbi->fs_lock); 364 spin_lock(&sbi->fs_lock);
365 if (ino->flags & AUTOFS_INF_PENDING) { 365 if (ino->flags & AUTOFS_INF_PENDING) {
366 spin_unlock(&sbi->fs_lock); 366 spin_unlock(&sbi->fs_lock);
367 status = autofs4_mount_wait(path, 0); 367 status = autofs_mount_wait(path, 0);
368 if (status) 368 if (status)
369 return ERR_PTR(status); 369 return ERR_PTR(status);
370 goto done; 370 goto done;
@@ -405,7 +405,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
405 } 405 }
406 ino->flags |= AUTOFS_INF_PENDING; 406 ino->flags |= AUTOFS_INF_PENDING;
407 spin_unlock(&sbi->fs_lock); 407 spin_unlock(&sbi->fs_lock);
408 status = autofs4_mount_wait(path, 0); 408 status = autofs_mount_wait(path, 0);
409 spin_lock(&sbi->fs_lock); 409 spin_lock(&sbi->fs_lock);
410 ino->flags &= ~AUTOFS_INF_PENDING; 410 ino->flags &= ~AUTOFS_INF_PENDING;
411 if (status) { 411 if (status) {
@@ -416,24 +416,24 @@ static struct vfsmount *autofs4_d_automount(struct path *path)
416 spin_unlock(&sbi->fs_lock); 416 spin_unlock(&sbi->fs_lock);
417done: 417done:
418 /* Mount succeeded, check if we ended up with a new dentry */ 418 /* Mount succeeded, check if we ended up with a new dentry */
419 dentry = autofs4_mountpoint_changed(path); 419 dentry = autofs_mountpoint_changed(path);
420 if (!dentry) 420 if (!dentry)
421 return ERR_PTR(-ENOENT); 421 return ERR_PTR(-ENOENT);
422 422
423 return NULL; 423 return NULL;
424} 424}
425 425
426static int autofs4_d_manage(const struct path *path, bool rcu_walk) 426static int autofs_d_manage(const struct path *path, bool rcu_walk)
427{ 427{
428 struct dentry *dentry = path->dentry; 428 struct dentry *dentry = path->dentry;
429 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 429 struct autofs_sb_info *sbi = autofs_sbi(dentry->d_sb);
430 struct autofs_info *ino = autofs4_dentry_ino(dentry); 430 struct autofs_info *ino = autofs_dentry_ino(dentry);
431 int status; 431 int status;
432 432
433 pr_debug("dentry=%p %pd\n", dentry, dentry); 433 pr_debug("dentry=%p %pd\n", dentry, dentry);
434 434
435 /* The daemon never waits. */ 435 /* The daemon never waits. */
436 if (autofs4_oz_mode(sbi)) { 436 if (autofs_oz_mode(sbi)) {
437 if (!path_is_mountpoint(path)) 437 if (!path_is_mountpoint(path))
438 return -EISDIR; 438 return -EISDIR;
439 return 0; 439 return 0;
@@ -447,7 +447,7 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk)
447 * This dentry may be under construction so wait on mount 447 * This dentry may be under construction so wait on mount
448 * completion. 448 * completion.
449 */ 449 */
450 status = autofs4_mount_wait(path, rcu_walk); 450 status = autofs_mount_wait(path, rcu_walk);
451 if (status) 451 if (status)
452 return status; 452 return status;
453 453
@@ -500,8 +500,8 @@ static int autofs4_d_manage(const struct path *path, bool rcu_walk)
500} 500}
501 501
502/* Lookups in the root directory */ 502/* Lookups in the root directory */
503static struct dentry *autofs4_lookup(struct inode *dir, 503static struct dentry *autofs_lookup(struct inode *dir,
504 struct dentry *dentry, unsigned int flags) 504 struct dentry *dentry, unsigned int flags)
505{ 505{
506 struct autofs_sb_info *sbi; 506 struct autofs_sb_info *sbi;
507 struct autofs_info *ino; 507 struct autofs_info *ino;
@@ -513,13 +513,13 @@ static struct dentry *autofs4_lookup(struct inode *dir,
513 if (dentry->d_name.len > NAME_MAX) 513 if (dentry->d_name.len > NAME_MAX)
514 return ERR_PTR(-ENAMETOOLONG); 514 return ERR_PTR(-ENAMETOOLONG);
515 515
516 sbi = autofs4_sbi(dir->i_sb); 516 sbi = autofs_sbi(dir->i_sb);
517 517
518 pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n", 518 pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
519 current->pid, task_pgrp_nr(current), sbi->catatonic, 519 current->pid, task_pgrp_nr(current), sbi->catatonic,
520 autofs4_oz_mode(sbi)); 520 autofs_oz_mode(sbi));
521 521
522 active = autofs4_lookup_active(dentry); 522 active = autofs_lookup_active(dentry);
523 if (active) 523 if (active)
524 return active; 524 return active;
525 else { 525 else {
@@ -529,7 +529,7 @@ static struct dentry *autofs4_lookup(struct inode *dir,
529 * can return fail immediately. The daemon however does need 529 * can return fail immediately. The daemon however does need
530 * to create directories within the file system. 530 * to create directories within the file system.
531 */ 531 */
532 if (!autofs4_oz_mode(sbi) && !IS_ROOT(dentry->d_parent)) 532 if (!autofs_oz_mode(sbi) && !IS_ROOT(dentry->d_parent))
533 return ERR_PTR(-ENOENT); 533 return ERR_PTR(-ENOENT);
534 534
535 /* Mark entries in the root as mount triggers */ 535 /* Mark entries in the root as mount triggers */
@@ -537,24 +537,24 @@ static struct dentry *autofs4_lookup(struct inode *dir,
537 autofs_type_indirect(sbi->type)) 537 autofs_type_indirect(sbi->type))
538 __managed_dentry_set_managed(dentry); 538 __managed_dentry_set_managed(dentry);
539 539
540 ino = autofs4_new_ino(sbi); 540 ino = autofs_new_ino(sbi);
541 if (!ino) 541 if (!ino)
542 return ERR_PTR(-ENOMEM); 542 return ERR_PTR(-ENOMEM);
543 543
544 dentry->d_fsdata = ino; 544 dentry->d_fsdata = ino;
545 ino->dentry = dentry; 545 ino->dentry = dentry;
546 546
547 autofs4_add_active(dentry); 547 autofs_add_active(dentry);
548 } 548 }
549 return NULL; 549 return NULL;
550} 550}
551 551
552static int autofs4_dir_symlink(struct inode *dir, 552static int autofs_dir_symlink(struct inode *dir,
553 struct dentry *dentry, 553 struct dentry *dentry,
554 const char *symname) 554 const char *symname)
555{ 555{
556 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 556 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
557 struct autofs_info *ino = autofs4_dentry_ino(dentry); 557 struct autofs_info *ino = autofs_dentry_ino(dentry);
558 struct autofs_info *p_ino; 558 struct autofs_info *p_ino;
559 struct inode *inode; 559 struct inode *inode;
560 size_t size = strlen(symname); 560 size_t size = strlen(symname);
@@ -562,14 +562,14 @@ static int autofs4_dir_symlink(struct inode *dir,
562 562
563 pr_debug("%s <- %pd\n", symname, dentry); 563 pr_debug("%s <- %pd\n", symname, dentry);
564 564
565 if (!autofs4_oz_mode(sbi)) 565 if (!autofs_oz_mode(sbi))
566 return -EACCES; 566 return -EACCES;
567 567
568 BUG_ON(!ino); 568 BUG_ON(!ino);
569 569
570 autofs4_clean_ino(ino); 570 autofs_clean_ino(ino);
571 571
572 autofs4_del_active(dentry); 572 autofs_del_active(dentry);
573 573
574 cp = kmalloc(size + 1, GFP_KERNEL); 574 cp = kmalloc(size + 1, GFP_KERNEL);
575 if (!cp) 575 if (!cp)
@@ -577,7 +577,7 @@ static int autofs4_dir_symlink(struct inode *dir,
577 577
578 strcpy(cp, symname); 578 strcpy(cp, symname);
579 579
580 inode = autofs4_get_inode(dir->i_sb, S_IFLNK | 0555); 580 inode = autofs_get_inode(dir->i_sb, S_IFLNK | 0555);
581 if (!inode) { 581 if (!inode) {
582 kfree(cp); 582 kfree(cp);
583 return -ENOMEM; 583 return -ENOMEM;
@@ -588,7 +588,7 @@ static int autofs4_dir_symlink(struct inode *dir,
588 588
589 dget(dentry); 589 dget(dentry);
590 atomic_inc(&ino->count); 590 atomic_inc(&ino->count);
591 p_ino = autofs4_dentry_ino(dentry->d_parent); 591 p_ino = autofs_dentry_ino(dentry->d_parent);
592 if (p_ino && !IS_ROOT(dentry)) 592 if (p_ino && !IS_ROOT(dentry))
593 atomic_inc(&p_ino->count); 593 atomic_inc(&p_ino->count);
594 594
@@ -610,20 +610,20 @@ static int autofs4_dir_symlink(struct inode *dir,
610 * If a process is blocked on the dentry waiting for the expire to finish, 610 * If a process is blocked on the dentry waiting for the expire to finish,
611 * it will invalidate the dentry and try to mount with a new one. 611 * it will invalidate the dentry and try to mount with a new one.
612 * 612 *
613 * Also see autofs4_dir_rmdir().. 613 * Also see autofs_dir_rmdir()..
614 */ 614 */
615static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) 615static int autofs_dir_unlink(struct inode *dir, struct dentry *dentry)
616{ 616{
617 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 617 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
618 struct autofs_info *ino = autofs4_dentry_ino(dentry); 618 struct autofs_info *ino = autofs_dentry_ino(dentry);
619 struct autofs_info *p_ino; 619 struct autofs_info *p_ino;
620 620
621 /* This allows root to remove symlinks */ 621 /* This allows root to remove symlinks */
622 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) 622 if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
623 return -EPERM; 623 return -EPERM;
624 624
625 if (atomic_dec_and_test(&ino->count)) { 625 if (atomic_dec_and_test(&ino->count)) {
626 p_ino = autofs4_dentry_ino(dentry->d_parent); 626 p_ino = autofs_dentry_ino(dentry->d_parent);
627 if (p_ino && !IS_ROOT(dentry)) 627 if (p_ino && !IS_ROOT(dentry))
628 atomic_dec(&p_ino->count); 628 atomic_dec(&p_ino->count);
629 } 629 }
@@ -635,7 +635,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
635 dir->i_mtime = current_time(dir); 635 dir->i_mtime = current_time(dir);
636 636
637 spin_lock(&sbi->lookup_lock); 637 spin_lock(&sbi->lookup_lock);
638 __autofs4_add_expiring(dentry); 638 __autofs_add_expiring(dentry);
639 d_drop(dentry); 639 d_drop(dentry);
640 spin_unlock(&sbi->lookup_lock); 640 spin_unlock(&sbi->lookup_lock);
641 641
@@ -692,15 +692,15 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry)
692 managed_dentry_set_managed(parent); 692 managed_dentry_set_managed(parent);
693} 693}
694 694
695static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) 695static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
696{ 696{
697 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 697 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
698 struct autofs_info *ino = autofs4_dentry_ino(dentry); 698 struct autofs_info *ino = autofs_dentry_ino(dentry);
699 struct autofs_info *p_ino; 699 struct autofs_info *p_ino;
700 700
701 pr_debug("dentry %p, removing %pd\n", dentry, dentry); 701 pr_debug("dentry %p, removing %pd\n", dentry, dentry);
702 702
703 if (!autofs4_oz_mode(sbi)) 703 if (!autofs_oz_mode(sbi))
704 return -EACCES; 704 return -EACCES;
705 705
706 spin_lock(&sbi->lookup_lock); 706 spin_lock(&sbi->lookup_lock);
@@ -708,7 +708,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
708 spin_unlock(&sbi->lookup_lock); 708 spin_unlock(&sbi->lookup_lock);
709 return -ENOTEMPTY; 709 return -ENOTEMPTY;
710 } 710 }
711 __autofs4_add_expiring(dentry); 711 __autofs_add_expiring(dentry);
712 d_drop(dentry); 712 d_drop(dentry);
713 spin_unlock(&sbi->lookup_lock); 713 spin_unlock(&sbi->lookup_lock);
714 714
@@ -716,7 +716,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
716 autofs_clear_leaf_automount_flags(dentry); 716 autofs_clear_leaf_automount_flags(dentry);
717 717
718 if (atomic_dec_and_test(&ino->count)) { 718 if (atomic_dec_and_test(&ino->count)) {
719 p_ino = autofs4_dentry_ino(dentry->d_parent); 719 p_ino = autofs_dentry_ino(dentry->d_parent);
720 if (p_ino && dentry->d_parent != dentry) 720 if (p_ino && dentry->d_parent != dentry)
721 atomic_dec(&p_ino->count); 721 atomic_dec(&p_ino->count);
722 } 722 }
@@ -730,26 +730,26 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
730 return 0; 730 return 0;
731} 731}
732 732
733static int autofs4_dir_mkdir(struct inode *dir, 733static int autofs_dir_mkdir(struct inode *dir,
734 struct dentry *dentry, umode_t mode) 734 struct dentry *dentry, umode_t mode)
735{ 735{
736 struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); 736 struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
737 struct autofs_info *ino = autofs4_dentry_ino(dentry); 737 struct autofs_info *ino = autofs_dentry_ino(dentry);
738 struct autofs_info *p_ino; 738 struct autofs_info *p_ino;
739 struct inode *inode; 739 struct inode *inode;
740 740
741 if (!autofs4_oz_mode(sbi)) 741 if (!autofs_oz_mode(sbi))
742 return -EACCES; 742 return -EACCES;
743 743
744 pr_debug("dentry %p, creating %pd\n", dentry, dentry); 744 pr_debug("dentry %p, creating %pd\n", dentry, dentry);
745 745
746 BUG_ON(!ino); 746 BUG_ON(!ino);
747 747
748 autofs4_clean_ino(ino); 748 autofs_clean_ino(ino);
749 749
750 autofs4_del_active(dentry); 750 autofs_del_active(dentry);
751 751
752 inode = autofs4_get_inode(dir->i_sb, S_IFDIR | mode); 752 inode = autofs_get_inode(dir->i_sb, S_IFDIR | mode);
753 if (!inode) 753 if (!inode)
754 return -ENOMEM; 754 return -ENOMEM;
755 d_add(dentry, inode); 755 d_add(dentry, inode);
@@ -759,7 +759,7 @@ static int autofs4_dir_mkdir(struct inode *dir,
759 759
760 dget(dentry); 760 dget(dentry);
761 atomic_inc(&ino->count); 761 atomic_inc(&ino->count);
762 p_ino = autofs4_dentry_ino(dentry->d_parent); 762 p_ino = autofs_dentry_ino(dentry->d_parent);
763 if (p_ino && !IS_ROOT(dentry)) 763 if (p_ino && !IS_ROOT(dentry))
764 atomic_inc(&p_ino->count); 764 atomic_inc(&p_ino->count);
765 inc_nlink(dir); 765 inc_nlink(dir);
@@ -770,7 +770,7 @@ static int autofs4_dir_mkdir(struct inode *dir,
770 770
771/* Get/set timeout ioctl() operation */ 771/* Get/set timeout ioctl() operation */
772#ifdef CONFIG_COMPAT 772#ifdef CONFIG_COMPAT
773static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, 773static inline int autofs_compat_get_set_timeout(struct autofs_sb_info *sbi,
774 compat_ulong_t __user *p) 774 compat_ulong_t __user *p)
775{ 775{
776 unsigned long ntimeout; 776 unsigned long ntimeout;
@@ -795,7 +795,7 @@ error:
795} 795}
796#endif 796#endif
797 797
798static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, 798static inline int autofs_get_set_timeout(struct autofs_sb_info *sbi,
799 unsigned long __user *p) 799 unsigned long __user *p)
800{ 800{
801 unsigned long ntimeout; 801 unsigned long ntimeout;
@@ -820,14 +820,14 @@ error:
820} 820}
821 821
822/* Return protocol version */ 822/* Return protocol version */
823static inline int autofs4_get_protover(struct autofs_sb_info *sbi, 823static inline int autofs_get_protover(struct autofs_sb_info *sbi,
824 int __user *p) 824 int __user *p)
825{ 825{
826 return put_user(sbi->version, p); 826 return put_user(sbi->version, p);
827} 827}
828 828
829/* Return protocol sub version */ 829/* Return protocol sub version */
830static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, 830static inline int autofs_get_protosubver(struct autofs_sb_info *sbi,
831 int __user *p) 831 int __user *p)
832{ 832{
833 return put_user(sbi->sub_version, p); 833 return put_user(sbi->sub_version, p);
@@ -836,7 +836,7 @@ static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi,
836/* 836/*
837* Tells the daemon whether it can umount the autofs mount. 837* Tells the daemon whether it can umount the autofs mount.
838*/ 838*/
839static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) 839static inline int autofs_ask_umount(struct vfsmount *mnt, int __user *p)
840{ 840{
841 int status = 0; 841 int status = 0;
842 842
@@ -850,14 +850,14 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
850 return status; 850 return status;
851} 851}
852 852
853/* Identify autofs4_dentries - this is so we can tell if there's 853/* Identify autofs_dentries - this is so we can tell if there's
854 * an extra dentry refcount or not. We only hold a refcount on the 854 * an extra dentry refcount or not. We only hold a refcount on the
855 * dentry if its non-negative (ie, d_inode != NULL) 855 * dentry if its non-negative (ie, d_inode != NULL)
856 */ 856 */
857int is_autofs4_dentry(struct dentry *dentry) 857int is_autofs_dentry(struct dentry *dentry)
858{ 858{
859 return dentry && d_really_is_positive(dentry) && 859 return dentry && d_really_is_positive(dentry) &&
860 dentry->d_op == &autofs4_dentry_operations && 860 dentry->d_op == &autofs_dentry_operations &&
861 dentry->d_fsdata != NULL; 861 dentry->d_fsdata != NULL;
862} 862}
863 863
@@ -865,10 +865,10 @@ int is_autofs4_dentry(struct dentry *dentry)
865 * ioctl()'s on the root directory is the chief method for the daemon to 865 * ioctl()'s on the root directory is the chief method for the daemon to
866 * generate kernel reactions 866 * generate kernel reactions
867 */ 867 */
868static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, 868static int autofs_root_ioctl_unlocked(struct inode *inode, struct file *filp,
869 unsigned int cmd, unsigned long arg) 869 unsigned int cmd, unsigned long arg)
870{ 870{
871 struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb); 871 struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb);
872 void __user *p = (void __user *)arg; 872 void __user *p = (void __user *)arg;
873 873
874 pr_debug("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n", 874 pr_debug("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",
@@ -878,64 +878,63 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
878 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) 878 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
879 return -ENOTTY; 879 return -ENOTTY;
880 880
881 if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) 881 if (!autofs_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
882 return -EPERM; 882 return -EPERM;
883 883
884 switch (cmd) { 884 switch (cmd) {
885 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */ 885 case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */
886 return autofs4_wait_release(sbi, (autofs_wqt_t) arg, 0); 886 return autofs_wait_release(sbi, (autofs_wqt_t) arg, 0);
887 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */ 887 case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */
888 return autofs4_wait_release(sbi, (autofs_wqt_t) arg, -ENOENT); 888 return autofs_wait_release(sbi, (autofs_wqt_t) arg, -ENOENT);
889 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */ 889 case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */
890 autofs4_catatonic_mode(sbi); 890 autofs_catatonic_mode(sbi);
891 return 0; 891 return 0;
892 case AUTOFS_IOC_PROTOVER: /* Get protocol version */ 892 case AUTOFS_IOC_PROTOVER: /* Get protocol version */
893 return autofs4_get_protover(sbi, p); 893 return autofs_get_protover(sbi, p);
894 case AUTOFS_IOC_PROTOSUBVER: /* Get protocol sub version */ 894 case AUTOFS_IOC_PROTOSUBVER: /* Get protocol sub version */
895 return autofs4_get_protosubver(sbi, p); 895 return autofs_get_protosubver(sbi, p);
896 case AUTOFS_IOC_SETTIMEOUT: 896 case AUTOFS_IOC_SETTIMEOUT:
897 return autofs4_get_set_timeout(sbi, p); 897 return autofs_get_set_timeout(sbi, p);
898#ifdef CONFIG_COMPAT 898#ifdef CONFIG_COMPAT
899 case AUTOFS_IOC_SETTIMEOUT32: 899 case AUTOFS_IOC_SETTIMEOUT32:
900 return autofs4_compat_get_set_timeout(sbi, p); 900 return autofs_compat_get_set_timeout(sbi, p);
901#endif 901#endif
902 902
903 case AUTOFS_IOC_ASKUMOUNT: 903 case AUTOFS_IOC_ASKUMOUNT:
904 return autofs4_ask_umount(filp->f_path.mnt, p); 904 return autofs_ask_umount(filp->f_path.mnt, p);
905 905
906 /* return a single thing to expire */ 906 /* return a single thing to expire */
907 case AUTOFS_IOC_EXPIRE: 907 case AUTOFS_IOC_EXPIRE:
908 return autofs4_expire_run(inode->i_sb, 908 return autofs_expire_run(inode->i_sb, filp->f_path.mnt, sbi, p);
909 filp->f_path.mnt, sbi, p);
910 /* same as above, but can send multiple expires through pipe */ 909 /* same as above, but can send multiple expires through pipe */
911 case AUTOFS_IOC_EXPIRE_MULTI: 910 case AUTOFS_IOC_EXPIRE_MULTI:
912 return autofs4_expire_multi(inode->i_sb, 911 return autofs_expire_multi(inode->i_sb,
913 filp->f_path.mnt, sbi, p); 912 filp->f_path.mnt, sbi, p);
914 913
915 default: 914 default:
916 return -EINVAL; 915 return -EINVAL;
917 } 916 }
918} 917}
919 918
920static long autofs4_root_ioctl(struct file *filp, 919static long autofs_root_ioctl(struct file *filp,
921 unsigned int cmd, unsigned long arg) 920 unsigned int cmd, unsigned long arg)
922{ 921{
923 struct inode *inode = file_inode(filp); 922 struct inode *inode = file_inode(filp);
924 923
925 return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 924 return autofs_root_ioctl_unlocked(inode, filp, cmd, arg);
926} 925}
927 926
928#ifdef CONFIG_COMPAT 927#ifdef CONFIG_COMPAT
929static long autofs4_root_compat_ioctl(struct file *filp, 928static long autofs_root_compat_ioctl(struct file *filp,
930 unsigned int cmd, unsigned long arg) 929 unsigned int cmd, unsigned long arg)
931{ 930{
932 struct inode *inode = file_inode(filp); 931 struct inode *inode = file_inode(filp);
933 int ret; 932 int ret;
934 933
935 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) 934 if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
936 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); 935 ret = autofs_root_ioctl_unlocked(inode, filp, cmd, arg);
937 else 936 else
938 ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, 937 ret = autofs_root_ioctl_unlocked(inode, filp, cmd,
939 (unsigned long) compat_ptr(arg)); 938 (unsigned long) compat_ptr(arg));
940 939
941 return ret; 940 return ret;