Skip to content

Commit 010b93f

Browse files
committed
btrfs-progs: print-tree: cleanup __print_readable_flag()
This includes: - Remove the "__" prefix Now the "__" is no longer recommended, and there is no function taking the "print_readable_flag" in the first place. - Move the supported flags calculation into print_readable_flag() Since all callers are doing the same work before calling the function. Signed-off-by: Qu Wenruo <wqu@suse.com>
1 parent d2c40c1 commit 010b93f

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

kernel-shared/print-tree.c

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,13 +1933,17 @@ static struct readable_flag_entry super_flags_array[] = {
19331933
};
19341934
static const int super_flags_num = ARRAY_SIZE(super_flags_array);
19351935

1936-
static void __print_readable_flag(u64 flag, struct readable_flag_entry *array,
1937-
int array_size, u64 supported_flags)
1936+
static void print_readable_flag(u64 flag, struct readable_flag_entry *array,
1937+
int array_size)
19381938
{
19391939
int i;
19401940
int first = 1;
1941+
u64 supported_flags = 0;
19411942
struct readable_flag_entry *entry;
19421943

1944+
for (i = 0; i < array_size; i++)
1945+
supported_flags |= array[i].bit;
1946+
19431947
if (!flag)
19441948
return;
19451949

@@ -1966,33 +1970,20 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array,
19661970

19671971
static void print_readable_compat_ro_flag(u64 flag)
19681972
{
1969-
u64 print_flags = 0;
1970-
1971-
for (int i = 0; i < compat_ro_flags_num; i++)
1972-
print_flags |= compat_ro_flags_array[i].bit;
1973-
return __print_readable_flag(flag, compat_ro_flags_array,
1974-
compat_ro_flags_num,
1975-
print_flags);
1973+
return print_readable_flag(flag, compat_ro_flags_array,
1974+
compat_ro_flags_num);
19761975
}
19771976

19781977
static void print_readable_incompat_flag(u64 flag)
19791978
{
1980-
u64 print_flags = 0;
1981-
1982-
for (int i = 0; i < incompat_flags_num; i++)
1983-
print_flags |= incompat_flags_array[i].bit;
1984-
return __print_readable_flag(flag, incompat_flags_array,
1985-
incompat_flags_num, print_flags);
1979+
return print_readable_flag(flag, incompat_flags_array,
1980+
incompat_flags_num);
19861981
}
19871982

19881983
static void print_readable_super_flag(u64 flag)
19891984
{
1990-
u64 print_flags = 0;
1991-
1992-
for (int i = 0; i < super_flags_num; i++)
1993-
print_flags |= super_flags_array[i].bit;
1994-
return __print_readable_flag(flag, super_flags_array,
1995-
super_flags_num, print_flags);
1985+
return print_readable_flag(flag, super_flags_array,
1986+
super_flags_num);
19961987
}
19971988

19981989
static void print_sys_chunk_array(struct btrfs_super_block *sb)

0 commit comments

Comments
 (0)