tools: bpftool: add JSON output for `bpftool prog dump jited *` command
authorQuentin Monnet <quentin.monnet@netronome.com>
Mon, 23 Oct 2017 16:24:09 +0000 (09:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Oct 2017 00:25:08 +0000 (01:25 +0100)
commit107f041212c1dfd3bf72b01c0d2013e98b6f32c2
tree37d4592e19f1de25f2c42a77bd4e8a1cf571eba8
parent743cc665d5f62d2c75eceb59c461e653ad6ea58c
tools: bpftool: add JSON output for `bpftool prog dump jited *` command

Reuse the json_writer API introduced in an earlier commit to make
bpftool able to generate JSON output on `bpftool prog show *` commands.
A new printing function is created to be passed as an argument to the
disassembler.

Similarly to plain output, opcodes are printed on request.

Outputs from sample programs have been successfully tested against a
JSON validator.

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>
tools/bpf/bpftool/jit_disasm.c