From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com ([91.189.89.112]:37924 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751553AbeDMScx (ORCPT ); Fri, 13 Apr 2018 14:32:53 -0400 Received: from mail-wr0-f199.google.com ([209.85.128.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1f73VE-0003lz-OG for linux-fsdevel@vger.kernel.org; Fri, 13 Apr 2018 18:32:52 +0000 Received: by mail-wr0-f199.google.com with SMTP id e15so5808948wrj.14 for ; Fri, 13 Apr 2018 11:32:52 -0700 (PDT) From: Christian Brauner Date: Fri, 13 Apr 2018 20:32:50 +0200 To: Randy Dunlap Cc: Andreas Dilger , Alexander Viro , Thomas Gleixner , Kate Stewart , Greg Kroah-Hartman , Philippe Ombredanne , Linux FS Devel , linux-kernel@vger.kernel.org, serge@hallyn.com Subject: Re: [PATCH 2/6] statfs: use << to align with fs header Message-ID: <20180413183250.GA8277@gmail.com> References: <20180413161126.31313-1-christian.brauner@ubuntu.com> <20180413161126.31313-3-christian.brauner@ubuntu.com> <833FF27F-CFAD-4011-A21C-86B3947BB7D5@dilger.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Apr 13, 2018 at 10:55:23AM -0700, Randy Dunlap wrote: > On 04/13/2018 10:35 AM, Andreas Dilger wrote: > > On Apr 13, 2018, at 10:11 AM, Christian Brauner wrote: > >> > >> Consistenly use << to define ST_* constants. This also aligns them with > >> their MS_* counterparts in fs.h > > > > IMHO, using (1 << 10) makes the code harder to debug. If you see a field > > in a structure like 0x8354, it is non-trivial to map this to the ST_* > > flags if they are declared in the form (1 << 10) or BIT(10). If they are > > declared in the form 0x100 (as they are now) then it is trivial that the > > ST_APPEND flag is set in 0x8354, and easy to understand the other flags. > > > > So, my preference would be to NOT land this or the previous patch. All higher values are already initialized with bit-shifts for MS_* constants starting with (1<<16) as you can see from the patch and in fs.h: > +#define MS_VERBOSE (1<<15) /* War is peace. Verbosity is silence. > + * MS_VERBOSE is deprecated. > + */ > +#define MS_SILENT (1<<15) > #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ > #define MS_UNBINDABLE (1<<17) /* change to unbindable */ > #define MS_PRIVATE (1<<18) /* change to private */ This just makes it uniform which imho has merit on its own. If using shifts is considered a valid counter argument because for lack of ease to analyze struct fields then the values for MS_* flags in fs.h should probably all be hex values. In any case, I'm not going to bikeshed over this. The two patches can simply be left out when applying or I can change it all over to hex values. Christian