summaryrefslogtreecommitdiffstats
path: root/tools/bpf
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2020-12-02 07:52:41 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-12-03 19:17:26 +0100
commit71ccb50074f31a50a1da4c1d8306d54da0907b00 (patch)
tree6af2efee4c96712bc438663f80d3369b25dc3e23 /tools/bpf
parentMerge branch 'switch to memcg-based memory accounting' (diff)
downloadlinux-71ccb50074f31a50a1da4c1d8306d54da0907b00.tar.xz
linux-71ccb50074f31a50a1da4c1d8306d54da0907b00.zip
tools/bpftool: Emit name <anon> for anonymous BTFs
For consistency of output, emit "name <anon>" for BTFs without the name. This keeps output more consistent and obvious. Suggested-by: Song Liu <songliubraving@fb.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20201202065244.530571-2-andrii@kernel.org
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/btf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index ed5e97157241..bd46af6a61cc 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -750,6 +750,8 @@ show_btf_plain(struct bpf_btf_info *info, int fd,
printf("name [%s] ", name);
else if (name && name[0])
printf("name %s ", name);
+ else
+ printf("name <anon> ");
printf("size %uB", info->btf_size);
n = 0;