From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6652FC43381 for ; Tue, 26 Mar 2019 21:39:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 380F52087C for ; Tue, 26 Mar 2019 21:39:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=philpotter-co-uk.20150623.gappssmtp.com header.i=@philpotter-co-uk.20150623.gappssmtp.com header.b="fCH4n6IZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732042AbfCZVjV (ORCPT ); Tue, 26 Mar 2019 17:39:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40108 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730605AbfCZVjV (ORCPT ); Tue, 26 Mar 2019 17:39:21 -0400 Received: by mail-wr1-f67.google.com with SMTP id h4so488377wre.7 for ; Tue, 26 Mar 2019 14:39:20 -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=fso/CmjrDmR/TYRQ7oatno8Hu+n/5/Yo84v6uQ+zvxE=; b=fCH4n6IZuxdMmByDFS1lQTLvjgxelpp4jXHVhEXiA+VCVdWiWfCsJrUBLgeqL+qUwH YfajB3wCr8VhLF6kvvWzvYw40EtVX9CREttvjRDVu/C1vCNozvMyXYXkQNIo5xfK4HFl xzgzqo3FyVYQV0cgbPvaN/xzhNc+cZQOmvU4m2gxCJTeR6ct46TWH0FzYdaboYx4k5xI igoQXOOCb2jrLYYMjVLJ1my5qDdUpp1kLKOSctJgP4RmLEKxEnvKHfj+/ET3UPt5hVsz 5eA0LSuI4ulBQy2rdftTEFSc+ieWVY0qV8PU0SJQLTtXWLLY5Il5knzsqK07FAkiuD7M vJGQ== 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=fso/CmjrDmR/TYRQ7oatno8Hu+n/5/Yo84v6uQ+zvxE=; b=EydWtIjCpByKq6OiUcEwdk0cb0KkAbp1ZUHWSlc8lv3YqKUPko6ujmQZu3jteyfINi 9CsANT9AYKl6VNI28bOb18qKPDnqMi69/Q6IVfWLEHGP4ukvuxnlZ8w898f7rW7QCAio sCY4q0hhVLZPNjp4GBAYUcFy/EJlnXr5hOGPLILe1yOob6mUFCfjwrI8lzw2Khp64oTh DrMcZzP7y02WyMad7C9kP7JtpC7taXhm6oeAqeTy4kmtiODYDv7DW91H245iGcVJrzBM 4XszQcHMgmz2+X0w06frt0f6QoesyohqkaT3NaWY3piiaStz92wI1QaIbnyRya4kvwBG FZ0Q== X-Gm-Message-State: APjAAAW2EsMLR4Dy036stnqCOMrm18g8jwOBl3dT16wFjeH7QboO856T Hv64UFYoMlmX299n4vYLd6oq9UmmOQovDw== X-Google-Smtp-Source: APXvYqwEBlu3OA/ZV0n6S/z2ENwvalhzP78mn9S8bv7nAulbVNlNXFkKDdMR9/S0l5Lg9ybeiTuABw== X-Received: by 2002:adf:ebc8:: with SMTP id v8mr20974078wrn.172.1553636359173; Tue, 26 Mar 2019 14:39:19 -0700 (PDT) Received: from pathfinder ([90.195.158.41]) by smtp.gmail.com with ESMTPSA id h18sm24090322wrt.97.2019.03.26.14.39.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 26 Mar 2019 14:39:18 -0700 (PDT) Date: Tue, 26 Mar 2019 21:39:16 +0000 From: Phillip Potter To: linux-fsdevel@vger.kernel.org Cc: ernesto.mnd.fernandez@gmail.com, akpm@linux-foundation.org, amir73il@gmail.com, viro@zeniv.linux.org.uk, slava@dubeyko.com Subject: [PATCH v6 02/07] hfsplus: use fs_umode_to_dtype() helper Message-ID: <20190326213916.GA20877@pathfinder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Replace if/else statements 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" Reviewed-by: Vyacheslav Dubeyko Signed-off-by: Amir Goldstein Signed-off-by: Phillip Potter Reviewed-by: Jan Kara --- fs/hfsplus/dir.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 29a9dcfbe81f..c61a4faec2ae 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -223,7 +223,6 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) break; } else if (type == HFSPLUS_FILE) { u16 mode; - unsigned type = DT_UNKNOWN; if (fd.entrylength < sizeof(struct hfsplus_cat_file)) { pr_err("small file entry\n"); @@ -232,21 +231,10 @@ static int hfsplus_readdir(struct file *file, struct dir_context *ctx) } mode = be16_to_cpu(entry.file.permissions.mode); - if (S_ISREG(mode)) - type = DT_REG; - else if (S_ISLNK(mode)) - type = DT_LNK; - else if (S_ISFIFO(mode)) - type = DT_FIFO; - else if (S_ISCHR(mode)) - type = DT_CHR; - else if (S_ISBLK(mode)) - type = DT_BLK; - else if (S_ISSOCK(mode)) - type = DT_SOCK; if (!dir_emit(ctx, strbuf, len, - be32_to_cpu(entry.file.id), type)) + be32_to_cpu(entry.file.id), + fs_umode_to_dtype(mode))) break; } else { pr_err("bad catalog entry type\n"); -- 2.20.1