[PATCH bpf-next v4 1/2] bpftool: Add HELP_SPEC_OPTIONS in token.c
From: Tao Chen
Date: Thu Sep 18 2025 - 23:48:49 EST
$ ./bpftool token help
Usage: bpftool token { show | list }
bpftool token help
OPTIONS := { {-j|--json} [{-p|--pretty}] | {-d|--debug} }
Fixes: 2d812311c2b2 ("bpftool: Add bpf_token show")
Acked-by: Quentin Monnet <qmo@xxxxxxxxxx>
Signed-off-by: Tao Chen <chen.dylane@xxxxxxxxx>
---
tools/bpf/bpftool/token.c | 1 +
1 file changed, 1 insertion(+)
Change list:
v1 -> v2:
- strdup(mntent->mnt_opts) once per cmd/map/prog and
remove another strdrup/free in print_items_per_line
in patch2.(Alexei)
v1: https://lore.kernel.org/bpf/20250916054111.1151487-1-chen.dylane@xxxxxxxxx
v2 -> v3:
- Replace PRINT_DELEGATE_OPT* macros with functions.(Quentin)
v2: https://lore.kernel.org/bpf/20250917034732.1185429-2-chen.dylane@xxxxxxxxx
v3 -> v4:
- move the declaration of variable "i" to the top of
the function.(Quentin)
- move the declaration of "opts" and "value" inside of
the for loop.(Quentin)
v3: https://lore.kernel.org/bpf/20250918120908.1255263-1-chen.dylane@xxxxxxxxx
diff --git a/tools/bpf/bpftool/token.c b/tools/bpf/bpftool/token.c
index 6312e662a12..82b829e44c8 100644
--- a/tools/bpf/bpftool/token.c
+++ b/tools/bpf/bpftool/token.c
@@ -206,6 +206,7 @@ static int do_help(int argc, char **argv)
fprintf(stderr,
"Usage: %1$s %2$s { show | list }\n"
" %1$s %2$s help\n"
+ " " HELP_SPEC_OPTIONS " }\n"
"\n"
"",
bin_name, argv[-2]);
--
2.48.1