summaryrefslogtreecommitdiff
path: root/samples/bpf/test_map_in_map_user.c
diff options
context:
space:
mode:
authorLinkui Xiao <xiaolinkui@kylinos.cn>2022-07-12 15:23:02 +0800
committerAndrii Nakryiko <andrii@kernel.org>2022-07-13 21:43:52 -0700
commitb1fc28b338860b6c06a7a5881005a1ca9b108ba2 (patch)
tree4fc19e93557bd3e2b98f1768970f8fae7ad1ff8b /samples/bpf/test_map_in_map_user.c
parent8ab4cdcf03d0b060fbf73f76460f199bbd759ff7 (diff)
downloadlwn-b1fc28b338860b6c06a7a5881005a1ca9b108ba2.tar.gz
lwn-b1fc28b338860b6c06a7a5881005a1ca9b108ba2.zip
samples: bpf: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE
The ARRAY_SIZE macro is more compact and more formal in linux source. Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/bpf/20220712072302.13761-1-xiaolinkui@kylinos.cn
Diffstat (limited to 'samples/bpf/test_map_in_map_user.c')
-rw-r--r--samples/bpf/test_map_in_map_user.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/samples/bpf/test_map_in_map_user.c b/samples/bpf/test_map_in_map_user.c
index e8b4cc184ac9..652ec720533d 100644
--- a/samples/bpf/test_map_in_map_user.c
+++ b/samples/bpf/test_map_in_map_user.c
@@ -12,6 +12,8 @@
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
+#include "bpf_util.h"
+
static int map_fd[7];
#define PORT_A (map_fd[0])
@@ -28,7 +30,7 @@ static const char * const test_names[] = {
"Hash of Hash",
};
-#define NR_TESTS (sizeof(test_names) / sizeof(*test_names))
+#define NR_TESTS ARRAY_SIZE(test_names)
static void check_map_id(int inner_map_fd, int map_in_map_fd, uint32_t key)
{