samples: bpf: Refactor BPF map in map test with libbpf
authorDaniel T. Lee <danieltimlee@gmail.com>
Tue, 7 Jul 2020 18:48:53 +0000 (03:48 +0900)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 7 Jul 2020 23:33:10 +0000 (01:33 +0200)
commit88795b4adb01a30fbfd75ef1c1ef73b4442e38b2
tree674e5c8c7fcac6d50e75fb5a185c5b0493eed7f7
parentaf9bd3e3331b8af42b6606c75797d041ab39380c
samples: bpf: Refactor BPF map in map test with libbpf

From commit 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map
support"), a way to define internal map in BTF-defined map has been
added.

Instead of using previous 'inner_map_idx' definition, the structure to
be used for the inner map can be directly defined using array directive.

    __array(values, struct inner_map)

This commit refactors map in map test program with libbpf by explicitly
defining inner map with BTF-defined format.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200707184855.30968-3-danieltimlee@gmail.com
samples/bpf/Makefile
samples/bpf/test_map_in_map_kern.c
samples/bpf/test_map_in_map_user.c