diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2021-02-26 23:22:50 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-03-05 04:58:15 +0300 |
commit | 737e0f919a8d2a313618d8ac67d50e8223bc5d74 (patch) | |
tree | 17e59f34933d9ffc778f46ce7e4dcb291db745c6 /tools/bpf/bpftool/btf.c | |
parent | 22541a9eeb0d968c133aaebd95fa59da3208e705 (diff) | |
download | linux-737e0f919a8d2a313618d8ac67d50e8223bc5d74.tar.xz |
tools/bpftool: Add BTF_KIND_FLOAT support
Only dumping support needs to be adjusted, the code structure follows
that of BTF_KIND_INT. Example plain and JSON outputs:
[4] FLOAT 'float' size=4
{"id":4,"kind":"FLOAT","name":"float","size":4}
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210226202256.116518-5-iii@linux.ibm.com
Diffstat (limited to 'tools/bpf/bpftool/btf.c')
-rw-r--r-- | tools/bpf/bpftool/btf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index fe9e7b3a4b50..985610c3f193 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -36,6 +36,7 @@ static const char * const btf_kind_str[NR_BTF_KINDS] = { [BTF_KIND_FUNC_PROTO] = "FUNC_PROTO", [BTF_KIND_VAR] = "VAR", [BTF_KIND_DATASEC] = "DATASEC", + [BTF_KIND_FLOAT] = "FLOAT", }; struct btf_attach_table { @@ -327,6 +328,13 @@ static int dump_btf_type(const struct btf *btf, __u32 id, jsonw_end_array(w); break; } + case BTF_KIND_FLOAT: { + if (json_output) + jsonw_uint_field(w, "size", t->size); + else + printf(" size=%u", t->size); + break; + } default: break; } |