1 /* -*- c -*- --------------------------------------------------------------- *
3 * linux/fs/autofs/root.c
5 * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
6 * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
7 * Copyright 2001-2003 Ian Kent <raven@themaw.net>
9 * This file is part of the Linux kernel and is made available under
10 * the terms of the GNU General Public License, version 2, or at your
11 * option, any later version, incorporated herein by reference.
13 * ------------------------------------------------------------------------- */
15 #include <linux/errno.h>
16 #include <linux/stat.h>
17 #include <linux/param.h>
18 #include <linux/time.h>
19 #include <linux/smp_lock.h>
22 static int autofs4_dir_symlink(struct inode
*,struct dentry
*,const char *);
23 static int autofs4_dir_unlink(struct inode
*,struct dentry
*);
24 static int autofs4_dir_rmdir(struct inode
*,struct dentry
*);
25 static int autofs4_dir_mkdir(struct inode
*,struct dentry
*,int);
26 static int autofs4_root_ioctl(struct inode
*, struct file
*,unsigned int,unsigned long);
27 static int autofs4_dir_open(struct inode
*inode
, struct file
*file
);
28 static int autofs4_dir_close(struct inode
*inode
, struct file
*file
);
29 static int autofs4_dir_readdir(struct file
* filp
, void * dirent
, filldir_t filldir
);
30 static int autofs4_root_readdir(struct file
* filp
, void * dirent
, filldir_t filldir
);
31 static struct dentry
*autofs4_lookup(struct inode
*,struct dentry
*, struct nameidata
*);
32 static int autofs4_dcache_readdir(struct file
*, void *, filldir_t
);
34 struct file_operations autofs4_root_operations
= {
35 .open
= dcache_dir_open
,
36 .release
= dcache_dir_close
,
37 .read
= generic_read_dir
,
38 .readdir
= autofs4_root_readdir
,
39 .ioctl
= autofs4_root_ioctl
,
42 struct file_operations autofs4_dir_operations
= {
43 .open
= autofs4_dir_open
,
44 .release
= autofs4_dir_close
,
45 .read
= generic_read_dir
,
46 .readdir
= autofs4_dir_readdir
,
49 struct inode_operations autofs4_root_inode_operations
= {
50 .lookup
= autofs4_lookup
,
51 .unlink
= autofs4_dir_unlink
,
52 .symlink
= autofs4_dir_symlink
,
53 .mkdir
= autofs4_dir_mkdir
,
54 .rmdir
= autofs4_dir_rmdir
,
57 struct inode_operations autofs4_dir_inode_operations
= {
58 .lookup
= autofs4_lookup
,
59 .unlink
= autofs4_dir_unlink
,
60 .symlink
= autofs4_dir_symlink
,
61 .mkdir
= autofs4_dir_mkdir
,
62 .rmdir
= autofs4_dir_rmdir
,
65 static int autofs4_root_readdir(struct file
*file
, void *dirent
,
68 struct autofs_sb_info
*sbi
= autofs4_sbi(file
->f_dentry
->d_sb
);
69 int oz_mode
= autofs4_oz_mode(sbi
);
71 DPRINTK("called, filp->f_pos = %lld", file
->f_pos
);
74 * Don't set reghost flag if:
75 * 1) f_pos is larger than zero -- we've already been here.
76 * 2) we haven't even enabled reghosting in the 1st place.
77 * 3) this is the daemon doing a readdir
79 if (oz_mode
&& file
->f_pos
== 0 && sbi
->reghost_enabled
)
80 sbi
->needs_reghost
= 1;
82 DPRINTK("needs_reghost = %d", sbi
->needs_reghost
);
84 return autofs4_dcache_readdir(file
, dirent
, filldir
);
87 /* Update usage from here to top of tree, so that scan of
88 top-level directories will give a useful result */
89 static void autofs4_update_usage(struct dentry
*dentry
)
91 struct dentry
*top
= dentry
->d_sb
->s_root
;
93 spin_lock(&dcache_lock
);
94 for(; dentry
!= top
; dentry
= dentry
->d_parent
) {
95 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
98 update_atime(dentry
->d_inode
);
99 ino
->last_used
= jiffies
;
102 spin_unlock(&dcache_lock
);
106 * From 2.4 kernel readdir.c
108 static int autofs4_dcache_readdir(struct file
* filp
, void * dirent
, filldir_t filldir
)
111 struct dentry
*dentry
= filp
->f_dentry
;
116 if (filldir(dirent
, ".", 1, i
, dentry
->d_inode
->i_ino
, DT_DIR
) < 0)
122 if (filldir(dirent
, "..", 2, i
, dentry
->d_parent
->d_inode
->i_ino
, DT_DIR
) < 0)
128 struct list_head
*list
;
131 spin_lock(&dcache_lock
);
132 list
= dentry
->d_subdirs
.next
;
135 if (list
== &dentry
->d_subdirs
) {
136 spin_unlock(&dcache_lock
);
146 struct dentry
*de
= list_entry(list
, struct dentry
, d_child
);
148 if (!d_unhashed(de
) && de
->d_inode
) {
149 spin_unlock(&dcache_lock
);
150 if (filldir(dirent
, de
->d_name
.name
, de
->d_name
.len
, filp
->f_pos
, de
->d_inode
->i_ino
, DT_UNKNOWN
) < 0)
152 spin_lock(&dcache_lock
);
156 if (list
!= &dentry
->d_subdirs
)
158 spin_unlock(&dcache_lock
);
166 static int autofs4_dir_open(struct inode
*inode
, struct file
*file
)
168 struct dentry
*dentry
= file
->f_dentry
;
169 struct vfsmount
*mnt
= file
->f_vfsmnt
;
170 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
173 DPRINTK("file=%p dentry=%p %.*s",
174 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
176 if (autofs4_oz_mode(sbi
))
179 if (autofs4_ispending(dentry
)) {
180 DPRINTK("dentry busy");
184 if (!d_mountpoint(dentry
) && dentry
->d_op
&& dentry
->d_op
->d_revalidate
) {
188 /* In case there are stale directory dentrys from a failed mount */
189 spin_lock(&dcache_lock
);
190 empty
= list_empty(&dentry
->d_subdirs
);
191 spin_unlock(&dcache_lock
);
194 d_invalidate(dentry
);
196 nd
.flags
= LOOKUP_DIRECTORY
;
197 status
= (dentry
->d_op
->d_revalidate
)(dentry
, &nd
);
203 if (d_mountpoint(dentry
)) {
204 struct file
*fp
= NULL
;
205 struct vfsmount
*fp_mnt
= mntget(mnt
);
206 struct dentry
*fp_dentry
= dget(dentry
);
208 while (follow_down(&fp_mnt
, &fp_dentry
) && d_mountpoint(fp_dentry
));
210 fp
= dentry_open(fp_dentry
, fp_mnt
, file
->f_flags
);
211 status
= PTR_ERR(fp
);
213 file
->private_data
= NULL
;
216 file
->private_data
= fp
;
222 static int autofs4_dir_close(struct inode
*inode
, struct file
*file
)
224 struct dentry
*dentry
= file
->f_dentry
;
225 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
227 DPRINTK("file=%p dentry=%p %.*s",
228 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
230 if (autofs4_oz_mode(sbi
))
233 if (autofs4_ispending(dentry
)) {
234 DPRINTK("dentry busy");
238 if (d_mountpoint(dentry
)) {
239 struct file
*fp
= file
->private_data
;
244 filp_close(fp
, current
->files
);
245 file
->private_data
= NULL
;
251 static int autofs4_dir_readdir(struct file
*file
, void *dirent
, filldir_t filldir
)
253 struct dentry
*dentry
= file
->f_dentry
;
254 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
257 DPRINTK("file=%p dentry=%p %.*s",
258 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
260 if (autofs4_oz_mode(sbi
))
263 if (autofs4_ispending(dentry
)) {
264 DPRINTK("dentry busy");
268 if (d_mountpoint(dentry
)) {
269 struct file
*fp
= file
->private_data
;
274 if (!fp
->f_op
|| !fp
->f_op
->readdir
)
277 status
= vfs_readdir(fp
, filldir
, dirent
);
278 file
->f_pos
= fp
->f_pos
;
280 autofs4_copy_atime(file
, fp
);
284 return autofs4_dcache_readdir(file
, dirent
, filldir
);
287 static int try_to_fill_dentry(struct dentry
*dentry
,
288 struct super_block
*sb
,
289 struct autofs_sb_info
*sbi
, int flags
)
291 struct autofs_info
*de_info
= autofs4_dentry_ino(dentry
);
294 /* Block on any pending expiry here; invalidate the dentry
295 when expiration is done to trigger mount request with a new
297 if (de_info
&& (de_info
->flags
& AUTOFS_INF_EXPIRING
)) {
298 DPRINTK("waiting for expire %p name=%.*s",
299 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
301 status
= autofs4_wait(sbi
, dentry
, NFY_NONE
);
303 DPRINTK("expire done status=%d", status
);
308 DPRINTK("dentry=%p %.*s ino=%p",
309 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
, dentry
->d_inode
);
311 /* Wait for a pending mount, triggering one if there isn't one already */
312 if (dentry
->d_inode
== NULL
) {
313 DPRINTK("waiting for mount name=%.*s",
314 dentry
->d_name
.len
, dentry
->d_name
.name
);
316 status
= autofs4_wait(sbi
, dentry
, NFY_MOUNT
);
318 DPRINTK("mount done status=%d", status
);
320 if (status
&& dentry
->d_inode
)
321 return 0; /* Try to get the kernel to invalidate this dentry */
323 /* Turn this into a real negative dentry? */
324 if (status
== -ENOENT
) {
325 dentry
->d_time
= jiffies
+ AUTOFS_NEGATIVE_TIMEOUT
;
326 spin_lock(&dentry
->d_lock
);
327 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
328 spin_unlock(&dentry
->d_lock
);
331 /* Return a negative dentry, but leave it "pending" */
334 /* Trigger mount for path component or follow link */
335 } else if (flags
& (LOOKUP_CONTINUE
| LOOKUP_DIRECTORY
) ||
336 current
->link_count
) {
337 DPRINTK("waiting for mount name=%.*s",
338 dentry
->d_name
.len
, dentry
->d_name
.name
);
340 spin_lock(&dentry
->d_lock
);
341 dentry
->d_flags
|= DCACHE_AUTOFS_PENDING
;
342 spin_unlock(&dentry
->d_lock
);
343 status
= autofs4_wait(sbi
, dentry
, NFY_MOUNT
);
345 DPRINTK("mount done status=%d", status
);
348 spin_lock(&dentry
->d_lock
);
349 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
350 spin_unlock(&dentry
->d_lock
);
355 /* We don't update the usages for the autofs daemon itself, this
356 is necessary for recursive autofs mounts */
357 if (!autofs4_oz_mode(sbi
))
358 autofs4_update_usage(dentry
);
360 spin_lock(&dentry
->d_lock
);
361 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
362 spin_unlock(&dentry
->d_lock
);
367 * Revalidate is called on every cache lookup. Some of those
368 * cache lookups may actually happen while the dentry is not
369 * yet completely filled in, and revalidate has to delay such
372 static int autofs4_revalidate(struct dentry
* dentry
, struct nameidata
*nd
)
374 struct inode
* dir
= dentry
->d_parent
->d_inode
;
375 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
376 int oz_mode
= autofs4_oz_mode(sbi
);
377 int flags
= nd
? nd
->flags
: 0;
381 if (autofs4_ispending(dentry
)) {
383 status
= try_to_fill_dentry(dentry
, dir
->i_sb
, sbi
, flags
);
387 /* Negative dentry.. invalidate if "old" */
388 if (dentry
->d_inode
== NULL
)
389 return (dentry
->d_time
- jiffies
<= AUTOFS_NEGATIVE_TIMEOUT
);
391 /* Check for a non-mountpoint directory with no contents */
392 spin_lock(&dcache_lock
);
393 if (S_ISDIR(dentry
->d_inode
->i_mode
) &&
394 !d_mountpoint(dentry
) &&
395 list_empty(&dentry
->d_subdirs
)) {
396 DPRINTK("dentry=%p %.*s, emptydir",
397 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
398 spin_unlock(&dcache_lock
);
400 status
= try_to_fill_dentry(dentry
, dir
->i_sb
, sbi
, flags
);
403 spin_unlock(&dcache_lock
);
405 /* Update the usage list */
407 autofs4_update_usage(dentry
);
412 static void autofs4_dentry_release(struct dentry
*de
)
414 struct autofs_info
*inf
;
416 DPRINTK("releasing %p", de
);
418 inf
= autofs4_dentry_ino(de
);
425 autofs4_free_ino(inf
);
429 /* For dentries of directories in the root dir */
430 static struct dentry_operations autofs4_root_dentry_operations
= {
431 .d_revalidate
= autofs4_revalidate
,
432 .d_release
= autofs4_dentry_release
,
435 /* For other dentries */
436 static struct dentry_operations autofs4_dentry_operations
= {
437 .d_revalidate
= autofs4_revalidate
,
438 .d_release
= autofs4_dentry_release
,
441 /* Lookups in the root directory */
442 static struct dentry
*autofs4_lookup(struct inode
*dir
, struct dentry
*dentry
, struct nameidata
*nd
)
444 struct autofs_sb_info
*sbi
;
447 DPRINTK("name = %.*s",
448 dentry
->d_name
.len
, dentry
->d_name
.name
);
450 if (dentry
->d_name
.len
> NAME_MAX
)
451 return ERR_PTR(-ENAMETOOLONG
);/* File name too long to exist */
453 sbi
= autofs4_sbi(dir
->i_sb
);
455 oz_mode
= autofs4_oz_mode(sbi
);
456 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
457 current
->pid
, process_group(current
), sbi
->catatonic
, oz_mode
);
460 * Mark the dentry incomplete, but add it. This is needed so
461 * that the VFS layer knows about the dentry, and we can count
462 * on catching any lookups through the revalidate.
464 * Let all the hard work be done by the revalidate function that
465 * needs to be able to do this anyway..
467 * We need to do this before we release the directory semaphore.
469 dentry
->d_op
= &autofs4_root_dentry_operations
;
472 spin_lock(&dentry
->d_lock
);
473 dentry
->d_flags
|= DCACHE_AUTOFS_PENDING
;
474 spin_unlock(&dentry
->d_lock
);
476 dentry
->d_fsdata
= NULL
;
479 if (dentry
->d_op
&& dentry
->d_op
->d_revalidate
) {
481 (dentry
->d_op
->d_revalidate
)(dentry
, nd
);
486 * If we are still pending, check if we had to handle
487 * a signal. If so we can force a restart..
489 if (dentry
->d_flags
& DCACHE_AUTOFS_PENDING
) {
490 /* See if we were interrupted */
491 if (signal_pending(current
)) {
492 sigset_t
*sigset
= ¤t
->pending
.signal
;
493 if (sigismember (sigset
, SIGKILL
) ||
494 sigismember (sigset
, SIGQUIT
) ||
495 sigismember (sigset
, SIGINT
)) {
496 return ERR_PTR(-ERESTARTNOINTR
);
502 * If this dentry is unhashed, then we shouldn't honour this
503 * lookup even if the dentry is positive. Returning ENOENT here
504 * doesn't do the right thing for all system calls, but it should
505 * be OK for the operations we permit from an autofs.
507 if ( dentry
->d_inode
&& d_unhashed(dentry
) )
508 return ERR_PTR(-ENOENT
);
513 static int autofs4_dir_symlink(struct inode
*dir
,
514 struct dentry
*dentry
,
517 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
518 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
522 DPRINTK("%s <- %.*s", symname
,
523 dentry
->d_name
.len
, dentry
->d_name
.name
);
525 if (!autofs4_oz_mode(sbi
))
528 ino
= autofs4_init_ino(ino
, sbi
, S_IFLNK
| 0555);
532 ino
->size
= strlen(symname
);
533 ino
->u
.symlink
= cp
= kmalloc(ino
->size
+ 1, GFP_KERNEL
);
542 inode
= autofs4_get_inode(dir
->i_sb
, ino
);
543 d_instantiate(dentry
, inode
);
545 if (dir
== dir
->i_sb
->s_root
->d_inode
)
546 dentry
->d_op
= &autofs4_root_dentry_operations
;
548 dentry
->d_op
= &autofs4_dentry_operations
;
550 dentry
->d_fsdata
= ino
;
551 ino
->dentry
= dget(dentry
);
554 dir
->i_mtime
= CURRENT_TIME
;
562 * Normal filesystems would do a "d_delete()" to tell the VFS dcache
563 * that the file no longer exists. However, doing that means that the
564 * VFS layer can turn the dentry into a negative dentry. We don't want
565 * this, because since the unlink is probably the result of an expire.
566 * We simply d_drop it, which allows the dentry lookup to remount it
569 * If a process is blocked on the dentry waiting for the expire to finish,
570 * it will invalidate the dentry and try to mount with a new one.
572 * Also see autofs4_dir_rmdir()..
574 static int autofs4_dir_unlink(struct inode
*dir
, struct dentry
*dentry
)
576 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
577 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
579 /* This allows root to remove symlinks */
580 if ( !autofs4_oz_mode(sbi
) && !capable(CAP_SYS_ADMIN
) )
585 dentry
->d_inode
->i_size
= 0;
586 dentry
->d_inode
->i_nlink
= 0;
588 dir
->i_mtime
= CURRENT_TIME
;
595 static int autofs4_dir_rmdir(struct inode
*dir
, struct dentry
*dentry
)
597 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
598 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
600 if (!autofs4_oz_mode(sbi
))
603 spin_lock(&dcache_lock
);
604 if (!list_empty(&dentry
->d_subdirs
)) {
605 spin_unlock(&dcache_lock
);
608 spin_lock(&dentry
->d_lock
);
610 spin_unlock(&dentry
->d_lock
);
611 spin_unlock(&dcache_lock
);
615 dentry
->d_inode
->i_size
= 0;
616 dentry
->d_inode
->i_nlink
= 0;
624 static int autofs4_dir_mkdir(struct inode
*dir
, struct dentry
*dentry
, int mode
)
626 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
627 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
630 if ( !autofs4_oz_mode(sbi
) )
633 DPRINTK("dentry %p, creating %.*s",
634 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
636 ino
= autofs4_init_ino(ino
, sbi
, S_IFDIR
| 0555);
640 inode
= autofs4_get_inode(dir
->i_sb
, ino
);
641 d_instantiate(dentry
, inode
);
643 if (dir
== dir
->i_sb
->s_root
->d_inode
)
644 dentry
->d_op
= &autofs4_root_dentry_operations
;
646 dentry
->d_op
= &autofs4_dentry_operations
;
648 dentry
->d_fsdata
= ino
;
649 ino
->dentry
= dget(dentry
);
652 dir
->i_mtime
= CURRENT_TIME
;
657 /* Get/set timeout ioctl() operation */
658 static inline int autofs4_get_set_timeout(struct autofs_sb_info
*sbi
,
659 unsigned long __user
*p
)
662 unsigned long ntimeout
;
664 if ( (rv
= get_user(ntimeout
, p
)) ||
665 (rv
= put_user(sbi
->exp_timeout
/HZ
, p
)) )
668 if ( ntimeout
> ULONG_MAX
/HZ
)
669 sbi
->exp_timeout
= 0;
671 sbi
->exp_timeout
= ntimeout
* HZ
;
676 /* Return protocol version */
677 static inline int autofs4_get_protover(struct autofs_sb_info
*sbi
, int __user
*p
)
679 return put_user(sbi
->version
, p
);
682 /* Return protocol sub version */
683 static inline int autofs4_get_protosubver(struct autofs_sb_info
*sbi
, int __user
*p
)
685 return put_user(sbi
->sub_version
, p
);
689 * Tells the daemon whether we need to reghost or not. Also, clears
690 * the reghost_needed flag.
692 static inline int autofs4_ask_reghost(struct autofs_sb_info
*sbi
, int __user
*p
)
696 DPRINTK("returning %d", sbi
->needs_reghost
);
698 status
= put_user(sbi
->needs_reghost
, p
);
702 sbi
->needs_reghost
= 0;
707 * Enable / Disable reghosting ioctl() operation
709 static inline int autofs4_toggle_reghost(struct autofs_sb_info
*sbi
, int __user
*p
)
714 status
= get_user(val
, p
);
716 DPRINTK("reghost = %d", val
);
721 /* turn on/off reghosting, with the val */
722 sbi
->reghost_enabled
= val
;
727 * Tells the daemon whether it can umount the autofs mount.
729 static inline int autofs4_ask_umount(struct vfsmount
*mnt
, int __user
*p
)
733 if (may_umount(mnt
) == 0)
736 DPRINTK("returning %d", status
);
738 status
= put_user(status
, p
);
743 /* Identify autofs4_dentries - this is so we can tell if there's
744 an extra dentry refcount or not. We only hold a refcount on the
745 dentry if its non-negative (ie, d_inode != NULL)
747 int is_autofs4_dentry(struct dentry
*dentry
)
749 return dentry
&& dentry
->d_inode
&&
750 (dentry
->d_op
== &autofs4_root_dentry_operations
||
751 dentry
->d_op
== &autofs4_dentry_operations
) &&
752 dentry
->d_fsdata
!= NULL
;
756 * ioctl()'s on the root directory is the chief method for the daemon to
757 * generate kernel reactions
759 static int autofs4_root_ioctl(struct inode
*inode
, struct file
*filp
,
760 unsigned int cmd
, unsigned long arg
)
762 struct autofs_sb_info
*sbi
= autofs4_sbi(inode
->i_sb
);
763 void __user
*p
= (void __user
*)arg
;
765 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
766 cmd
,arg
,sbi
,process_group(current
));
768 if ( _IOC_TYPE(cmd
) != _IOC_TYPE(AUTOFS_IOC_FIRST
) ||
769 _IOC_NR(cmd
) - _IOC_NR(AUTOFS_IOC_FIRST
) >= AUTOFS_IOC_COUNT
)
772 if ( !autofs4_oz_mode(sbi
) && !capable(CAP_SYS_ADMIN
) )
776 case AUTOFS_IOC_READY
: /* Wait queue: go ahead and retry */
777 return autofs4_wait_release(sbi
,(autofs_wqt_t
)arg
,0);
778 case AUTOFS_IOC_FAIL
: /* Wait queue: fail with ENOENT */
779 return autofs4_wait_release(sbi
,(autofs_wqt_t
)arg
,-ENOENT
);
780 case AUTOFS_IOC_CATATONIC
: /* Enter catatonic mode (daemon shutdown) */
781 autofs4_catatonic_mode(sbi
);
783 case AUTOFS_IOC_PROTOVER
: /* Get protocol version */
784 return autofs4_get_protover(sbi
, p
);
785 case AUTOFS_IOC_PROTOSUBVER
: /* Get protocol sub version */
786 return autofs4_get_protosubver(sbi
, p
);
787 case AUTOFS_IOC_SETTIMEOUT
:
788 return autofs4_get_set_timeout(sbi
, p
);
790 case AUTOFS_IOC_TOGGLEREGHOST
:
791 return autofs4_toggle_reghost(sbi
, p
);
792 case AUTOFS_IOC_ASKREGHOST
:
793 return autofs4_ask_reghost(sbi
, p
);
795 case AUTOFS_IOC_ASKUMOUNT
:
796 return autofs4_ask_umount(filp
->f_vfsmnt
, p
);
798 /* return a single thing to expire */
799 case AUTOFS_IOC_EXPIRE
:
800 return autofs4_expire_run(inode
->i_sb
,filp
->f_vfsmnt
,sbi
, p
);
801 /* same as above, but can send multiple expires through pipe */
802 case AUTOFS_IOC_EXPIRE_MULTI
:
803 return autofs4_expire_multi(inode
->i_sb
,filp
->f_vfsmnt
,sbi
, p
);