Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp975718imu; Sat, 15 Dec 2018 11:11:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZ2LVOPGe18+FReQRkT5y1Ba46cUDeU/0DeDsUX28Sj+tTOA5cGgpir8LybRTI5L497NHJ X-Received: by 2002:a62:1289:: with SMTP id 9mr7504785pfs.102.1544901084423; Sat, 15 Dec 2018 11:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544901084; cv=none; d=google.com; s=arc-20160816; b=AK4VYcEeQReJTt3DZpVOZN/hx0RGrwTK5D6Mki7oTGhPFxO5V1QSmbNxsBKYsJnzfH f4526bPLlnksGL8aWWpyXmsT5nFp55lwEba6gvqcqZxKVf5xKYZxkQllwuqr4z6eW6Tj gGgkHajrM3ebUFQSbev/vmiWQVat1HEq6QRHRaizUpVnQjGxHHrM9QmUdmQBmZDm98kK yDetFDOi/rc98xPJoFOktOb3nDwmGTi2v5V0+gQ5Ljv8FSkXVF7AdY1x7OraWFWiFsb7 8KD0CzjiSn6lCsScU9blHYqWR/kboMIqV2ExWIBF3i9knAfWfqLpxMqT8FzgwRkZS03b 0DdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=8Nps6jPFqaOiibDGIdu2j66FokHsSTmWU7XkX8jMcjM=; b=V6Q2/xRuj9/o3nAasTxjOaX2fJz13s1Tk9U3mTumamN0WeBEInwZ1hyAaB0YA6HnzT g6X586AiNDNABtgcHkufQItd0C9MBtCoQTAl0Zg/UcwNjBVMFh0uPaNoJORY1Q0Ll7+F sQrpXeLivNRoDphpQ4Cl0+jmmGLOCr+P72ZwXycm2Ien90vYs2WF+/HqDx9IT4Y3Gl8P 5A5vx4UjcxjvSofEvVYcO/cO+7cFM+jTZ/Q4jFPJf0UaKWzj8jOzF1007+HgfAy00ejK h0FuR583jlPuycHmV6QwuBveycNmPwr9fQhhBSUy6lXPQTX36bO5nDRwuRVhV+Uz57PS nEhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68si6211891pgd.437.2018.12.15.11.11.08; Sat, 15 Dec 2018 11:11:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727540AbeLOTKT (ORCPT + 99 others); Sat, 15 Dec 2018 14:10:19 -0500 Received: from mail.parknet.co.jp ([210.171.160.6]:42914 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbeLOTKT (ORCPT ); Sat, 15 Dec 2018 14:10:19 -0500 Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 66407161688; Sun, 16 Dec 2018 04:10:18 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-12) with ESMTPS id wBFJAHqT011612 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 16 Dec 2018 04:10:18 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-12) with ESMTPS id wBFJAGuF024016 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 16 Dec 2018 04:10:16 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id wBFJAEft024015; Sun, 16 Dec 2018 04:10:14 +0900 From: OGAWA Hirofumi To: Carmeli Tamir Cc: linux-kernel@vger.kernel.org, jthumshirn@suse.de, sergey.senozhatsky@gmail.com, akpm@linux-foundation.org, bvanassche@acm.org, axboe@kernel.dk, martin.petersen@oracle.com, sfr@canb.auug.org.au Subject: Re: [PATCH v2 2/3] fat: Moved MAX_FAT to fat.h and changed it to inline function References: <1544879072-4251-1-git-send-email-carmeli.tamir@gmail.com> <1544879072-4251-3-git-send-email-carmeli.tamir@gmail.com> Date: Sun, 16 Dec 2018 04:10:14 +0900 In-Reply-To: <1544879072-4251-3-git-send-email-carmeli.tamir@gmail.com> (Carmeli Tamir's message of "Sat, 15 Dec 2018 08:04:31 -0500") Message-ID: <8736qyd2sp.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Carmeli Tamir writes: > MAX_FAT is useless in msdos_fs.h, since it uses the MSDOS_SB function > that is defined in fat.h. So really, this macro can be only called > from code that already includes fat.h. > > Hence, this patch moves it to fat.h, right after MSDOS_SB is defined. > I also changed it to an inline function in order to save the double call > to MSDOS_SB. This was suggested by joe@perches.com in the previous > version. > > This patch is required for the next in the series, in which the variant > (whether this is FAT12, FAT16 or FAT32) checks are replaced with new > macros. Could you use lower case chars for inline functions? Yeah, MSDOS_SB() is upper case though, it is historical reason. Thanks. > Signed-off-by: Carmeli Tamir > --- > fs/fat/fat.h | 9 +++++++++ > include/uapi/linux/msdos_fs.h | 2 -- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/fs/fat/fat.h b/fs/fat/fat.h > index 4e1b2f6..11bc4a2 100644 > --- a/fs/fat/fat.h > +++ b/fs/fat/fat.h > @@ -142,6 +142,15 @@ static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb) > return sb->s_fs_info; > } > > +/* Maximum number of clusters */ > +static inline u32 MAX_FAT(struct super_block *sb) > +{ > + struct msdos_sb_info *sbi = MSDOS_SB(sb); > + > + return sbi->fat_bits == 32 ? MAX_FAT32 : > + sbi->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12; > +} > + > static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) > { > return container_of(inode, struct msdos_inode_info, vfs_inode); > diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h > index 833c707..a577389 100644 > --- a/include/uapi/linux/msdos_fs.h > +++ b/include/uapi/linux/msdos_fs.h > @@ -65,8 +65,6 @@ > #define MAX_FAT12 0xFF4 > #define MAX_FAT16 0xFFF4 > #define MAX_FAT32 0x0FFFFFF6 > -#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \ > - MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) > > /* bad cluster mark */ > #define BAD_FAT12 0xFF7 -- OGAWA Hirofumi