All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins"
@ 2022-07-01  9:38 Quentin Monnet
  2022-07-02  6:24 ` Yonghong Song
  2022-07-05 10:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Quentin Monnet @ 2022-07-01  9:38 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, bpf, netdev, Quentin Monnet

To make it more explicit that the features listed with "bpftool feature
list" are known to bpftool, but not necessary available on the system
(as opposed to the probed features), rename the "feature list" command
into "feature list_builtins".

Note that "bpftool feature list" still works as before given that we
recognise arguments from their prefixes; but the real name of the
subcommand, in particular as displayed in the man page or the
interactive help, will now include "_builtins".

Since we update the bash completion accordingly, let's also take this
chance to redirect error output to /dev/null in the completion script,
to avoid displaying unexpected error messages when users attempt to
tab-complete.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
---
 tools/bpf/bpftool/Documentation/bpftool-feature.rst |  4 ++--
 tools/bpf/bpftool/bash-completion/bpftool           |  8 ++++----
 tools/bpf/bpftool/feature.c                         | 10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-feature.rst b/tools/bpf/bpftool/Documentation/bpftool-feature.rst
index c08064628d39..e44039f89be7 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-feature.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-feature.rst
@@ -24,7 +24,7 @@ FEATURE COMMANDS
 ================
 
 |	**bpftool** **feature probe** [*COMPONENT*] [**full**] [**unprivileged**] [**macros** [**prefix** *PREFIX*]]
-|	**bpftool** **feature list** *GROUP*
+|	**bpftool** **feature list_builtins** *GROUP*
 |	**bpftool** **feature help**
 |
 |	*COMPONENT* := { **kernel** | **dev** *NAME* }
@@ -72,7 +72,7 @@ DESCRIPTION
 		  The keywords **full**, **macros** and **prefix** have the
 		  same role as when probing the kernel.
 
-	**bpftool feature list** *GROUP*
+	**bpftool feature list_builtins** *GROUP*
 		  List items known to bpftool. These can be BPF program types
 		  (**prog_types**), BPF map types (**map_types**), attach types
 		  (**attach_types**), link types (**link_types**), or BPF helper
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index ee177f83b179..dc1641e3670e 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -703,7 +703,7 @@ _bpftool()
                             return 0
                             ;;
                         type)
-                            local BPFTOOL_MAP_CREATE_TYPES="$(bpftool feature list map_types | \
+                            local BPFTOOL_MAP_CREATE_TYPES="$(bpftool feature list_builtins map_types 2>/dev/null | \
                                 grep -v '^unspec$')"
                             COMPREPLY=( $( compgen -W "$BPFTOOL_MAP_CREATE_TYPES" -- "$cur" ) )
                             return 0
@@ -1032,7 +1032,7 @@ _bpftool()
                     return 0
                     ;;
                 attach|detach)
-                    local BPFTOOL_CGROUP_ATTACH_TYPES="$(bpftool feature list attach_types | \
+                    local BPFTOOL_CGROUP_ATTACH_TYPES="$(bpftool feature list_builtins attach_types 2>/dev/null | \
                         grep '^cgroup_')"
                     local ATTACH_FLAGS='multi override'
                     local PROG_TYPE='id pinned tag name'
@@ -1162,14 +1162,14 @@ _bpftool()
                     _bpftool_once_attr 'full unprivileged'
                     return 0
                     ;;
-                list)
+                list_builtins)
                     [[ $prev != "$command" ]] && return 0
                     COMPREPLY=( $( compgen -W 'prog_types map_types \
                         attach_types link_types helpers' -- "$cur" ) )
                     ;;
                 *)
                     [[ $prev == $object ]] && \
-                        COMPREPLY=( $( compgen -W 'help list probe' -- "$cur" ) )
+                        COMPREPLY=( $( compgen -W 'help list_builtins probe' -- "$cur" ) )
                     ;;
             esac
             ;;
diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
index 576cc6b90c6a..7ecabf7947fb 100644
--- a/tools/bpf/bpftool/feature.c
+++ b/tools/bpf/bpftool/feature.c
@@ -1266,7 +1266,7 @@ static const char *get_helper_name(unsigned int id)
 	return helper_name[id];
 }
 
-static int do_list(int argc, char **argv)
+static int do_list_builtins(int argc, char **argv)
 {
 	const char *(*get_name)(unsigned int id);
 	unsigned int id = 0;
@@ -1319,7 +1319,7 @@ static int do_help(int argc, char **argv)
 
 	fprintf(stderr,
 		"Usage: %1$s %2$s probe [COMPONENT] [full] [unprivileged] [macros [prefix PREFIX]]\n"
-		"       %1$s %2$s list GROUP\n"
+		"       %1$s %2$s list_builtins GROUP\n"
 		"       %1$s %2$s help\n"
 		"\n"
 		"       COMPONENT := { kernel | dev NAME }\n"
@@ -1332,9 +1332,9 @@ static int do_help(int argc, char **argv)
 }
 
 static const struct cmd cmds[] = {
-	{ "probe",	do_probe },
-	{ "list",	do_list },
-	{ "help",	do_help },
+	{ "probe",		do_probe },
+	{ "list_builtins",	do_list_builtins },
+	{ "help",		do_help },
 	{ 0 }
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins"
  2022-07-01  9:38 [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins" Quentin Monnet
@ 2022-07-02  6:24 ` Yonghong Song
  2022-07-05 10:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-07-02  6:24 UTC (permalink / raw)
  To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: Martin KaFai Lau, Song Liu, John Fastabend, KP Singh, bpf, netdev



On 7/1/22 2:38 AM, Quentin Monnet wrote:
> To make it more explicit that the features listed with "bpftool feature
> list" are known to bpftool, but not necessary available on the system
> (as opposed to the probed features), rename the "feature list" command
> into "feature list_builtins".
> 
> Note that "bpftool feature list" still works as before given that we
> recognise arguments from their prefixes; but the real name of the
> subcommand, in particular as displayed in the man page or the
> interactive help, will now include "_builtins".
> 
> Since we update the bash completion accordingly, let's also take this
> chance to redirect error output to /dev/null in the completion script,
> to avoid displaying unexpected error messages when users attempt to
> tab-complete.
> 
> Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Quentin Monnet <quentin@isovalent.com>

Acked-by: Yonghong Song <yhs@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins"
  2022-07-01  9:38 [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins" Quentin Monnet
  2022-07-02  6:24 ` Yonghong Song
@ 2022-07-05 10:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-05 10:00 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, bpf, netdev

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Fri,  1 Jul 2022 10:38:05 +0100 you wrote:
> To make it more explicit that the features listed with "bpftool feature
> list" are known to bpftool, but not necessary available on the system
> (as opposed to the probed features), rename the "feature list" command
> into "feature list_builtins".
> 
> Note that "bpftool feature list" still works as before given that we
> recognise arguments from their prefixes; but the real name of the
> subcommand, in particular as displayed in the man page or the
> interactive help, will now include "_builtins".
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins"
    https://git.kernel.org/bpf/bpf-next/c/990a6194f7e1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-05 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01  9:38 [PATCH bpf-next] bpftool: Rename "bpftool feature list" into "... feature list_builtins" Quentin Monnet
2022-07-02  6:24 ` Yonghong Song
2022-07-05 10:00 ` patchwork-bot+netdevbpf

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.