From patchwork Tue Mar 26 21:39:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Potter X-Patchwork-Id: 10872201 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 5750D139A for ; Tue, 26 Mar 2019 21:39:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42A9D285FF for ; Tue, 26 Mar 2019 21:39:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37062286D1; Tue, 26 Mar 2019 21:39:20 +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 C2715285FF for ; Tue, 26 Mar 2019 21:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731770AbfCZVjT (ORCPT ); Tue, 26 Mar 2019 17:39:19 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55069 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730605AbfCZVjT (ORCPT ); Tue, 26 Mar 2019 17:39:19 -0400 Received: by mail-wm1-f67.google.com with SMTP id f3so14269369wmj.4 for ; Tue, 26 Mar 2019 14:39:17 -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=vQBAScoNuRnYibOoHWg5SI5bSdTQxp5ujvyxiTvSB/g=; b=YDtywrOTV6q+wWrF5lyDB06Sr79fYhNfKVpnVauAmkLX1SoWPByTnIzSe1RZfwH3xy ic69Y5nu5VvE9hRux2RgofyB1Q9/0ZBNZu9T1clrIK8rnZFEOldoFaoljN3+8Th+8kNf T+C9AOD/9zuxCx1RSmG50lB43kTsc57oXAdwcwmpVvwebCPpEukLCOhPsWVqTvgm/cm/ lViio6ebrX+B6rHMbaYnpsWjr23WGdxmz7CvTKpMOsrBkJKiN80SEArV74wHUe0nhjTM GsFbDH1uObaf61YWpYNUYqJDU6YDSUEIRgEFFLRYXAoyQsaVia/NSoStWwrkXTafhMWe MH8Q== 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=vQBAScoNuRnYibOoHWg5SI5bSdTQxp5ujvyxiTvSB/g=; b=A5FT2mOgBUHgVptpVL7/lQOxyXtAzH3eNdBueZ8bgYlk/t0H66jRkA7GqH5Ixpp+qp zdAt0eLQKsAJVLCdAjfjBvGsugFUOJJ6Cbe3apS+gsTCiEavXYeoOQYU/uuuuBrythIX OHrKjbVWQYSTfQgROkyNvq1YHZXShJaxVDDhNopcpNc9CEAXWz8UvnWG9mttLoEG9RGy JGJNFX/gBz1FdO/8WbfErX3wBjMrj2Rc872l28AW63Q7UYKZ+IB0CAPPtFPOsXzcNsHl qVhPSdz3N/kt4cQYkZBF3p/JqYe/c0wdKqIXbaQGidTsFx53ancVdKCHWZk3mqyB3f4t 2zNA== X-Gm-Message-State: APjAAAXD2LdUPxgq2pm2yQPJ47HYGyQQhrnJuPaM1KrqdNn5zryueG7H /a2Q6oB6I2QT+X4+R7pxUd0zWw== X-Google-Smtp-Source: APXvYqzMgAwjRIJ27KKwTBUHJ6rUUFrYnDNInzCMql8tNSnlbtwOySzHDmc8bGVynpp9RcCqIUe/1g== X-Received: by 2002:a7b:c403:: with SMTP id k3mr16599100wmi.58.1553636356735; Tue, 26 Mar 2019 14:39:16 -0700 (PDT) Received: from pathfinder ([90.195.158.41]) by smtp.gmail.com with ESMTPSA id n4sm30583861wrx.39.2019.03.26.14.39.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 26 Mar 2019 14:39:16 -0700 (PDT) Date: Tue, 26 Mar 2019 21:39:13 +0000 From: Phillip Potter To: dushistov@mail.ru Cc: amir73il@gmail.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Subject: [PATCH v6 01/07] ufs: use fs_umode_to_dtype() helper Message-ID: <20190326213913.GA20876@pathfinder> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) 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 - file systems that use the same file types as defined by POSIX do not need to define their own versions and can use the common helper functions decared in fs_types.h and implemented in fs_types.c Common implementation can be found via commit: bbe7449e2599 "fs: common implementation of file type" Signed-off-by: Amir Goldstein Signed-off-by: Phillip Potter Reviewed-by: Jan Kara --- 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