Commit fcc24534 authored by aaaaa's avatar aaaaa Committed by Linus Torvalds

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.netSigned-off-by: aaaaa's avatarTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 962ca7cf
...@@ -597,42 +597,25 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp, ...@@ -597,42 +597,25 @@ static int autofs_dev_ioctl_ismountpoint(struct file *fp,
static ioctl_fn lookup_dev_ioctl(unsigned int cmd) static ioctl_fn lookup_dev_ioctl(unsigned int cmd)
{ {
static struct { static ioctl_fn _ioctls[] = {
int cmd; autofs_dev_ioctl_version,
ioctl_fn fn; autofs_dev_ioctl_protover,
} _ioctls[] = { autofs_dev_ioctl_protosubver,
{cmd_idx(AUTOFS_DEV_IOCTL_VERSION_CMD), autofs_dev_ioctl_openmount,
autofs_dev_ioctl_version}, autofs_dev_ioctl_closemount,
{cmd_idx(AUTOFS_DEV_IOCTL_PROTOVER_CMD), autofs_dev_ioctl_ready,
autofs_dev_ioctl_protover}, autofs_dev_ioctl_fail,
{cmd_idx(AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD), autofs_dev_ioctl_setpipefd,
autofs_dev_ioctl_protosubver}, autofs_dev_ioctl_catatonic,
{cmd_idx(AUTOFS_DEV_IOCTL_OPENMOUNT_CMD), autofs_dev_ioctl_timeout,
autofs_dev_ioctl_openmount}, autofs_dev_ioctl_requester,
{cmd_idx(AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD), autofs_dev_ioctl_expire,
autofs_dev_ioctl_closemount}, autofs_dev_ioctl_askumount,
{cmd_idx(AUTOFS_DEV_IOCTL_READY_CMD), autofs_dev_ioctl_ismountpoint,
autofs_dev_ioctl_ready},
{cmd_idx(AUTOFS_DEV_IOCTL_FAIL_CMD),
autofs_dev_ioctl_fail},
{cmd_idx(AUTOFS_DEV_IOCTL_SETPIPEFD_CMD),
autofs_dev_ioctl_setpipefd},
{cmd_idx(AUTOFS_DEV_IOCTL_CATATONIC_CMD),
autofs_dev_ioctl_catatonic},
{cmd_idx(AUTOFS_DEV_IOCTL_TIMEOUT_CMD),
autofs_dev_ioctl_timeout},
{cmd_idx(AUTOFS_DEV_IOCTL_REQUESTER_CMD),
autofs_dev_ioctl_requester},
{cmd_idx(AUTOFS_DEV_IOCTL_EXPIRE_CMD),
autofs_dev_ioctl_expire},
{cmd_idx(AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD),
autofs_dev_ioctl_askumount},
{cmd_idx(AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD),
autofs_dev_ioctl_ismountpoint}
}; };
unsigned int idx = cmd_idx(cmd); unsigned int idx = cmd_idx(cmd);
return (idx >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[idx].fn; return (idx >= ARRAY_SIZE(_ioctls)) ? NULL : _ioctls[idx];
} }
/* ioctl dispatcher */ /* ioctl dispatcher */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment