linux/tools/bpf/bpftool
Yonghong Song ad3338d250 tools/bpf: bpftool: support prog array map and map of maps
Currently, prog array map and map of maps are not supported
in bpftool. This patch added the support.
Different from other map types, for prog array map and
map of maps, the key returned bpf_get_next_key() may not
point to a valid value. So for these two map types,
no error will be printed out when such a scenario happens.

The following is the plain and json dump if btf is not available:
  $ ./bpftool map dump id 10
    key: 08 00 00 00  value: 5c 01 00 00
    Found 1 element
  $ ./bpftool -jp map dump id 10
    [{
        "key": ["0x08","0x00","0x00","0x00"
        ],
        "value": ["0x5c","0x01","0x00","0x00"
        ]
    }]

If the BTF is available, the dump looks below:
  $ ./bpftool map dump id 2
    [{
            "key": 0,
            "value": 7
        }
    ]
  $ ./bpftool -jp map dump id 2
    [{
        "key": ["0x00","0x00","0x00","0x00"
        ],
        "value": ["0x07","0x00","0x00","0x00"
        ],
        "formatted": {
            "key": 0,
            "value": 7
        }
    }]

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-09-11 14:17:24 -07:00
..
bash-completion tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
Documentation tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
.gitignore tools/bpftool: ignore build products 2018-07-26 02:50:26 +02:00
btf_dumper.c bpf: btf: add btf print functionality 2018-07-14 13:00:40 +02:00
cfg.c tools: bpftool: generate .dot graph from CFG information 2018-03-01 18:29:49 -08:00
cfg.h tools: bpftool: detect sub-programs from the eBPF sequence 2018-03-01 18:29:48 -08:00
cgroup.c bpftool: introduce cgroup tree command 2018-07-07 01:38:38 +02:00
common.c Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net 2018-07-24 19:21:58 -07:00
jit_disasm.c tools: bpftool: improve architecture detection by using ifindex 2018-01-18 01:26:15 +01:00
json_writer.c tools: bpftool: add JSON output for bpftool prog dump xlated * command 2017-10-24 01:25:08 +01:00
json_writer.h tools: bpftool: add JSON output for bpftool prog dump xlated * command 2017-10-24 01:25:08 +01:00
main.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
main.h tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
Makefile tools: bpftool: don't pass FEATURES_DUMP to libbpf 2018-07-16 16:36:57 -07:00
map_perf_ring.c tools: bpftool: return from do_event_pipe() on bad arguments 2018-08-23 20:17:57 +02:00
map.c tools/bpf: bpftool: support prog array map and map of maps 2018-09-11 14:17:24 -07:00
net.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
netlink_dumper.c tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
netlink_dumper.h tools/bpf: bpftool: add net support 2018-09-06 22:34:08 -07:00
perf.c tools/bpftool: fix a bug in bpftool perf 2018-06-13 02:03:17 +02:00
prog.c tools: bpftool: allow reuse of maps with bpftool prog load 2018-07-11 22:13:34 +02:00
xlated_dumper.c tools: bpf: make use of reallocarray 2018-07-11 22:13:34 +02:00
xlated_dumper.h tools: bpftool: add delimiters to multi-function JITed dumps 2018-05-24 09:20:50 +02:00