OSDN Git Service

bpf: btf: add pretty print for hash/lru_hash maps
authorYonghong Song <yhs@fb.com>
Thu, 9 Aug 2018 15:55:20 +0000 (08:55 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Aug 2018 18:54:07 +0000 (20:54 +0200)
commit699c86d6ec21d0f885d12800249d138659de8489
treebb2bd8aa6de8cc79a8112954356e241b58dfb8b2
parentdc1508a579e682a1e5f1ed0753390e0aa7c23a97
bpf: btf: add pretty print for hash/lru_hash maps

Commit a26ca7c982cb ("bpf: btf: Add pretty print support to
the basic arraymap") added pretty print support to array map.
This patch adds pretty print for hash and lru_hash maps.
The following example shows the pretty-print result of
a pinned hashmap:

    struct map_value {
            int count_a;
            int count_b;
    };

    cat /sys/fs/bpf/pinned_hash_map:

    87907: {87907,87908}
    57354: {37354,57355}
    76625: {76625,76626}
    ...

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/hashtab.c