diff options
author | Evgeniy Litvinenko <evgeniyl@fb.com> | 2021-07-23 15:15:11 -0700 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-07-23 16:57:03 -0700 |
commit | e244d34d0ea1aebf60e83ee6d1701a81448f31c1 (patch) | |
tree | 375629c2a1def9dca3b26ed13566e6b4bfca8a01 /tools/testing/selftests/bpf/prog_tests/pinning.c | |
parent | d9e8d14b12202504bfa04182d3fae68d137ea39b (diff) | |
download | linux-e244d34d0ea1aebf60e83ee6d1701a81448f31c1.tar.gz linux-e244d34d0ea1aebf60e83ee6d1701a81448f31c1.tar.bz2 linux-e244d34d0ea1aebf60e83ee6d1701a81448f31c1.zip |
libbpf: Add bpf_map__pin_path function
Add bpf_map__pin_path, so that the inconsistently named
bpf_map__get_pin_path can be deprecated later. This is part of the
effort towards libbpf v1.0: https://github.com/libbpf/libbpf/issues/307
Also, add a selftest for the new function.
Signed-off-by: Evgeniy Litvinenko <evgeniyl@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210723221511.803683-1-evgeniyl@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/pinning.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/pinning.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/pinning.c b/tools/testing/selftests/bpf/prog_tests/pinning.c index fcf54b3a1dd0..d4b953ae3407 100644 --- a/tools/testing/selftests/bpf/prog_tests/pinning.c +++ b/tools/testing/selftests/bpf/prog_tests/pinning.c @@ -125,6 +125,10 @@ void test_pinning(void) if (CHECK(err, "pin maps", "err %d errno %d\n", err, errno)) goto out; + /* get pinning path */ + if (!ASSERT_STREQ(bpf_map__pin_path(map), pinpath, "get pin path")) + goto out; + /* set pinning path of other map and re-pin all */ map = bpf_object__find_map_by_name(obj, "nopinmap"); if (CHECK(!map, "find map", "NULL map")) @@ -134,6 +138,11 @@ void test_pinning(void) if (CHECK(err, "set pin path", "err %d errno %d\n", err, errno)) goto out; + /* get pinning path after set */ + if (!ASSERT_STREQ(bpf_map__pin_path(map), custpinpath, + "get pin path after set")) + goto out; + /* should only pin the one unpinned map */ err = bpf_object__pin_maps(obj, NULL); if (CHECK(err, "pin maps", "err %d errno %d\n", err, errno)) |