Commit 65b875bc authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Daniel Borkmann

tools: bpftool: rename cgroup list -> show in the code

So far we have used "show" as a keyword for listing
programs and maps.  Use the word "show" in the code
for cgroups too, next commit will alias show and list.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 5620e1a8
...@@ -41,7 +41,7 @@ static enum bpf_attach_type parse_attach_type(const char *str) ...@@ -41,7 +41,7 @@ static enum bpf_attach_type parse_attach_type(const char *str)
return __MAX_BPF_ATTACH_TYPE; return __MAX_BPF_ATTACH_TYPE;
} }
static int list_bpf_prog(int id, const char *attach_type_str, static int show_bpf_prog(int id, const char *attach_type_str,
const char *attach_flags_str) const char *attach_flags_str)
{ {
struct bpf_prog_info info = {}; struct bpf_prog_info info = {};
...@@ -77,7 +77,7 @@ static int list_bpf_prog(int id, const char *attach_type_str, ...@@ -77,7 +77,7 @@ static int list_bpf_prog(int id, const char *attach_type_str,
return 0; return 0;
} }
static int list_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type)
{ {
__u32 prog_ids[1024] = {0}; __u32 prog_ids[1024] = {0};
char *attach_flags_str; char *attach_flags_str;
...@@ -111,23 +111,23 @@ static int list_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type) ...@@ -111,23 +111,23 @@ static int list_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type)
} }
for (iter = 0; iter < prog_cnt; iter++) for (iter = 0; iter < prog_cnt; iter++)
list_bpf_prog(prog_ids[iter], attach_type_strings[type], show_bpf_prog(prog_ids[iter], attach_type_strings[type],
attach_flags_str); attach_flags_str);
return 0; return 0;
} }
static int do_list(int argc, char **argv) static int do_show(int argc, char **argv)
{ {
enum bpf_attach_type type; enum bpf_attach_type type;
int cgroup_fd; int cgroup_fd;
int ret = -1; int ret = -1;
if (argc < 1) { if (argc < 1) {
p_err("too few parameters for cgroup list\n"); p_err("too few parameters for cgroup show\n");
goto exit; goto exit;
} else if (argc > 1) { } else if (argc > 1) {
p_err("too many parameters for cgroup list\n"); p_err("too many parameters for cgroup show\n");
goto exit; goto exit;
} }
...@@ -147,10 +147,10 @@ static int do_list(int argc, char **argv) ...@@ -147,10 +147,10 @@ static int do_list(int argc, char **argv)
/* /*
* Not all attach types may be supported, so it's expected, * Not all attach types may be supported, so it's expected,
* that some requests will fail. * that some requests will fail.
* If we were able to get the list for at least one * If we were able to get the show for at least one
* attach type, let's return 0. * attach type, let's return 0.
*/ */
if (list_attached_bpf_progs(cgroup_fd, type) == 0) if (show_attached_bpf_progs(cgroup_fd, type) == 0)
ret = 0; ret = 0;
} }
...@@ -294,7 +294,7 @@ static int do_help(int argc, char **argv) ...@@ -294,7 +294,7 @@ static int do_help(int argc, char **argv)
} }
static const struct cmd cmds[] = { static const struct cmd cmds[] = {
{ "list", do_list }, { "list", do_show },
{ "attach", do_attach }, { "attach", do_attach },
{ "detach", do_detach }, { "detach", do_detach },
{ "help", do_help }, { "help", do_help },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment