alistair23-linux/tools
Okash Khawaja 2d3feca8c4 bpf: btf: print map dump and lookup with btf info
This patch augments the output of bpftool's map dump and map lookup
commands to print data along side btf info, if the correspondin btf
info is available. The outputs for each of  map dump and map lookup
commands are augmented in two ways:

1. when neither of -j and -p are supplied, btf-ful map data is printed
whose aim is human readability. This means no commitments for json- or
backward- compatibility.

2. when either -j or -p are supplied, a new json object named
"formatted" is added for each key-value pair. This object contains the
same data as the key-value pair, but with btf info. "formatted" object
promises json- and backward- compatibility. Below is a sample output.

$ bpftool map dump -p id 8
[{
        "key": ["0x0f","0x00","0x00","0x00"
        ],
        "value": ["0x03", "0x00", "0x00", "0x00", ...
        ],
        "formatted": {
                "key": 15,
                "value": {
                        "int_field":  3,
                        ...
                }
        }
}
]

This patch calls btf_dumper introduced in previous patch to accomplish
the above. Indeed, btf-ful info is only displayed if btf data for the
given map is available. Otherwise existing output is displayed as-is.

Signed-off-by: Okash Khawaja <osk@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-07-14 13:00:40 +02:00
..
accounting
arch tools/headers: Pick up latest kernel ABIs 2018-06-26 08:43:14 +02:00
bpf bpf: btf: print map dump and lookup with btf info 2018-07-14 13:00:40 +02:00
build tools: include reallocarray feature test in FEATURE_TESTS_BASIC 2018-07-14 10:38:48 +02:00
cgroup
firewire
gpio
hv
iio
include tools: bpf: synchronise BPF UAPI header with tools 2018-07-12 18:55:53 +02:00
kvm/kvm_stat
laptop
leds
lib bpf: btf: export btf types and name by offset from lib 2018-07-14 13:00:40 +02:00
memory-model
nfsd
objtool objtool: Add machine_real_restart() to the noreturn list 2018-06-20 02:10:37 +02:00
pci
pcmcia
perf perf/urgent fixes: 2018-06-26 08:37:57 +02:00
power Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux 2018-06-21 00:37:04 +02:00
scripts
spi
testing selftests/bpf: add test for multiple programs 2018-07-13 20:26:35 +02:00
thermal/tmon
time
usb
virtio sg: remove ->sg_magic member 2018-06-29 08:48:06 -06:00
vm mm: mark pages in use for page tables 2018-06-07 17:34:37 -07:00
wmi
Makefile