mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 15:47:39 +07:00
tools, bpftool: Clean subcommand help messages
This is a clean-up for the formatting of the do_help functions for bpftool's subcommands. The following fixes are included: - Do not use argv[-2] for "iter" help message, as the help is shown by default if no "iter" action is selected, resulting in messages looking like "./bpftool bpftool pin...". - Do not print unused HELP_SPEC_PROGRAM in help message for "bpftool link". - Andrii used argument indexing to avoid having multiple occurrences of bin_name and argv[-2] in the fprintf() for the help message, for "bpftool gen" and "bpftool link". Let's reuse this for all other help functions. We can remove up to thirty arguments for the "bpftool map" help message. - Harmonise all functions, e.g. use ending quotes-comma on a separate line. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200523010751.23465-1-quentin@isovalent.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
eae9d3c016
commit
90040351a8
@ -951,9 +951,9 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s btf { show | list } [id BTF_ID]\n"
|
||||
" %s btf dump BTF_SRC [format FORMAT]\n"
|
||||
" %s btf help\n"
|
||||
"Usage: %1$s %2$s { show | list } [id BTF_ID]\n"
|
||||
" %1$s %2$s dump BTF_SRC [format FORMAT]\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" BTF_SRC := { id BTF_ID | prog PROG | map MAP [{key | value | kv | all}] | file FILE }\n"
|
||||
" FORMAT := { raw | c }\n"
|
||||
@ -961,7 +961,7 @@ static int do_help(int argc, char **argv)
|
||||
" " HELP_SPEC_PROGRAM "\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name, bin_name, bin_name);
|
||||
bin_name, "btf");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -491,20 +491,18 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list } CGROUP [**effective**]\n"
|
||||
" %s %s tree [CGROUP_ROOT] [**effective**]\n"
|
||||
" %s %s attach CGROUP ATTACH_TYPE PROG [ATTACH_FLAGS]\n"
|
||||
" %s %s detach CGROUP ATTACH_TYPE PROG\n"
|
||||
" %s %s help\n"
|
||||
"Usage: %1$s %2$s { show | list } CGROUP [**effective**]\n"
|
||||
" %1$s %2$s tree [CGROUP_ROOT] [**effective**]\n"
|
||||
" %1$s %2$s attach CGROUP ATTACH_TYPE PROG [ATTACH_FLAGS]\n"
|
||||
" %1$s %2$s detach CGROUP ATTACH_TYPE PROG\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
HELP_SPEC_ATTACH_TYPES "\n"
|
||||
" " HELP_SPEC_ATTACH_FLAGS "\n"
|
||||
" " HELP_SPEC_PROGRAM "\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2]);
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -937,12 +937,12 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s probe [COMPONENT] [full] [unprivileged] [macros [prefix PREFIX]]\n"
|
||||
" %s %s help\n"
|
||||
"Usage: %1$s %2$s probe [COMPONENT] [full] [unprivileged] [macros [prefix PREFIX]]\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" COMPONENT := { kernel | dev NAME }\n"
|
||||
"",
|
||||
bin_name, argv[-2], bin_name, argv[-2]);
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -586,12 +586,12 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %1$s gen skeleton FILE\n"
|
||||
" %1$s gen help\n"
|
||||
"Usage: %1$s %2$s skeleton FILE\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name);
|
||||
bin_name, "gen");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ static int do_pin(int argc, char **argv)
|
||||
static int do_help(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s pin OBJ PATH\n"
|
||||
" %s %s help\n"
|
||||
"\n",
|
||||
bin_name, argv[-2], bin_name, argv[-2]);
|
||||
"Usage: %1$s %2$s pin OBJ PATH\n"
|
||||
" %1$s %2$s help\n"
|
||||
"",
|
||||
bin_name, "iter");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -312,7 +312,6 @@ static int do_help(int argc, char **argv)
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" " HELP_SPEC_LINK "\n"
|
||||
" " HELP_SPEC_PROGRAM "\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name, argv[-2]);
|
||||
|
@ -1561,24 +1561,24 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list } [MAP]\n"
|
||||
" %s %s create FILE type TYPE key KEY_SIZE value VALUE_SIZE \\\n"
|
||||
" entries MAX_ENTRIES name NAME [flags FLAGS] \\\n"
|
||||
" [dev NAME]\n"
|
||||
" %s %s dump MAP\n"
|
||||
" %s %s update MAP [key DATA] [value VALUE] [UPDATE_FLAGS]\n"
|
||||
" %s %s lookup MAP [key DATA]\n"
|
||||
" %s %s getnext MAP [key DATA]\n"
|
||||
" %s %s delete MAP key DATA\n"
|
||||
" %s %s pin MAP FILE\n"
|
||||
" %s %s event_pipe MAP [cpu N index M]\n"
|
||||
" %s %s peek MAP\n"
|
||||
" %s %s push MAP value VALUE\n"
|
||||
" %s %s pop MAP\n"
|
||||
" %s %s enqueue MAP value VALUE\n"
|
||||
" %s %s dequeue MAP\n"
|
||||
" %s %s freeze MAP\n"
|
||||
" %s %s help\n"
|
||||
"Usage: %1$s %2$s { show | list } [MAP]\n"
|
||||
" %1$s %2$s create FILE type TYPE key KEY_SIZE value VALUE_SIZE \\\n"
|
||||
" entries MAX_ENTRIES name NAME [flags FLAGS] \\\n"
|
||||
" [dev NAME]\n"
|
||||
" %1$s %2$s dump MAP\n"
|
||||
" %1$s %2$s update MAP [key DATA] [value VALUE] [UPDATE_FLAGS]\n"
|
||||
" %1$s %2$s lookup MAP [key DATA]\n"
|
||||
" %1$s %2$s getnext MAP [key DATA]\n"
|
||||
" %1$s %2$s delete MAP key DATA\n"
|
||||
" %1$s %2$s pin MAP FILE\n"
|
||||
" %1$s %2$s event_pipe MAP [cpu N index M]\n"
|
||||
" %1$s %2$s peek MAP\n"
|
||||
" %1$s %2$s push MAP value VALUE\n"
|
||||
" %1$s %2$s pop MAP\n"
|
||||
" %1$s %2$s enqueue MAP value VALUE\n"
|
||||
" %1$s %2$s dequeue MAP\n"
|
||||
" %1$s %2$s freeze MAP\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" " HELP_SPEC_MAP "\n"
|
||||
" DATA := { [hex] BYTES }\n"
|
||||
@ -1593,11 +1593,6 @@ static int do_help(int argc, char **argv)
|
||||
" queue | stack | sk_storage | struct_ops }\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
|
@ -458,10 +458,10 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list } [dev <devname>]\n"
|
||||
" %s %s attach ATTACH_TYPE PROG dev <devname> [ overwrite ]\n"
|
||||
" %s %s detach ATTACH_TYPE dev <devname>\n"
|
||||
" %s %s help\n"
|
||||
"Usage: %1$s %2$s { show | list } [dev <devname>]\n"
|
||||
" %1$s %2$s attach ATTACH_TYPE PROG dev <devname> [ overwrite ]\n"
|
||||
" %1$s %2$s detach ATTACH_TYPE dev <devname>\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" " HELP_SPEC_PROGRAM "\n"
|
||||
" ATTACH_TYPE := { xdp | xdpgeneric | xdpdrv | xdpoffload }\n"
|
||||
@ -470,8 +470,8 @@ static int do_help(int argc, char **argv)
|
||||
" For progs attached to cgroups, use \"bpftool cgroup\"\n"
|
||||
" to dump program attachments. For program types\n"
|
||||
" sk_{filter,skb,msg,reuseport} and lwt/seg6, please\n"
|
||||
" consult iproute2.\n",
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
" consult iproute2.\n"
|
||||
"",
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
|
@ -231,7 +231,7 @@ static int do_show(int argc, char **argv)
|
||||
static int do_help(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list | help }\n"
|
||||
"Usage: %1$s %2$s { show | list | help }\n"
|
||||
"",
|
||||
bin_name, argv[-2]);
|
||||
|
||||
|
@ -1984,24 +1984,24 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list } [PROG]\n"
|
||||
" %s %s dump xlated PROG [{ file FILE | opcodes | visual | linum }]\n"
|
||||
" %s %s dump jited PROG [{ file FILE | opcodes | linum }]\n"
|
||||
" %s %s pin PROG FILE\n"
|
||||
" %s %s { load | loadall } OBJ PATH \\\n"
|
||||
"Usage: %1$s %2$s { show | list } [PROG]\n"
|
||||
" %1$s %2$s dump xlated PROG [{ file FILE | opcodes | visual | linum }]\n"
|
||||
" %1$s %2$s dump jited PROG [{ file FILE | opcodes | linum }]\n"
|
||||
" %1$s %2$s pin PROG FILE\n"
|
||||
" %1$s %2$s { load | loadall } OBJ PATH \\\n"
|
||||
" [type TYPE] [dev NAME] \\\n"
|
||||
" [map { idx IDX | name NAME } MAP]\\\n"
|
||||
" [pinmaps MAP_DIR]\n"
|
||||
" %s %s attach PROG ATTACH_TYPE [MAP]\n"
|
||||
" %s %s detach PROG ATTACH_TYPE [MAP]\n"
|
||||
" %s %s run PROG \\\n"
|
||||
" %1$s %2$s attach PROG ATTACH_TYPE [MAP]\n"
|
||||
" %1$s %2$s detach PROG ATTACH_TYPE [MAP]\n"
|
||||
" %1$s %2$s run PROG \\\n"
|
||||
" data_in FILE \\\n"
|
||||
" [data_out FILE [data_size_out L]] \\\n"
|
||||
" [ctx_in FILE [ctx_out FILE [ctx_size_out M]]] \\\n"
|
||||
" [repeat N]\n"
|
||||
" %s %s profile PROG [duration DURATION] METRICs\n"
|
||||
" %s %s tracelog\n"
|
||||
" %s %s help\n"
|
||||
" %1$s %2$s profile PROG [duration DURATION] METRICs\n"
|
||||
" %1$s %2$s tracelog\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" " HELP_SPEC_MAP "\n"
|
||||
" " HELP_SPEC_PROGRAM "\n"
|
||||
@ -2022,10 +2022,7 @@ static int do_help(int argc, char **argv)
|
||||
" METRIC := { cycles | instructions | l1d_loads | llc_misses }\n"
|
||||
" " HELP_SPEC_OPTIONS "\n"
|
||||
"",
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2]);
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -566,16 +566,15 @@ static int do_help(int argc, char **argv)
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s { show | list } [STRUCT_OPS_MAP]\n"
|
||||
" %s %s dump [STRUCT_OPS_MAP]\n"
|
||||
" %s %s register OBJ\n"
|
||||
" %s %s unregister STRUCT_OPS_MAP\n"
|
||||
" %s %s help\n"
|
||||
"Usage: %1$s %2$s { show | list } [STRUCT_OPS_MAP]\n"
|
||||
" %1$s %2$s dump [STRUCT_OPS_MAP]\n"
|
||||
" %1$s %2$s register OBJ\n"
|
||||
" %1$s %2$s unregister STRUCT_OPS_MAP\n"
|
||||
" %1$s %2$s help\n"
|
||||
"\n"
|
||||
" OPTIONS := { {-j|--json} [{-p|--pretty}] }\n"
|
||||
" STRUCT_OPS_MAP := [ id STRUCT_OPS_MAP_ID | name STRUCT_OPS_MAP_NAME ]\n",
|
||||
bin_name, argv[-2], bin_name, argv[-2],
|
||||
bin_name, argv[-2], bin_name, argv[-2],
|
||||
" STRUCT_OPS_MAP := [ id STRUCT_OPS_MAP_ID | name STRUCT_OPS_MAP_NAME ]\n"
|
||||
"",
|
||||
bin_name, argv[-2]);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user