selftests/bpf: fix test_maps' use of bpf_map_create_opts
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/1 selftests/bpf: fix test_maps' use of bpf_map_create_opts
Use LIBBPF_OPTS() macro to properly initialize bpf_map_create_opts in test_maps' tests.
Signed-off-by Andrii Nakryiko <[email protected]>
--- .../bpf/map_tests/map_percpu_stats.c | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-)
tools/testing/selftests/bpf/map_tests/map_percpu_stats.c +5 -15
@@ -326,20 +326,14 @@ static int map_create(__u32 type, const char *name, struct bpf_map_create_opts *static int create_hash (void ) { -struct bpf_map_create_opts map_opts = { - .sz =sizeof (map_opts), - .map_flags =BPF_F_NO_PREALLOC , - }; + LIBBPF_OPTS(bpf_map_create_opts, map_opts, .map_flags = BPF_F_NO_PREALLOC);return map_create (BPF_MAP_TYPE_HASH ,"hash" , &map_opts); }static int create_percpu_hash (void ) { -struct bpf_map_create_opts map_opts = { - .sz =sizeof (map_opts), - .map_flags =BPF_F_NO_PREALLOC , - }; + LIBBPF_OPTS(bpf_map_create_opts, map_opts, .map_flags = BPF_F_NO_PREALLOC);return map_create (BPF_MAP_TYPE_PERCPU_HASH ,"percpu_hash" , &map_opts); }
@@ -356,21 +350,17 @@ static int create_percpu_hash_prealloc(void)static int create_lru_hash (__u32 type,__u32 map_flags) { -struct bpf_map_create_opts map_opts = { - .sz =sizeof (map_opts), - .map_flags = map_flags, - }; + LIBBPF_OPTS(bpf_map_create_opts, map_opts, .map_flags = map_flags);return map_create (type,"lru_hash" , &map_opts); }static int create_hash_of_maps (void ) { -struct bpf_map_create_opts map_opts = { - .sz =sizeof (map_opts), +LIBBPF_OPTS (bpf_map_create_opts, map_opts, .map_flags = BPF_F_NO_PREALLOC, .inner_map_fd = create_small_hash(), - }; + );int ret; ret = map_create_opts(BPF_MAP_TYPE_HASH_OF_MAPS, "hash_of_maps",
Signature · 1 line
2.34.1
Quoted 4 lines · Andrii Nakryiko
Use
LIBBPF_OPTS()macro to properly initializebpf_map_create_optsintest_maps' tests.Signed-off-by Andrii Nakryiko <[email protected]>
Acked-by Yonghong Song <[email protected]>
This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 7 lines · On Sat, 28 Oct 2023 18:15:09 -0700 you wrote:
Use
LIBBPF_OPTS()macro to properly initializebpf_map_create_optsintest_maps' tests.Signed-off-by Andrii Nakryiko <[email protected]>--- .../bpf/map_tests/map_percpu_stats.c | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-)
Here is the summary with links:
- [bpf-next] selftests/bpf: fix test_maps' use of bpf_map_create_opts
https://git.kernel.org/bpf/bpf/c/9af3775962af
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html