public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [e2fsprogs PATCH] libsupport: clean up definition of flags_array
Date: Wed, 4 Jan 2023 11:23:59 +0100	[thread overview]
Message-ID: <20230104102359.4bfndqhuddmkqymq@fedora> (raw)
In-Reply-To: <20230104090323.276063-1-ebiggers@kernel.org>

On Wed, Jan 04, 2023 at 01:03:23AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Add braces to address the following compiler warning with gcc -Wall:
> 
> print_fs_flags.c:24:42: warning: missing braces around initializer [-Wmissing-braces]
>    24 | static struct flags_name flags_array[] = {
>       |                                          ^
> 
> Also add 'const', and add an explicit NULL in the last entry.

Looks good, thanks.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  lib/support/print_fs_flags.c | 60 ++++++++++++++++++------------------
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/lib/support/print_fs_flags.c b/lib/support/print_fs_flags.c
> index e54acc04..f47cd665 100644
> --- a/lib/support/print_fs_flags.c
> +++ b/lib/support/print_fs_flags.c
> @@ -21,40 +21,40 @@ struct flags_name {
>  	const char	*name;
>  };
>  
> -static struct flags_name flags_array[] = {
> -	EXT2_FLAG_RW, "EXT2_FLAG_RW",
> -	EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED",
> -	EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY",
> -	EXT2_FLAG_VALID, "EXT2_FLAG_VALID",
> -	EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY",
> -	EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY",
> -	EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES",
> -	EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ",
> -	EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE",
> -	EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY",
> -	EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE",
> -	EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY",
> -	EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK",
> -	EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE",
> -	EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE",
> -	EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES",
> -	EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR",
> -	EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS",
> -	EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS",
> -	EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO",
> -	EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP",
> -	EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS",
> -	EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP",
> -	EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS",
> -	EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM",
> -	EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM",
> -	EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS",
> -	0
> +static const struct flags_name flags_array[] = {
> +	{ EXT2_FLAG_RW, "EXT2_FLAG_RW" },
> +	{ EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED" },
> +	{ EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY" },
> +	{ EXT2_FLAG_VALID, "EXT2_FLAG_VALID" },
> +	{ EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY" },
> +	{ EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY" },
> +	{ EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES" },
> +	{ EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ" },
> +	{ EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE" },
> +	{ EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY" },
> +	{ EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE" },
> +	{ EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY" },
> +	{ EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK" },
> +	{ EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE" },
> +	{ EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE" },
> +	{ EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES" },
> +	{ EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR" },
> +	{ EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS" },
> +	{ EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS" },
> +	{ EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO" },
> +	{ EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP" },
> +	{ EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS" },
> +	{ EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP" },
> +	{ EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS" },
> +	{ EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM" },
> +	{ EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM" },
> +	{ EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS" },
> +	{ 0, NULL },
>  };
>  
>  void print_fs_flags(FILE * f, unsigned long flags)
>  {
> -	struct flags_name *fp;
> +	const struct flags_name *fp;
>  	int	first = 1, pos = 16;
>  
>  	for (fp = flags_array; fp->flag != 0; fp++) {
> -- 
> 2.39.0
> 


      reply	other threads:[~2023-01-04 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  9:03 [e2fsprogs PATCH] libsupport: clean up definition of flags_array Eric Biggers
2023-01-04 10:23 ` Lukas Czerner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230104102359.4bfndqhuddmkqymq@fedora \
    --to=lczerner@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox