OSDN Git Service

bpftool: Return an error on prog dumps if both CFG and JSON are required
authorQuentin Monnet <quentin@isovalent.com>
Wed, 5 Apr 2023 13:21:17 +0000 (14:21 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 6 Apr 2023 04:27:27 +0000 (21:27 -0700)
commit05a06be722896e51f65dbbb6a3610f85a8353d6b
treee4fb1ce5ea872be023e7a1d04be49d68c6238f53
parent9fd496848b1c4cd04fee5f152bb7bcec11e1b901
bpftool: Return an error on prog dumps if both CFG and JSON are required

We do not support JSON output for control flow graphs of programs with
bpftool. So far, requiring both the CFG and JSON output would result in
producing a null JSON object. It makes more sense to raise an error
directly when parsing command line arguments and options, so that users
know they won't get any output they might expect.

If JSON is required for the graph, we leave it to Graphviz instead:

    # bpftool prog dump xlated <REF> visual | dot -Tjson

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20230405132120.59886-5-quentin@isovalent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/bash-completion/bpftool
tools/bpf/bpftool/prog.c