bpftool: Use print_entry_error() in case of ENOENT when dumping
authorBenjamin Poirier <bpoirier@suse.com>
Mon, 15 Apr 2019 07:15:35 +0000 (16:15 +0900)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 16 Apr 2019 08:16:33 +0000 (10:16 +0200)
commit0478c3bf812451315da6eeb79f8cf151db094767
treecfd4f4a5b2dbb7c21000fecba7ee568df87353f0
parent25df480def17eb792860d86b8f90fda00035f0f9
bpftool: Use print_entry_error() in case of ENOENT when dumping

Commit bf598a8f0f77 ("bpftool: Improve handling of ENOENT on map dumps")
used print_entry_plain() in case of ENOENT. However, that commit introduces
dead code. Per-cpu maps are zero-filled. When reading them, it's all or
nothing. There will never be a case where some cpus have an entry and
others don't.

The truth is that ENOENT is an error case. Use print_entry_error() to
output the desired message. That function's "value" parameter is also
renamed to indicate that we never use it for an actual map value.

The output format is unchanged.

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/bpf/bpftool/map.c