public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-ext4@vger.kernel.org
Subject: [e2fsprogs PATCH] libsupport: clean up definition of flags_array
Date: Wed,  4 Jan 2023 01:03:23 -0800	[thread overview]
Message-ID: <20230104090323.276063-1-ebiggers@kernel.org> (raw)

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.

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  9:04 UTC|newest]

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

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=20230104090323.276063-1-ebiggers@kernel.org \
    --to=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