@@ -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,18 @@ static int dump_btf_type(const struct btf *btf, __u32 id,
jsonw_end_array(w);
break;
}
+ case BTF_KIND_FLOAT: {
+ __u32 v = *(__u32 *)(t + 1);
+
+ if (json_output) {
+ jsonw_uint_field(w, "size", t->size);
+ jsonw_uint_field(w, "nr_bits", BTF_FLOAT_BITS(v));
+ } else {
+ printf(" size=%u nr_bits=%u",
+ t->size, BTF_FLOAT_BITS(v));
+ }
+ break;
+ }
default:
break;
}
@@ -596,6 +596,7 @@ static int __btf_dumper_type_only(const struct btf *btf, __u32 type_id,
switch (BTF_INFO_KIND(t->info)) {
case BTF_KIND_INT:
case BTF_KIND_TYPEDEF:
+ case BTF_KIND_FLOAT:
BTF_PRINT_ARG("%s ", btf__name_by_offset(btf, t->name_off));
break;
case BTF_KIND_STRUCT:
Only dumping support needs to be adjusted, the code structure follows that of BTF_KIND_INT. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- tools/bpf/bpftool/btf.c | 13 +++++++++++++ tools/bpf/bpftool/btf_dumper.c | 1 + 2 files changed, 14 insertions(+)