From: Qu Wenruo Date: Mon, 11 May 2015 08:08:44 +0000 (+0800) Subject: btrfs-progs: show-super: print human readable text for super flags X-Git-Tag: upstream/4.16.1~2274 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ae2b8b52fe18efc0aab16ac3a5d1286a495b347;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: show-super: print human readable text for super flags Use the new __print_readable_flag() to implement print_readable_super_flag(). Signed-off-by: Qu Wenruo [removed the chunk tree flag] Signed-off-by: David Sterba --- diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 430ddfe..27414c8 100644 --- a/btrfs-show-super.c +++ b/btrfs-show-super.c @@ -305,6 +305,28 @@ struct readable_flag_entry incompat_flags_array[] = { static const int incompat_flags_num = sizeof(incompat_flags_array) / sizeof(struct readable_flag_entry); +#define DEF_HEADER_FLAG_ENTRY(bit_name) \ + {BTRFS_HEADER_FLAG_##bit_name, #bit_name} +#define DEF_SUPER_FLAG_ENTRY(bit_name) \ + {BTRFS_SUPER_FLAG_##bit_name, #bit_name} + +struct readable_flag_entry super_flags_array[] = { + DEF_HEADER_FLAG_ENTRY(WRITTEN), + DEF_HEADER_FLAG_ENTRY(RELOC), + DEF_SUPER_FLAG_ENTRY(CHANGING_FSID), + DEF_SUPER_FLAG_ENTRY(SEEDING), + DEF_SUPER_FLAG_ENTRY(METADUMP), + DEF_SUPER_FLAG_ENTRY(METADUMP_V2) +}; +static const int super_flags_num = ARRAY_SIZE(super_flags_array); + +#define BTRFS_SUPER_FLAG_SUPP (BTRFS_HEADER_FLAG_WRITTEN |\ + BTRFS_HEADER_FLAG_RELOC |\ + BTRFS_SUPER_FLAG_CHANGING_FSID |\ + BTRFS_SUPER_FLAG_SEEDING |\ + BTRFS_SUPER_FLAG_METADUMP |\ + BTRFS_SUPER_FLAG_METADUMP_V2) + static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, int array_size, u64 supported_flags) { @@ -343,6 +365,12 @@ static void print_readable_incompat_flag(u64 flag) BTRFS_FEATURE_INCOMPAT_SUPP); } +static void print_readable_super_flag(u64 flag) +{ + return __print_readable_flag(flag, super_flags_array, + super_flags_num, BTRFS_SUPER_FLAG_SUPP); +} + static void dump_superblock(struct btrfs_super_block *sb, int full) { int i; @@ -362,6 +390,7 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) (unsigned long long)btrfs_super_bytenr(sb)); printf("flags\t\t\t0x%llx\n", (unsigned long long)btrfs_super_flags(sb)); + print_readable_super_flag(btrfs_super_flags(sb)); printf("magic\t\t\t"); s = (char *) &sb->magic;