btrfs-progs: print-tree: use ARRAY_SIZE() to replace open-coded ones

For compat_ro_flags_num and incompat_flags_num, just use ARRAY_SIZE().

Signed-off-by: Qu Wenruo <wqu@suse.com>
This commit is contained in:
Qu Wenruo 2024-10-04 14:51:06 +09:30
parent 58dfcf8e5f
commit d2c40c1e31
1 changed files with 2 additions and 4 deletions

View File

@ -1889,8 +1889,7 @@ static struct readable_flag_entry compat_ro_flags_array[] = {
DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID),
DEF_COMPAT_RO_FLAG_ENTRY(BLOCK_GROUP_TREE),
};
static const int compat_ro_flags_num = sizeof(compat_ro_flags_array) /
sizeof(struct readable_flag_entry);
static const int compat_ro_flags_num = ARRAY_SIZE(compat_ro_flags_array);
#define DEF_INCOMPAT_FLAG_ENTRY(bit_name) \
{BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
@ -1913,8 +1912,7 @@ static struct readable_flag_entry incompat_flags_array[] = {
DEF_INCOMPAT_FLAG_ENTRY(RAID_STRIPE_TREE),
DEF_INCOMPAT_FLAG_ENTRY(SIMPLE_QUOTA),
};
static const int incompat_flags_num = sizeof(incompat_flags_array) /
sizeof(struct readable_flag_entry);
static const int incompat_flags_num = ARRAY_SIZE(incompat_flags_array);
#define DEF_HEADER_FLAG_ENTRY(bit_name) \
{BTRFS_HEADER_FLAG_##bit_name, #bit_name}