BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 4/9] bpftool: add support for BTF_KIND_TAG
Date: Fri, 10 Sep 2021 09:04:47 -0700	[thread overview]
Message-ID: <665f0ad9-78ca-23cf-daf9-b2a8099f2ed8@fb.com> (raw)
In-Reply-To: <CAEf4BzZ6eX5GbV4o+4vz2whXyOQd+5_AaVEYn+uvR5=sV=aWZw@mail.gmail.com>



On 9/8/21 10:28 PM, Andrii Nakryiko wrote:
> On Tue, Sep 7, 2021 at 4:01 PM Yonghong Song <yhs@fb.com> 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@fb.com>
>> ---
>>   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?

ack.

> 
>> +               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 ;)

definitely.

> 
>> +               break;
>> +       }
>>          default:
>>                  break;
>>          }
>> --
>> 2.30.2
>>

  parent reply	other threads:[~2021-09-10 16:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-07 23:00 [PATCH bpf-next 0/9] bpf: add support for new btf kind BTF_KIND_TAG Yonghong Song
2021-09-07 23:00 ` [PATCH bpf-next 1/9] bpf: " Yonghong Song
2021-09-09  5:09   ` Andrii Nakryiko
2021-09-10 15:55     ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 2/9] libbpf: rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag Yonghong Song
2021-09-09  5:10   ` Andrii Nakryiko
2021-09-07 23:01 ` [PATCH bpf-next 3/9] libbpf: add support for BTF_KIND_TAG Yonghong Song
2021-09-09  5:26   ` Andrii Nakryiko
2021-09-10 16:04     ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 4/9] bpftool: " Yonghong Song
2021-09-09  5:28   ` Andrii Nakryiko
2021-09-09  5:33     ` Andrii Nakryiko
2021-09-10 16:38       ` Yonghong Song
2021-09-10 18:05         ` Andrii Nakryiko
2021-09-10 16:04     ` Yonghong Song [this message]
2021-09-07 23:01 ` [PATCH bpf-next 5/9] selftests/bpf: test libbpf API function btf__add_tag() Yonghong Song
2021-09-09  5:35   ` Andrii Nakryiko
2021-09-10 16:39     ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 6/9] selftests/bpf: add BTF_KIND_TAG unit tests Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 7/9] selftests/bpf: test BTF_KIND_TAG for deduplication Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 8/9] selftests/bpf: add a test with a bpf program with btf_tag attributes Yonghong Song
2021-09-09  5:39   ` Andrii Nakryiko
2021-09-07 23:01 ` [PATCH bpf-next 9/9] docs/bpf: add documentation for BTF_KIND_TAG Yonghong Song
2021-09-09  5:42   ` Andrii Nakryiko
2021-09-10 16:40     ` Yonghong Song
2021-09-10 18:05       ` Andrii Nakryiko
2021-09-09 22:45 ` [PATCH bpf-next 0/9] bpf: add support for new btf kind BTF_KIND_TAG Jose E. Marchesi
2021-09-09 23:30   ` Yonghong Song
2021-09-10  2:19     ` Jose E. Marchesi
2021-09-10  7:04       ` Yonghong Song
2021-09-10  8:31         ` Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=665f0ad9-78ca-23cf-daf9-b2a8099f2ed8@fb.com \
    --to=yhs@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox