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 <quwenruo@cn.fujitsu.com> [removed the chunk tree flag] Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
b8436121c2
commit
9ae2b8b52f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue