diff options
| author | Jiri Olsa <[email protected]> | 2024-06-26 13:47:19 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2024-06-27 00:08:43 +0000 |
| commit | a12978712d9001b060bcc10eaae42ad5102abe2b (patch) | |
| tree | f7cf650d7a7f376dbe77e64b7074670296a95006 /tools/testing/selftests/bpf/progs/bpf_misc.h | |
| parent | libbpf: Fix clang compilation error in btf_relocate.c (diff) | |
| download | kernel-a12978712d9001b060bcc10eaae42ad5102abe2b.tar.gz kernel-a12978712d9001b060bcc10eaae42ad5102abe2b.zip | |
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 <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Reviewed-by: Alan Maguire <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_misc.h')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/bpf_misc.h | 4 |
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 |
