From: "Daniel Xu" <dxu@dxuuu.xyz>
To: "Martin KaFai Lau" <martin.lau@linux.dev>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
qmo@kernel.org, "John Fastabend" <john.fastabend@gmail.com>,
"David Miller" <davem@davemloft.net>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"Antony Antony" <antony@phenome.org>,
"Toke Høiland-Jørgensen" <toke@kernel.org>
Subject: Re: [PATCH bpf-next] bpftool: btf: Support dumping a single type from file
Date: Sat, 07 Dec 2024 15:15:34 -0800 [thread overview]
Message-ID: <7a5067a7-2a76-45d3-8995-87eff3e5996d@app.fastmail.com> (raw)
In-Reply-To: <8da87bf2-0084-4a47-b138-5dc380e7435e@linux.dev>
On Fri, Dec 6, 2024, at 5:50 PM, Martin KaFai Lau wrote:
> 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.
Good question. Passing an invalid btf ID results in half the
boilerplate being printed to terminal before an early exit and
an unclean return code.
Probably not be the best way to error. I'll send v2 with an
earlier error check.
Thanks,
Daniel
prev parent reply other threads:[~2024-12-07 23:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 23:29 Daniel Xu
2024-12-07 1:50 ` Martin KaFai Lau
2024-12-07 23:15 ` Daniel Xu [this message]
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=7a5067a7-2a76-45d3-8995-87eff3e5996d@app.fastmail.com \
--to=dxu@dxuuu.xyz \
--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=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=martin.lau@linux.dev \
--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
all inboxes | Powered by JetHome®