From: Tao Chen <chen.dylane@linux.dev>
To: Quentin Monnet <qmo@kernel.org>,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
jolsa@kernel.org, davem@davemloft.net, kuba@kernel.org,
hawk@kernel.org
Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 1/3] bpftool: Add bpf_token show
Date: Wed, 23 Jul 2025 18:55:07 +0800 [thread overview]
Message-ID: <393b7e0e-2240-49c5-9ff7-8efa07a11d3b@linux.dev> (raw)
In-Reply-To: <1dd1a433-ecdf-437d-bc71-6d1b65b74cc8@kernel.org>
在 2025/7/23 18:40, Quentin Monnet 写道:
> 2025-07-23 11:31 UTC+0800 ~ Tao Chen <chen.dylane@linux.dev>
>> Add `bpftool token show` command to get token info
>> from bpffs in /proc/mounts.
>>
>> Example plain output for `token show`:
>> token_info /sys/fs/bpf/token
>> allowed_cmds:
>> map_create prog_load
>> allowed_maps:
>> allowed_progs:
>> kprobe
>> allowed_attachs:
>> xdp
>> token_info /sys/fs/bpf/token2
>> allowed_cmds:
>> map_create prog_load
>> allowed_maps:
>> allowed_progs:
>> kprobe
>> allowed_attachs:
>> xdp
>>
>> Example json output for `token show`:
>> [{
>> "token_info": "/sys/fs/bpf/token",
>> "allowed_cmds": ["map_create", "prog_load"],
>> "allowed_maps": [],
>> "allowed_progs": ["kprobe"],
>> "allowed_attachs": ["xdp"]
>> }, {
>> "token_info": "/sys/fs/bpf/token2",
>> "allowed_cmds": ["map_create", "prog_load"],
>> "allowed_maps": [],
>> "allowed_progs": ["kprobe"],
>> "allowed_attachs": ["xdp"]
>> }]
>>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>
> [...]
>
>> diff --git a/tools/bpf/bpftool/token.c b/tools/bpf/bpftool/token.c
>> new file mode 100644
>> index 00000000000..06b56ea40b8
>> --- /dev/null
>> +++ b/tools/bpf/bpftool/token.c
>
> [...]
>
>> +static int do_help(int argc, char **argv)
>> +{
>> + if (json_output) {
>> + jsonw_null(json_wtr);
>> + return 0;
>> + }
>> +
>> + fprintf(stderr,
>> + "Usage: %1$s %2$s { show | list }\n"
>> + " %1$s %2$s help\n"
>
>
> One more nit: applying and testing the help message locally, I noticed
> that the alignement is not correct:
>
> $ ./bpftool token help
> Usage: bpftool token { show | list }
> bpftool token help
>
> The two "bpftool" should be aligned. This is because you use a tab for
> indent on the "help" line. Can you please replace it with spaces to fix
> indentation, and remain consistent with what other files do?
>
Thanks for your testing, i will fix it, thanks again.
> After that change, you can add:
>
> Reviewed-by: Quentin Monnet <qmo@kernel.org>
--
Best Regards
Tao Chen
prev parent reply other threads:[~2025-07-23 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 3:31 [PATCH bpf-next v3 1/3] bpftool: Add bpf_token show Tao Chen
2025-07-23 3:31 ` [PATCH bpf-next v3 2/3] bpftool: Add bpftool-token manpage Tao Chen
2025-07-23 10:39 ` Quentin Monnet
2025-07-23 3:31 ` [PATCH bpf-next v3 3/3] bpftool: Add bash completion for token argument Tao Chen
2025-07-23 10:40 ` [PATCH bpf-next v3 1/3] bpftool: Add bpf_token show Quentin Monnet
2025-07-23 10:50 ` Quentin Monnet
2025-07-23 10:55 ` Tao Chen [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=393b7e0e-2240-49c5-9ff7-8efa07a11d3b@linux.dev \
--to=chen.dylane@linux.dev \
--cc=andrii@kernel.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.