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
,
147 struct dentry
, d_u
.d_child
);
149 if (!d_unhashed(de
) && de
->d_inode
) {
150 spin_unlock(&dcache_lock
);
151 if (filldir(dirent
, de
->d_name
.name
, de
->d_name
.len
, filp
->f_pos
, de
->d_inode
->i_ino
, DT_UNKNOWN
) < 0)
153 spin_lock(&dcache_lock
);
157 if (list
!= &dentry
->d_subdirs
)
159 spin_unlock(&dcache_lock
);
167 static int autofs4_dir_open(struct inode
*inode
, struct file
*file
)
169 struct dentry
*dentry
= file
->f_dentry
;
170 struct vfsmount
*mnt
= file
->f_vfsmnt
;
171 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
174 DPRINTK("file=%p dentry=%p %.*s",
175 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
177 if (autofs4_oz_mode(sbi
))
180 if (autofs4_ispending(dentry
)) {
181 DPRINTK("dentry busy");
185 if (!d_mountpoint(dentry
) && dentry
->d_op
&& dentry
->d_op
->d_revalidate
) {
189 /* In case there are stale directory dentrys from a failed mount */
190 spin_lock(&dcache_lock
);
191 empty
= list_empty(&dentry
->d_subdirs
);
192 spin_unlock(&dcache_lock
);
195 d_invalidate(dentry
);
197 nd
.flags
= LOOKUP_DIRECTORY
;
198 status
= (dentry
->d_op
->d_revalidate
)(dentry
, &nd
);
204 if (d_mountpoint(dentry
)) {
205 struct file
*fp
= NULL
;
206 struct vfsmount
*fp_mnt
= mntget(mnt
);
207 struct dentry
*fp_dentry
= dget(dentry
);
209 if (!autofs4_follow_mount(&fp_mnt
, &fp_dentry
)) {
215 fp
= dentry_open(fp_dentry
, fp_mnt
, file
->f_flags
);
216 status
= PTR_ERR(fp
);
218 file
->private_data
= NULL
;
221 file
->private_data
= fp
;
227 static int autofs4_dir_close(struct inode
*inode
, struct file
*file
)
229 struct dentry
*dentry
= file
->f_dentry
;
230 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
232 DPRINTK("file=%p dentry=%p %.*s",
233 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
235 if (autofs4_oz_mode(sbi
))
238 if (autofs4_ispending(dentry
)) {
239 DPRINTK("dentry busy");
243 if (d_mountpoint(dentry
)) {
244 struct file
*fp
= file
->private_data
;
249 filp_close(fp
, current
->files
);
250 file
->private_data
= NULL
;
256 static int autofs4_dir_readdir(struct file
*file
, void *dirent
, filldir_t filldir
)
258 struct dentry
*dentry
= file
->f_dentry
;
259 struct autofs_sb_info
*sbi
= autofs4_sbi(dentry
->d_sb
);
262 DPRINTK("file=%p dentry=%p %.*s",
263 file
, dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
265 if (autofs4_oz_mode(sbi
))
268 if (autofs4_ispending(dentry
)) {
269 DPRINTK("dentry busy");
273 if (d_mountpoint(dentry
)) {
274 struct file
*fp
= file
->private_data
;
279 if (!fp
->f_op
|| !fp
->f_op
->readdir
)
282 status
= vfs_readdir(fp
, filldir
, dirent
);
283 file
->f_pos
= fp
->f_pos
;
285 autofs4_copy_atime(file
, fp
);
289 return autofs4_dcache_readdir(file
, dirent
, filldir
);
292 static int try_to_fill_dentry(struct dentry
*dentry
,
293 struct super_block
*sb
,
294 struct autofs_sb_info
*sbi
, int flags
)
296 struct autofs_info
*de_info
= autofs4_dentry_ino(dentry
);
299 /* Block on any pending expiry here; invalidate the dentry
300 when expiration is done to trigger mount request with a new
302 if (de_info
&& (de_info
->flags
& AUTOFS_INF_EXPIRING
)) {
303 DPRINTK("waiting for expire %p name=%.*s",
304 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
306 status
= autofs4_wait(sbi
, dentry
, NFY_NONE
);
308 DPRINTK("expire done status=%d", status
);
311 * If the directory still exists the mount request must
312 * continue otherwise it can't be followed at the right
313 * time during the walk.
315 status
= d_invalidate(dentry
);
316 if (status
!= -EBUSY
)
320 DPRINTK("dentry=%p %.*s ino=%p",
321 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
, dentry
->d_inode
);
323 /* Wait for a pending mount, triggering one if there isn't one already */
324 if (dentry
->d_inode
== NULL
) {
325 DPRINTK("waiting for mount name=%.*s",
326 dentry
->d_name
.len
, dentry
->d_name
.name
);
328 status
= autofs4_wait(sbi
, dentry
, NFY_MOUNT
);
330 DPRINTK("mount done status=%d", status
);
332 if (status
&& dentry
->d_inode
)
333 return 0; /* Try to get the kernel to invalidate this dentry */
335 /* Turn this into a real negative dentry? */
336 if (status
== -ENOENT
) {
337 dentry
->d_time
= jiffies
+ AUTOFS_NEGATIVE_TIMEOUT
;
338 spin_lock(&dentry
->d_lock
);
339 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
340 spin_unlock(&dentry
->d_lock
);
343 /* Return a negative dentry, but leave it "pending" */
346 /* Trigger mount for path component or follow link */
347 } else if (flags
& (LOOKUP_CONTINUE
| LOOKUP_DIRECTORY
) ||
348 current
->link_count
) {
349 DPRINTK("waiting for mount name=%.*s",
350 dentry
->d_name
.len
, dentry
->d_name
.name
);
352 spin_lock(&dentry
->d_lock
);
353 dentry
->d_flags
|= DCACHE_AUTOFS_PENDING
;
354 spin_unlock(&dentry
->d_lock
);
355 status
= autofs4_wait(sbi
, dentry
, NFY_MOUNT
);
357 DPRINTK("mount done status=%d", status
);
360 spin_lock(&dentry
->d_lock
);
361 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
362 spin_unlock(&dentry
->d_lock
);
367 /* We don't update the usages for the autofs daemon itself, this
368 is necessary for recursive autofs mounts */
369 if (!autofs4_oz_mode(sbi
))
370 autofs4_update_usage(dentry
);
372 spin_lock(&dentry
->d_lock
);
373 dentry
->d_flags
&= ~DCACHE_AUTOFS_PENDING
;
374 spin_unlock(&dentry
->d_lock
);
379 * Revalidate is called on every cache lookup. Some of those
380 * cache lookups may actually happen while the dentry is not
381 * yet completely filled in, and revalidate has to delay such
384 static int autofs4_revalidate(struct dentry
* dentry
, struct nameidata
*nd
)
386 struct inode
* dir
= dentry
->d_parent
->d_inode
;
387 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
388 int oz_mode
= autofs4_oz_mode(sbi
);
389 int flags
= nd
? nd
->flags
: 0;
393 if (autofs4_ispending(dentry
)) {
395 status
= try_to_fill_dentry(dentry
, dir
->i_sb
, sbi
, flags
);
399 /* Negative dentry.. invalidate if "old" */
400 if (dentry
->d_inode
== NULL
)
401 return (dentry
->d_time
- jiffies
<= AUTOFS_NEGATIVE_TIMEOUT
);
403 /* Check for a non-mountpoint directory with no contents */
404 spin_lock(&dcache_lock
);
405 if (S_ISDIR(dentry
->d_inode
->i_mode
) &&
406 !d_mountpoint(dentry
) &&
407 list_empty(&dentry
->d_subdirs
)) {
408 DPRINTK("dentry=%p %.*s, emptydir",
409 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
410 spin_unlock(&dcache_lock
);
412 status
= try_to_fill_dentry(dentry
, dir
->i_sb
, sbi
, flags
);
415 spin_unlock(&dcache_lock
);
417 /* Update the usage list */
419 autofs4_update_usage(dentry
);
424 static void autofs4_dentry_release(struct dentry
*de
)
426 struct autofs_info
*inf
;
428 DPRINTK("releasing %p", de
);
430 inf
= autofs4_dentry_ino(de
);
437 autofs4_free_ino(inf
);
441 /* For dentries of directories in the root dir */
442 static struct dentry_operations autofs4_root_dentry_operations
= {
443 .d_revalidate
= autofs4_revalidate
,
444 .d_release
= autofs4_dentry_release
,
447 /* For other dentries */
448 static struct dentry_operations autofs4_dentry_operations
= {
449 .d_revalidate
= autofs4_revalidate
,
450 .d_release
= autofs4_dentry_release
,
453 /* Lookups in the root directory */
454 static struct dentry
*autofs4_lookup(struct inode
*dir
, struct dentry
*dentry
, struct nameidata
*nd
)
456 struct autofs_sb_info
*sbi
;
459 DPRINTK("name = %.*s",
460 dentry
->d_name
.len
, dentry
->d_name
.name
);
462 if (dentry
->d_name
.len
> NAME_MAX
)
463 return ERR_PTR(-ENAMETOOLONG
);/* File name too long to exist */
465 sbi
= autofs4_sbi(dir
->i_sb
);
467 oz_mode
= autofs4_oz_mode(sbi
);
468 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
469 current
->pid
, process_group(current
), sbi
->catatonic
, oz_mode
);
472 * Mark the dentry incomplete, but add it. This is needed so
473 * that the VFS layer knows about the dentry, and we can count
474 * on catching any lookups through the revalidate.
476 * Let all the hard work be done by the revalidate function that
477 * needs to be able to do this anyway..
479 * We need to do this before we release the directory semaphore.
481 dentry
->d_op
= &autofs4_root_dentry_operations
;
484 spin_lock(&dentry
->d_lock
);
485 dentry
->d_flags
|= DCACHE_AUTOFS_PENDING
;
486 spin_unlock(&dentry
->d_lock
);
488 dentry
->d_fsdata
= NULL
;
491 if (dentry
->d_op
&& dentry
->d_op
->d_revalidate
) {
493 (dentry
->d_op
->d_revalidate
)(dentry
, nd
);
498 * If we are still pending, check if we had to handle
499 * a signal. If so we can force a restart..
501 if (dentry
->d_flags
& DCACHE_AUTOFS_PENDING
) {
502 /* See if we were interrupted */
503 if (signal_pending(current
)) {
504 sigset_t
*sigset
= ¤t
->pending
.signal
;
505 if (sigismember (sigset
, SIGKILL
) ||
506 sigismember (sigset
, SIGQUIT
) ||
507 sigismember (sigset
, SIGINT
)) {
508 return ERR_PTR(-ERESTARTNOINTR
);
514 * If this dentry is unhashed, then we shouldn't honour this
515 * lookup even if the dentry is positive. Returning ENOENT here
516 * doesn't do the right thing for all system calls, but it should
517 * be OK for the operations we permit from an autofs.
519 if ( dentry
->d_inode
&& d_unhashed(dentry
) )
520 return ERR_PTR(-ENOENT
);
525 static int autofs4_dir_symlink(struct inode
*dir
,
526 struct dentry
*dentry
,
529 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
530 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
534 DPRINTK("%s <- %.*s", symname
,
535 dentry
->d_name
.len
, dentry
->d_name
.name
);
537 if (!autofs4_oz_mode(sbi
))
540 ino
= autofs4_init_ino(ino
, sbi
, S_IFLNK
| 0555);
544 ino
->size
= strlen(symname
);
545 ino
->u
.symlink
= cp
= kmalloc(ino
->size
+ 1, GFP_KERNEL
);
554 inode
= autofs4_get_inode(dir
->i_sb
, ino
);
555 d_instantiate(dentry
, inode
);
557 if (dir
== dir
->i_sb
->s_root
->d_inode
)
558 dentry
->d_op
= &autofs4_root_dentry_operations
;
560 dentry
->d_op
= &autofs4_dentry_operations
;
562 dentry
->d_fsdata
= ino
;
563 ino
->dentry
= dget(dentry
);
566 dir
->i_mtime
= CURRENT_TIME
;
574 * Normal filesystems would do a "d_delete()" to tell the VFS dcache
575 * that the file no longer exists. However, doing that means that the
576 * VFS layer can turn the dentry into a negative dentry. We don't want
577 * this, because since the unlink is probably the result of an expire.
578 * We simply d_drop it, which allows the dentry lookup to remount it
581 * If a process is blocked on the dentry waiting for the expire to finish,
582 * it will invalidate the dentry and try to mount with a new one.
584 * Also see autofs4_dir_rmdir()..
586 static int autofs4_dir_unlink(struct inode
*dir
, struct dentry
*dentry
)
588 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
589 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
591 /* This allows root to remove symlinks */
592 if ( !autofs4_oz_mode(sbi
) && !capable(CAP_SYS_ADMIN
) )
597 dentry
->d_inode
->i_size
= 0;
598 dentry
->d_inode
->i_nlink
= 0;
600 dir
->i_mtime
= CURRENT_TIME
;
607 static int autofs4_dir_rmdir(struct inode
*dir
, struct dentry
*dentry
)
609 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
610 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
612 if (!autofs4_oz_mode(sbi
))
615 spin_lock(&dcache_lock
);
616 if (!list_empty(&dentry
->d_subdirs
)) {
617 spin_unlock(&dcache_lock
);
620 spin_lock(&dentry
->d_lock
);
622 spin_unlock(&dentry
->d_lock
);
623 spin_unlock(&dcache_lock
);
627 dentry
->d_inode
->i_size
= 0;
628 dentry
->d_inode
->i_nlink
= 0;
636 static int autofs4_dir_mkdir(struct inode
*dir
, struct dentry
*dentry
, int mode
)
638 struct autofs_sb_info
*sbi
= autofs4_sbi(dir
->i_sb
);
639 struct autofs_info
*ino
= autofs4_dentry_ino(dentry
);
642 if ( !autofs4_oz_mode(sbi
) )
645 DPRINTK("dentry %p, creating %.*s",
646 dentry
, dentry
->d_name
.len
, dentry
->d_name
.name
);
648 ino
= autofs4_init_ino(ino
, sbi
, S_IFDIR
| 0555);
652 inode
= autofs4_get_inode(dir
->i_sb
, ino
);
653 d_instantiate(dentry
, inode
);
655 if (dir
== dir
->i_sb
->s_root
->d_inode
)
656 dentry
->d_op
= &autofs4_root_dentry_operations
;
658 dentry
->d_op
= &autofs4_dentry_operations
;
660 dentry
->d_fsdata
= ino
;
661 ino
->dentry
= dget(dentry
);
664 dir
->i_mtime
= CURRENT_TIME
;
669 /* Get/set timeout ioctl() operation */
670 static inline int autofs4_get_set_timeout(struct autofs_sb_info
*sbi
,
671 unsigned long __user
*p
)
674 unsigned long ntimeout
;
676 if ( (rv
= get_user(ntimeout
, p
)) ||
677 (rv
= put_user(sbi
->exp_timeout
/HZ
, p
)) )
680 if ( ntimeout
> ULONG_MAX
/HZ
)
681 sbi
->exp_timeout
= 0;
683 sbi
->exp_timeout
= ntimeout
* HZ
;
688 /* Return protocol version */
689 static inline int autofs4_get_protover(struct autofs_sb_info
*sbi
, int __user
*p
)
691 return put_user(sbi
->version
, p
);
694 /* Return protocol sub version */
695 static inline int autofs4_get_protosubver(struct autofs_sb_info
*sbi
, int __user
*p
)
697 return put_user(sbi
->sub_version
, p
);
701 * Tells the daemon whether we need to reghost or not. Also, clears
702 * the reghost_needed flag.
704 static inline int autofs4_ask_reghost(struct autofs_sb_info
*sbi
, int __user
*p
)
708 DPRINTK("returning %d", sbi
->needs_reghost
);
710 status
= put_user(sbi
->needs_reghost
, p
);
714 sbi
->needs_reghost
= 0;
719 * Enable / Disable reghosting ioctl() operation
721 static inline int autofs4_toggle_reghost(struct autofs_sb_info
*sbi
, int __user
*p
)
726 status
= get_user(val
, p
);
728 DPRINTK("reghost = %d", val
);
733 /* turn on/off reghosting, with the val */
734 sbi
->reghost_enabled
= val
;
739 * Tells the daemon whether it can umount the autofs mount.
741 static inline int autofs4_ask_umount(struct vfsmount
*mnt
, int __user
*p
)
745 if (may_umount(mnt
) == 0)
748 DPRINTK("returning %d", status
);
750 status
= put_user(status
, p
);
755 /* Identify autofs4_dentries - this is so we can tell if there's
756 an extra dentry refcount or not. We only hold a refcount on the
757 dentry if its non-negative (ie, d_inode != NULL)
759 int is_autofs4_dentry(struct dentry
*dentry
)
761 return dentry
&& dentry
->d_inode
&&
762 (dentry
->d_op
== &autofs4_root_dentry_operations
||
763 dentry
->d_op
== &autofs4_dentry_operations
) &&
764 dentry
->d_fsdata
!= NULL
;
768 * ioctl()'s on the root directory is the chief method for the daemon to
769 * generate kernel reactions
771 static int autofs4_root_ioctl(struct inode
*inode
, struct file
*filp
,
772 unsigned int cmd
, unsigned long arg
)
774 struct autofs_sb_info
*sbi
= autofs4_sbi(inode
->i_sb
);
775 void __user
*p
= (void __user
*)arg
;
777 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
778 cmd
,arg
,sbi
,process_group(current
));
780 if ( _IOC_TYPE(cmd
) != _IOC_TYPE(AUTOFS_IOC_FIRST
) ||
781 _IOC_NR(cmd
) - _IOC_NR(AUTOFS_IOC_FIRST
) >= AUTOFS_IOC_COUNT
)
784 if ( !autofs4_oz_mode(sbi
) && !capable(CAP_SYS_ADMIN
) )
788 case AUTOFS_IOC_READY
: /* Wait queue: go ahead and retry */
789 return autofs4_wait_release(sbi
,(autofs_wqt_t
)arg
,0);
790 case AUTOFS_IOC_FAIL
: /* Wait queue: fail with ENOENT */
791 return autofs4_wait_release(sbi
,(autofs_wqt_t
)arg
,-ENOENT
);
792 case AUTOFS_IOC_CATATONIC
: /* Enter catatonic mode (daemon shutdown) */
793 autofs4_catatonic_mode(sbi
);
795 case AUTOFS_IOC_PROTOVER
: /* Get protocol version */
796 return autofs4_get_protover(sbi
, p
);
797 case AUTOFS_IOC_PROTOSUBVER
: /* Get protocol sub version */
798 return autofs4_get_protosubver(sbi
, p
);
799 case AUTOFS_IOC_SETTIMEOUT
:
800 return autofs4_get_set_timeout(sbi
, p
);
802 case AUTOFS_IOC_TOGGLEREGHOST
:
803 return autofs4_toggle_reghost(sbi
, p
);
804 case AUTOFS_IOC_ASKREGHOST
:
805 return autofs4_ask_reghost(sbi
, p
);
807 case AUTOFS_IOC_ASKUMOUNT
:
808 return autofs4_ask_umount(filp
->f_vfsmnt
, p
);
810 /* return a single thing to expire */
811 case AUTOFS_IOC_EXPIRE
:
812 return autofs4_expire_run(inode
->i_sb
,filp
->f_vfsmnt
,sbi
, p
);
813 /* same as above, but can send multiple expires through pipe */
814 case AUTOFS_IOC_EXPIRE_MULTI
:
815 return autofs4_expire_multi(inode
->i_sb
,filp
->f_vfsmnt
,sbi
, p
);