bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	John Fastabend <john.fastabend@gmail.com>
Cc: <bpf@vger.kernel.org>, Heiko Carstens <heiko.carstens@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>
Subject: Re: [PATCH v3 bpf-next 3/6] tools/bpftool: Add BTF_KIND_FLOAT support
Date: Sun, 21 Feb 2021 19:44:51 -0800	[thread overview]
Message-ID: <dacb8232-4dbe-37bc-80b8-7a069019f587@fb.com> (raw)
In-Reply-To: <20210220034959.27006-4-iii@linux.ibm.com>



On 2/19/21 7:49 PM, Ilya Leoshkevich wrote:
> Only dumping support needs to be adjusted, the code structure follows
> that of BTF_KIND_INT.

Maybe give an example to show what exactly the output looks like?

> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> > ---
>   tools/bpf/bpftool/btf.c        | 8 ++++++++
>   tools/bpf/bpftool/btf_dumper.c | 1 +
>   2 files changed, 9 insertions(+)
> 
> 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;
>   	}
> diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c
> index 0e9310727281..7ca54d046362 100644
> --- a/tools/bpf/bpftool/btf_dumper.c
> +++ b/tools/bpf/bpftool/btf_dumper.c
> @@ -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:
> 

  reply	other threads:[~2021-02-22  3:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-20  3:49 [PATCH v3 bpf-next 0/6] Add BTF_KIND_FLOAT support Ilya Leoshkevich
2021-02-20  3:49 ` [PATCH v3 bpf-next 1/6] bpf: Add BTF_KIND_FLOAT to uapi Ilya Leoshkevich
2021-02-22  3:42   ` Yonghong Song
2021-02-20  3:49 ` [PATCH v3 bpf-next 2/6] libbpf: Add BTF_KIND_FLOAT support Ilya Leoshkevich
2021-02-22  3:41   ` Yonghong Song
2021-02-20  3:49 ` [PATCH v3 bpf-next 3/6] tools/bpftool: " Ilya Leoshkevich
2021-02-22  3:44   ` Yonghong Song [this message]
2021-02-20  3:49 ` [PATCH v3 bpf-next 4/6] bpf: " Ilya Leoshkevich
2021-02-20  6:13   ` kernel test robot
2021-02-20  6:24   ` kernel test robot
2021-02-21 16:37   ` Ilya Leoshkevich
2021-02-20  3:49 ` [PATCH v3 bpf-next 5/6] selftest/bpf: Add BTF_KIND_FLOAT tests Ilya Leoshkevich
2021-02-22  3:53   ` Yonghong Song
2021-02-20  3:49 ` [PATCH v3 bpf-next 6/6] bpf: Document BTF_KIND_FLOAT in btf.rst Ilya Leoshkevich
2021-02-22  3:55   ` Yonghong Song

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=dacb8232-4dbe-37bc-80b8-7a069019f587@fb.com \
    --to=yhs@fb.com \
    --cc=acme@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=john.fastabend@gmail.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;
as well as URLs for NNTP newsgroup(s).