tools, bpftool: Define prog_type_name array only once
Define prog_type_name in prog.c instead of main.h so it is only defined once. This leads to a slight decrease in the binary size of bpftool. Before: text data bss dec hex filename 401032 11936 1573160 1986128 1e4e50 bpftool After: text data bss dec hex filename 399024 11168 1573160 1983352 1e4378 bpftool Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/bpf/20200624143124.12914-1-tklauser@distanz.ch
This commit is contained in:

committed by
Daniel Borkmann

parent
74765da176
commit
9023497d87
@@ -473,7 +473,7 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
|
||||
if (owner_prog_type) {
|
||||
unsigned int prog_type = atoi(owner_prog_type);
|
||||
|
||||
if (prog_type < ARRAY_SIZE(prog_type_name))
|
||||
if (prog_type < prog_type_name_size)
|
||||
jsonw_string_field(json_wtr, "owner_prog_type",
|
||||
prog_type_name[prog_type]);
|
||||
else
|
||||
@@ -558,7 +558,7 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
|
||||
if (owner_prog_type) {
|
||||
unsigned int prog_type = atoi(owner_prog_type);
|
||||
|
||||
if (prog_type < ARRAY_SIZE(prog_type_name))
|
||||
if (prog_type < prog_type_name_size)
|
||||
printf("owner_prog_type %s ",
|
||||
prog_type_name[prog_type]);
|
||||
else
|
||||
|
Reference in New Issue
Block a user