diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-11-24 11:32:33 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-11-25 23:37:38 +0100 |
commit | 2fe256a429cb6c0b0064563af4158470143a363c (patch) | |
tree | 59fc62a6e425abbf850165d17b62b5e4d84b6414 /tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c | |
parent | 99a12a32fee4f740af2f36bb8f64e11c026f3389 (diff) | |
download | linux-stable-2fe256a429cb6c0b0064563af4158470143a363c.tar.gz linux-stable-2fe256a429cb6c0b0064563af4158470143a363c.tar.bz2 linux-stable-2fe256a429cb6c0b0064563af4158470143a363c.zip |
selftests/bpf: Migrate selftests to bpf_map_create()
Conversion is straightforward for most cases. In few cases tests are
using mutable map_flags and attribute structs, but bpf_map_create_opts
can be used in the similar fashion, so there were no problems. Just lots
of repetitive conversions.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211124193233.3115996-5-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c')
-rw-r--r-- | tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c index f4d870da7684..78c76496b14a 100644 --- a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c @@ -68,13 +68,6 @@ static void map_batch_verify(int *visited, __u32 max_entries, int *keys, static void __test_map_lookup_and_update_batch(bool is_pcpu) { - struct bpf_create_map_attr xattr = { - .name = "array_map", - .map_type = is_pcpu ? BPF_MAP_TYPE_PERCPU_ARRAY : - BPF_MAP_TYPE_ARRAY, - .key_size = sizeof(int), - .value_size = sizeof(__s64), - }; int map_fd, *keys, *visited; __u32 count, total, total_success; const __u32 max_entries = 10; @@ -86,10 +79,10 @@ static void __test_map_lookup_and_update_batch(bool is_pcpu) .flags = 0, ); - xattr.max_entries = max_entries; - map_fd = bpf_create_map_xattr(&xattr); + map_fd = bpf_map_create(is_pcpu ? BPF_MAP_TYPE_PERCPU_ARRAY : BPF_MAP_TYPE_ARRAY, + "array_map", sizeof(int), sizeof(__s64), max_entries, NULL); CHECK(map_fd == -1, - "bpf_create_map_xattr()", "error:%s\n", strerror(errno)); + "bpf_map_create()", "error:%s\n", strerror(errno)); value_size = sizeof(__s64); if (is_pcpu) |