diff options
author | 2022-01-07 16:42:17 -0800 | |
---|---|---|
committer | 2022-01-12 17:01:38 -0800 | |
commit | 8d6fabf1654a8c26e4e081d0b934285d6d8868cb (patch) | |
tree | a9ba6d75c623a1e0d31dc0b395405dc2164c8e16 /tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | |
parent | perf: Stop using bpf_map__def() API (diff) | |
download | linux-8d6fabf1654a8c26e4e081d0b934285d6d8868cb.tar.gz linux-8d6fabf1654a8c26e4e081d0b934285d6d8868cb.tar.bz2 linux-8d6fabf1654a8c26e4e081d0b934285d6d8868cb.zip |
selftests/bpf: Stop using bpf_map__def() API
libbpf bpf_map__def() API is being deprecated, replace selftests/bpf's
usage with the appropriate getters and setters.
Signed-off-by: Christy Lee <christylee@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220108004218.355761-5-christylee@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sockmap_listen.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c index 7e21bfab6358..2cf0c7a3fe23 100644 --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c @@ -1413,14 +1413,12 @@ close_srv1: static void test_ops_cleanup(const struct bpf_map *map) { - const struct bpf_map_def *def; int err, mapfd; u32 key; - def = bpf_map__def(map); mapfd = bpf_map__fd(map); - for (key = 0; key < def->max_entries; key++) { + for (key = 0; key < bpf_map__max_entries(map); key++) { err = bpf_map_delete_elem(mapfd, &key); if (err && errno != EINVAL && errno != ENOENT) FAIL_ERRNO("map_delete: expected EINVAL/ENOENT"); @@ -1443,13 +1441,13 @@ static const char *family_str(sa_family_t family) static const char *map_type_str(const struct bpf_map *map) { - const struct bpf_map_def *def; + int type; - def = bpf_map__def(map); - if (IS_ERR(def)) + if (!map) return "invalid"; + type = bpf_map__type(map); - switch (def->type) { + switch (type) { case BPF_MAP_TYPE_SOCKMAP: return "sockmap"; case BPF_MAP_TYPE_SOCKHASH: |