linux/tools/bpf/bpftool
Stanislav Fomichev 04a5d323e6 bpftool: don't print empty key/value for maps
When doing dump or lookup, don't print key if key_size == 0 or value if
value_size == 0. The initial usecase is queue and stack, where we have
only values.

This is for regular output only, json still has all the fields.

Before:
bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
bpftool map lookup pinned /sys/fs/bpf/q
key:   value: 00 01 02 03

After:
bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
bpftool map lookup pinned /sys/fs/bpf/q
value: 00 01 02 03

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-01-17 10:30:31 +01:00
..
bash-completion tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
Documentation bpftool: make key optional in lookup command 2019-01-17 10:30:31 +01:00
.gitignore tools/bpftool: ignore build products 2018-07-26 02:50:26 +02:00
btf_dumper.c tools/bpf: support __int128 in bpftool map pretty dumper 2019-01-16 22:53:44 +01:00
cfg.c tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
common.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
jit_disasm.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
json_writer.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
json_writer.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
main.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
main.h tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
Makefile tools: bpftool: do not force gcc as CC 2018-12-19 21:57:25 +01:00
map_perf_ring.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
map.c bpftool: don't print empty key/value for maps 2019-01-17 10:30:31 +01:00
net.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
netlink_dumper.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
prog.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
tracelog.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
xlated_dumper.c tools: bpftool: fix -Wmissing declaration warnings 2018-12-15 01:31:49 +01:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00