From: Eric Biggers <ebiggers@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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