tools: bpftool: provide JSON output for all possible commands
As all commands can now return JSON output (possibly just a "null" value), output of `bpftool --json batch file FILE` should also be fully JSON compliant. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
9a5ab8bf1d
commit
004b45c0e5
@@ -602,11 +602,21 @@ err_free:
|
||||
|
||||
static int do_pin(int argc, char **argv)
|
||||
{
|
||||
return do_pin_any(argc, argv, bpf_prog_get_fd_by_id);
|
||||
int err;
|
||||
|
||||
err = do_pin_any(argc, argv, bpf_prog_get_fd_by_id);
|
||||
if (!err && json_output)
|
||||
jsonw_null(json_wtr);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int do_help(int argc, char **argv)
|
||||
{
|
||||
if (json_output) {
|
||||
jsonw_null(json_wtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"Usage: %s %s show [PROG]\n"
|
||||
" %s %s dump xlated PROG [{ file FILE | opcodes }]\n"
|
||||
|
||||
Reference in New Issue
Block a user