On Tue, Sep 7, 2021 at 4:01 PM Yonghong Song <yhs@xxxxxx> wrote: > > added bpftool support to dump BTF_KIND_TAG information. > The new bpftool will be used in later patches to dump > btf in the test bpf program object file. > > Signed-off-by: Yonghong Song <yhs@xxxxxx> > --- > tools/bpf/bpftool/btf.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c > index f7e5ff3586c9..89c17ea62d8e 100644 > --- a/tools/bpf/bpftool/btf.c > +++ b/tools/bpf/bpftool/btf.c > @@ -37,6 +37,7 @@ static const char * const btf_kind_str[NR_BTF_KINDS] = { > [BTF_KIND_VAR] = "VAR", > [BTF_KIND_DATASEC] = "DATASEC", > [BTF_KIND_FLOAT] = "FLOAT", > + [BTF_KIND_TAG] = "TAG", > }; > > struct btf_attach_table { > @@ -347,6 +348,23 @@ static int dump_btf_type(const struct btf *btf, __u32 id, > printf(" size=%u", t->size); > break; > } > + case BTF_KIND_TAG: { > + const struct btf_tag *tag = (const void *)(t + 1); > + > + extra empty line? > + if (json_output) { > + jsonw_uint_field(w, "type_id", t->type); > + if (btf_kflag(t)) > + jsonw_int_field(w, "comp_id", -1); > + else > + jsonw_uint_field(w, "comp_id", tag->comp_id); > + } else if (btf_kflag(t)) { > + printf(" type_id=%u, comp_id=-1", t->type); > + } else { > + printf(" type_id=%u, comp_id=%u", t->type, tag->comp_id); > + } here not using kflag would be more natural as well ;) > + break; > + } > default: > break; > } > -- > 2.30.2 >