From patchwork Tue Oct 23 20:19:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Potter X-Patchwork-Id: 10653617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 234F213B5 for ; Tue, 23 Oct 2018 20:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1155B2A3F0 for ; Tue, 23 Oct 2018 20:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F7B12A41E; Tue, 23 Oct 2018 20:20:51 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 ADE7F2A3F0 for ; Tue, 23 Oct 2018 20:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728641AbeJXEoz (ORCPT ); Wed, 24 Oct 2018 00:44:55 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45542 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeJXEoy (ORCPT ); Wed, 24 Oct 2018 00:44:54 -0400 Received: by mail-wr1-f66.google.com with SMTP id f17-v6so3077800wrs.12 for ; Tue, 23 Oct 2018 13:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philpotter-co-uk.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=95Fd5rI3XvksS6xocCMzSCrV7TdI040H8LYjyP/+fwo=; b=bunJ2uXkxmQaxPLh50ANlx5pUrnZXgnh6cXibToudhOLcIh9Io7LjOqY451eRPntaj C+qrp0bjdhc2hBfJ3ZAxCBZtjxBIKFu3zlY4/CNSqczjPCD7GdYr4nF5zsuHtDBU/F+l +DwGVQJ+nFJV6VVTs5miyebzOKg4z9UABmbHngilb0GIwTMueoTuW61EN083Q/3Ac0+s TtpR8G5kJaI6FIC+MSrgsVY+TWGVOtYPzpXp8RN4g63R1Qwj5vAe8j6VhkU7LEFCsSEK EpDUzLkFZ6cHSfrJzpGFmNeUhwSXUZX1hXcylFID358Xp2RKQS0feB8TEAhWzqBRFF37 QvNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=95Fd5rI3XvksS6xocCMzSCrV7TdI040H8LYjyP/+fwo=; b=lWpPpQzBdaItlGEH2gRsIlNyoA4HYxiP51gNPsVlLGTbRNhBBcwwhPhg87W52As7Gz BPyMyC49Ni4FmQT3oLuiWBHwxkT5ulw3hYNkjz65dRHGlwjtvhy4rUj0L6AupC6e981Y KKADE48ZgSTV10/Q+Teb0lEf9R0Xr/G3PSDWY1QIGRcRga8h5XIu11NAgqmBNocZLcbO Lb5UMpDZHeWHL06A+1T+CUAFUZ5nDfy02My55bn0F78oHLw10dLEMOy2Veko8hioRmM8 95zljfzWB2W+Y1bC23b9/reDp8s3o91qINSlhuHpUDW9SNscmXicrnSvJKCsENYP5nue PFmg== X-Gm-Message-State: AGRZ1gLiQoxwVBwQMHrnaSoWePyEzqh6BAtVDyY0gsZVo9FHCtKcV/f5 ntiER1dDR2lSt17oWO/5xgjusg== X-Google-Smtp-Source: AJdET5ehCc00RM9LpCWbGfPgTkkR5UrJd8Tl1zumpw4iX0pR6rgoVxBYvFiDHNNHGuwbE1gxuCdR6g== X-Received: by 2002:a5d:4086:: with SMTP id o6-v6mr20755369wrp.133.1540325996303; Tue, 23 Oct 2018 13:19:56 -0700 (PDT) Received: from pathfinder (62-64-249-96.dynamic.dsl.as9105.com. [62.64.249.96]) by smtp.gmail.com with ESMTPSA id a18sm1470274wrx.55.2018.10.23.13.19.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 13:19:55 -0700 (PDT) Date: Tue, 23 Oct 2018 21:19:55 +0100 From: Phillip Potter To: dushistov@mail.ru Cc: linux-kernel@vger.kernel.org, amir73il@gmail.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Subject: [RFC][PATCH 02/10] ufs: use fs_umode_to_dtype() helper Message-ID: <20181023201955.GA15694@pathfinder> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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 Replace switch statement with common lookup table implementation. Original patch written by Amir Goldstein. Signed-off-by: Phillip Potter --- fs/ufs/util.h | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 1fd3011ea623..8c7759860739 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h @@ -158,34 +158,7 @@ ufs_set_de_type(struct super_block *sb, struct ufs_dir_entry *de, int mode) if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) != UFS_DE_44BSD) return; - /* - * TODO turn this into a table lookup - */ - switch (mode & S_IFMT) { - case S_IFSOCK: - de->d_u.d_44.d_type = DT_SOCK; - break; - case S_IFLNK: - de->d_u.d_44.d_type = DT_LNK; - break; - case S_IFREG: - de->d_u.d_44.d_type = DT_REG; - break; - case S_IFBLK: - de->d_u.d_44.d_type = DT_BLK; - break; - case S_IFDIR: - de->d_u.d_44.d_type = DT_DIR; - break; - case S_IFCHR: - de->d_u.d_44.d_type = DT_CHR; - break; - case S_IFIFO: - de->d_u.d_44.d_type = DT_FIFO; - break; - default: - de->d_u.d_44.d_type = DT_UNKNOWN; - } + de->d_u.d_44.d_type = fs_umode_to_dtype(mode); } static inline u32