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

Reuse the json_writer API introduced in an earlier commit to make
bpftool able to generate JSON output on `bpftool prog show *` commands.

For readability, the code from show_prog() has been split into two
functions, one for plain output, one for JSON.

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/prog.c