All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_*
@ 2020-07-13  3:10 Eric Biggers
  2020-08-05 14:25 ` Jan Kara
  2020-08-06  5:17 ` tytso
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2020-07-13  3:10 UTC (permalink / raw)
  To: linux-ext4

From: Eric Biggers <ebiggers@google.com>

Define the EXT4_FL_USER_* constants by OR-ing together the appropriate
flags, rather than hard-coding a numeric value.  This makes it much
easier to see which flags are listed.

No change in the actual values.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/ext4/ext4.h | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 42f5060f3cdf..b603a28a3696 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -434,8 +434,34 @@ struct flex_groups {
 #define EXT4_CASEFOLD_FL		0x40000000 /* Casefolded directory */
 #define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
-#define EXT4_FL_USER_VISIBLE		0x725BDFFF /* User visible flags */
-#define EXT4_FL_USER_MODIFIABLE		0x624BC0FF /* User modifiable flags */
+/* User modifiable flags */
+#define EXT4_FL_USER_MODIFIABLE		(EXT4_SECRM_FL | \
+					 EXT4_UNRM_FL | \
+					 EXT4_COMPR_FL | \
+					 EXT4_SYNC_FL | \
+					 EXT4_IMMUTABLE_FL | \
+					 EXT4_APPEND_FL | \
+					 EXT4_NODUMP_FL | \
+					 EXT4_NOATIME_FL | \
+					 EXT4_JOURNAL_DATA_FL | \
+					 EXT4_NOTAIL_FL | \
+					 EXT4_DIRSYNC_FL | \
+					 EXT4_TOPDIR_FL | \
+					 EXT4_EXTENTS_FL | \
+					 0x00400000 /* EXT4_EOFBLOCKS_FL */ | \
+					 EXT4_DAX_FL | \
+					 EXT4_PROJINHERIT_FL | \
+					 EXT4_CASEFOLD_FL)
+
+/* User visible flags */
+#define EXT4_FL_USER_VISIBLE		(EXT4_FL_USER_MODIFIABLE | \
+					 EXT4_DIRTY_FL | \
+					 EXT4_COMPRBLK_FL | \
+					 EXT4_NOCOMPR_FL | \
+					 EXT4_ENCRYPT_FL | \
+					 EXT4_INDEX_FL | \
+					 EXT4_VERITY_FL | \
+					 EXT4_INLINE_DATA_FL)
 
 /* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */
 #define EXT4_FL_XFLAG_VISIBLE		(EXT4_SYNC_FL | \
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_*
  2020-07-13  3:10 [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_* Eric Biggers
@ 2020-08-05 14:25 ` Jan Kara
  2020-08-06  5:17 ` tytso
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2020-08-05 14:25 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-ext4

On Sun 12-07-20 20:10:12, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Define the EXT4_FL_USER_* constants by OR-ing together the appropriate
> flags, rather than hard-coding a numeric value.  This makes it much
> easier to see which flags are listed.
> 
> No change in the actual values.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

The patch looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza


> ---
>  fs/ext4/ext4.h | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 42f5060f3cdf..b603a28a3696 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -434,8 +434,34 @@ struct flex_groups {
>  #define EXT4_CASEFOLD_FL		0x40000000 /* Casefolded directory */
>  #define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
>  
> -#define EXT4_FL_USER_VISIBLE		0x725BDFFF /* User visible flags */
> -#define EXT4_FL_USER_MODIFIABLE		0x624BC0FF /* User modifiable flags */
> +/* User modifiable flags */
> +#define EXT4_FL_USER_MODIFIABLE		(EXT4_SECRM_FL | \
> +					 EXT4_UNRM_FL | \
> +					 EXT4_COMPR_FL | \
> +					 EXT4_SYNC_FL | \
> +					 EXT4_IMMUTABLE_FL | \
> +					 EXT4_APPEND_FL | \
> +					 EXT4_NODUMP_FL | \
> +					 EXT4_NOATIME_FL | \
> +					 EXT4_JOURNAL_DATA_FL | \
> +					 EXT4_NOTAIL_FL | \
> +					 EXT4_DIRSYNC_FL | \
> +					 EXT4_TOPDIR_FL | \
> +					 EXT4_EXTENTS_FL | \
> +					 0x00400000 /* EXT4_EOFBLOCKS_FL */ | \
> +					 EXT4_DAX_FL | \
> +					 EXT4_PROJINHERIT_FL | \
> +					 EXT4_CASEFOLD_FL)
> +
> +/* User visible flags */
> +#define EXT4_FL_USER_VISIBLE		(EXT4_FL_USER_MODIFIABLE | \
> +					 EXT4_DIRTY_FL | \
> +					 EXT4_COMPRBLK_FL | \
> +					 EXT4_NOCOMPR_FL | \
> +					 EXT4_ENCRYPT_FL | \
> +					 EXT4_INDEX_FL | \
> +					 EXT4_VERITY_FL | \
> +					 EXT4_INLINE_DATA_FL)
>  
>  /* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */
>  #define EXT4_FL_XFLAG_VISIBLE		(EXT4_SYNC_FL | \
> -- 
> 2.27.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_*
  2020-07-13  3:10 [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_* Eric Biggers
  2020-08-05 14:25 ` Jan Kara
@ 2020-08-06  5:17 ` tytso
  1 sibling, 0 replies; 3+ messages in thread
From: tytso @ 2020-08-06  5:17 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-ext4

On Sun, Jul 12, 2020 at 08:10:12PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Define the EXT4_FL_USER_* constants by OR-ing together the appropriate
> flags, rather than hard-coding a numeric value.  This makes it much
> easier to see which flags are listed.
> 
> No change in the actual values.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-06 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13  3:10 [PATCH] ext4: don't hardcode bit values in EXT4_FL_USER_* Eric Biggers
2020-08-05 14:25 ` Jan Kara
2020-08-06  5:17 ` tytso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.