tools: bpftool: Clean up function to dump map entry
authorQuentin Monnet <quentin@isovalent.com>
Thu, 10 Sep 2020 10:26:50 +0000 (11:26 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 11 Sep 2020 00:29:20 +0000 (17:29 -0700)
commita20693b6e72e59fb9b896193df0f8007693447d0
tree55052492ed2377c4545740ed5fb1cb035e3d1674
parent2f7de9865ba3cbfcf8b504f07154fdb6124176a4
tools: bpftool: Clean up function to dump map entry

The function used to dump a map entry in bpftool is a bit difficult to
follow, as a consequence to earlier refactorings. There is a variable
("num_elems") which does not appear to be necessary, and the error
handling would look cleaner if moved to its own function. Let's clean it
up. No functional change.

v2:
- v1 was erroneously removing the check on fd maps in an attempt to get
  support for outer map dumps. This is already working. Instead, v2
  focuses on cleaning up the dump_map_elem() function, to avoid
  similar confusion in the future.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200910102652.10509-2-quentin@isovalent.com
tools/bpf/bpftool/map.c