From: Martin KaFai Lau <martin.lau@linux.dev>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: ast@kernel.org, kuba@kernel.org, andrii@kernel.org,
hawk@kernel.org, qmo@kernel.org, john.fastabend@gmail.com,
davem@davemloft.net, daniel@iogearbox.net, eddyz87@gmail.com,
song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org,
sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, antony@phenome.org, toke@kernel.org
Subject: Re: [PATCH bpf-next] bpftool: btf: Support dumping a single type from file
Date: Fri, 6 Dec 2024 17:50:51 -0800 [thread overview]
Message-ID: <8da87bf2-0084-4a47-b138-5dc380e7435e@linux.dev> (raw)
In-Reply-To: <8ae2c1261be36f7594a7ba0ac2d1e0eeb10b457d.1733527691.git.dxu@dxuuu.xyz>
On 12/6/24 3:29 PM, Daniel Xu wrote:
> diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
> index d005e4fd6128..668ff0d10469 100644
> --- a/tools/bpf/bpftool/btf.c
> +++ b/tools/bpf/bpftool/btf.c
> @@ -953,6 +953,7 @@ static int do_dump(int argc, char **argv)
> NEXT_ARG();
> } else if (is_prefix(src, "file")) {
> const char sysfs_prefix[] = "/sys/kernel/btf/";
> + char *end;
>
> if (!base_btf &&
> strncmp(*argv, sysfs_prefix, sizeof(sysfs_prefix) - 1) == 0 &&
> @@ -967,6 +968,17 @@ static int do_dump(int argc, char **argv)
> goto done;
> }
> NEXT_ARG();
> +
> + if (argc && is_prefix(*argv, "root_id")) {
> + NEXT_ARG();
> + root_type_ids[root_type_cnt++] = strtoul(*argv, &end, 0);
I only looked at the do_dump(). Other existing root_type_ids are from the kernel
map_get_info and they should be valid. I haven't looked at the dump_btf_*, so
ask a lazy question, is an invalid root_id handled properly?
Others lgtm.
> + if (*end) {
> + err = -1;
> + p_err("can't parse %s as root ID", *argv);
> + goto done;
> + }
> + NEXT_ARG();
> + }
> } else {
> err = -1;
> p_err("unrecognized BTF source specifier: '%s'", src);
next prev parent reply other threads:[~2024-12-07 1:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 23:29 [PATCH bpf-next] bpftool: btf: Support dumping a single type from file Daniel Xu
2024-12-07 1:50 ` Martin KaFai Lau [this message]
2024-12-07 23:15 ` Daniel Xu
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=8da87bf2-0084-4a47-b138-5dc380e7435e@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=antony@phenome.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dxu@dxuuu.xyz \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=toke@kernel.org \
--cc=yonghong.song@linux.dev \
/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