diff options
author | Tomohiro Kusumi <kusumi.tomohiro@gmail.com> | 2016-10-11 16:53:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-11 18:06:31 -0400 |
commit | fcc24534b0d63556357889ac4fe9d8942677d85e (patch) | |
tree | bfbc8a384239b2106eb553177ca3eac2605cf662 | |
parent | 962ca7cfbdc4d072350c94b2d52894b39f41be4a (diff) |
autofs: refactor ioctl fn vector in iookup_dev_ioctl()
cmd part of this struct is the same as an index of itself within
_ioctls[]. In fact this cmd is unused, so we can drop this part.
Link: http://lkml.kernel.org/r/20160831033414.9910.66697.stgit@pluto.themaw.net
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/autofs4/dev-ioctl.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index e89d6bbf268d..fc09eb77ddf3 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -597,42 +597,25 @@ out: | |||
597 | 597 | ||
598 | static ioctl_fn lookup_dev_ioctl(unsigned int cmd) | 598 | static ioctl_fn lookup_dev_ioctl(unsigned int cmd) |
599 | { | 599 | { |
600 | static struct { | 600 | static ioctl_fn _ioctls[] = { |
601 | int cmd; | 601 | autofs_dev_ioctl_version, |
602 | ioctl_fn fn; | 602 | autofs_dev_ioctl_protover, |
603 | } _ioctls[] = { | 603 | autofs_dev_ioctl_protosubver, |
604 | {cmd_idx(AUTOFS_DEV_IOCTL_VERSION_CMD), | 604 | autofs_dev_ioctl_openmount, |
605 | autofs_dev_ioctl_version}, | 605 | autofs_dev_ioctl_closemount, |
606 | {cmd_idx(AUTOFS_DEV_IOCTL_PROTOVER_CMD), | 606 | autofs_dev_ioctl_ready, |
607 | autofs_dev_ioctl_protover}, | 607 | autofs_dev_ioctl_fail, |
608 | {cmd_idx(AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD), | 608 | autofs_dev_ioctl_setpipefd, |
609 | autofs_dev_ioctl_protosubver}, | 609 | autofs_dev_ioctl_catatonic, |
610 | {cmd_idx(AUTOFS_DEV_IOCTL_OPENMOUNT_CMD), | 610 | autofs_dev_ioctl_timeout, |
611 | autofs_dev_ioctl_openmount}, | 611 | autofs_dev_ioctl_requester, |
612 | {cmd_idx(AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD), | 612 | autofs_dev_ioctl_expire, |
613 | autofs_dev_ioctl_closemount}, | 613 | autofs_dev_ioctl_askumount, |
614 | {cmd_idx(AUTOFS_DEV_IOCTL_READY_CMD), | 614 | autofs_dev_ioctl_ismountpoint, |
615 | autofs_dev_ioctl_ready}, | ||
616 | {cmd_idx(AUTOFS_DEV_IOCTL_FAIL_CMD), | ||
617 | autofs_dev_ioctl_fail}, | ||
618 | {cmd_idx(AUTOFS_DEV_IOCTL_SETPIPEFD_CMD), | ||
619 | autofs_dev_ioctl_setpipefd}, | ||
620 | {cmd_idx(AUTOFS_DEV_IOCTL_CATATONIC_CMD), | ||
621 | autofs_dev_ioctl_catatonic}, | ||
622 | {cmd_idx(AUTOFS_DEV_IOCTL_TIMEOUT_CMD), | ||
623 | autofs_dev_ioctl_timeout}, | ||
624 | {cmd_idx(AUTOFS_DEV_IOCTL_REQUESTER_CMD), | ||
625 | autofs_dev_ioctl_requester}, | ||
626 | {cmd_idx(AUTOFS_DEV_IOCTL_EXPIRE_CMD), | ||
627 | autofs_dev_ioctl_expire}, | ||
628 | {cmd_idx(AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD), | ||
629 | autofs_dev_ioctl_askumount}, | ||
630 | {cmd_idx(AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD), | ||
631 | autofs_dev_ioctl_ismountpoint} | ||
632 | }; | 615 | }; |
633 | unsigned int idx = cmd_idx(cmd); | 616 | unsigned int idx = cmd_idx(cmd); |
634 | 617 | ||
635 | return (idx >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[idx].fn; | 618 | return (idx >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[idx]; |
636 | } | 619 | } |
637 | 620 | ||
638 | /* ioctl dispatcher */ | 621 | /* ioctl dispatcher */ |