From patchwork Wed Aug 31 03:34:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 9306293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C777860487 for ; Wed, 31 Aug 2016 03:34:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF23528358 for ; Wed, 31 Aug 2016 03:34:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F67628387; Wed, 31 Aug 2016 03:34:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DB8428358 for ; Wed, 31 Aug 2016 03:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759183AbcHaDeY (ORCPT ); Tue, 30 Aug 2016 23:34:24 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46989 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759015AbcHaDeT (ORCPT ); Tue, 30 Aug 2016 23:34:19 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 94152202ED; Tue, 30 Aug 2016 23:34:18 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Tue, 30 Aug 2016 23:34:18 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=themaw.net; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=TLfb5Y2yGggiIdZ6AqdtOPSc+5Q=; b=dOxL2O Kj7/HnclKKb1XYH73xFEPG590V8IBKERH0HW0rM8rFC4rWkhRv/7oOgHWgrLaCAp yipaZ2QqHPwiDFzyfeKXM5STzuqIr6OyrQYLVui+0MyS5YpJe7xZ3L2XaJDT5cM6 kNsfvmhF2KSmk7OH7/+VHL6I2/7QmLHb4Ameg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=TLfb5Y2yGggiIdZ 6AqdtOPSc+5Q=; b=B7V2DYdep6o7kctfvshLMY0hylkfdzrVKIbVw5g37UEvYt3 nM4yStLNUfYksDW0gozJFHRS5xtfrcssOL1pUKLxpHlpSHoR2zjC1AS1OQTcOpEo 6okEtZOMlLjgPwUMDS+rO8lqql1CHO3s60LYw3vh+5uuvQIT5j8H1Pb5ovFQ= X-Sasl-enc: 0eDWI8657ZVPNS+B0DRT+cGkb/UEAlVDH/Pmcd05r0zo 1472614457 Received: from pluto.themaw.net (220-253-166-124.dyn.iinet.net.au [220.253.166.124]) by mail.messagingengine.com (Postfix) with ESMTPA id CD726F29D2; Tue, 30 Aug 2016 23:34:17 -0400 (EDT) Received: from pluto.themaw.net (localhost [127.0.0.1]) by pluto.themaw.net (Postfix) with ESMTP id 0B8EDA007B; Wed, 31 Aug 2016 11:34:15 +0800 (AWST) Subject: [PATCH 2/3] autofs: refactor ioctl fn vector in iookup_dev_ioctl() From: Ian Kent To: Andrew Morton Cc: linux-fsdevel , Tomohiro Kusumi , autofs mailing list , Kernel Mailing List Date: Wed, 31 Aug 2016 11:34:15 +0800 Message-ID: <20160831033414.9910.66697.stgit@pluto.themaw.net> In-Reply-To: <20160831033409.9910.77067.stgit@pluto.themaw.net> References: <20160831033409.9910.77067.stgit@pluto.themaw.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tomohiro Kusumi 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. Signed-off-by: Tomohiro Kusumi Signed-off-by: Ian Kent --- fs/autofs4/dev-ioctl.c | 49 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index e89d6bb..fc09eb7 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c @@ -597,42 +597,25 @@ out: static ioctl_fn lookup_dev_ioctl(unsigned int cmd) { - static struct { - int cmd; - ioctl_fn fn; - } _ioctls[] = { - {cmd_idx(AUTOFS_DEV_IOCTL_VERSION_CMD), - autofs_dev_ioctl_version}, - {cmd_idx(AUTOFS_DEV_IOCTL_PROTOVER_CMD), - autofs_dev_ioctl_protover}, - {cmd_idx(AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD), - autofs_dev_ioctl_protosubver}, - {cmd_idx(AUTOFS_DEV_IOCTL_OPENMOUNT_CMD), - autofs_dev_ioctl_openmount}, - {cmd_idx(AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD), - autofs_dev_ioctl_closemount}, - {cmd_idx(AUTOFS_DEV_IOCTL_READY_CMD), - 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} + static ioctl_fn _ioctls[] = { + autofs_dev_ioctl_version, + autofs_dev_ioctl_protover, + autofs_dev_ioctl_protosubver, + autofs_dev_ioctl_openmount, + autofs_dev_ioctl_closemount, + autofs_dev_ioctl_ready, + autofs_dev_ioctl_fail, + autofs_dev_ioctl_setpipefd, + autofs_dev_ioctl_catatonic, + autofs_dev_ioctl_timeout, + autofs_dev_ioctl_requester, + autofs_dev_ioctl_expire, + autofs_dev_ioctl_askumount, + autofs_dev_ioctl_ismountpoint, }; 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 */