aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/bpf_misc.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2024-06-26 15:47:19 +0200
committerAndrii Nakryiko <andrii@kernel.org>2024-06-26 17:08:43 -0700
commita12978712d9001b060bcc10eaae42ad5102abe2b (patch)
treef7cf650d7a7f376dbe77e64b7074670296a95006 /tools/testing/selftests/bpf/progs/bpf_misc.h
parent0f31c2c61f6923747628c65a0fe36b2d4d7e21b0 (diff)
selftests/bpf: Move ARRAY_SIZE to bpf_misc.h
ARRAY_SIZE is used on multiple places, move its definition in bpf_misc.h header. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Link: https://lore.kernel.org/bpf/20240626134719.3893748-1-jolsa@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_misc.h')
-rw-r--r--tools/testing/selftests/bpf/progs/bpf_misc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index c0280bd2f340..81097a3f15eb 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -140,4 +140,8 @@
/* make it look to compiler like value is read and written */
#define __sink(expr) asm volatile("" : "+g"(expr))
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
#endif