aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
diff options
context:
space:
mode:
authorJiri Olsa <[email protected]>2024-06-26 13:47:19 +0000
committerAndrii Nakryiko <[email protected]>2024-06-27 00:08:43 +0000
commita12978712d9001b060bcc10eaae42ad5102abe2b (patch)
treef7cf650d7a7f376dbe77e64b7074670296a95006 /tools/testing/selftests/bpf/progs/test_sysctl_prog.c
parentlibbpf: Fix clang compilation error in btf_relocate.c (diff)
downloadkernel-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/test_sysctl_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_sysctl_prog.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_sysctl_prog.c b/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
index efc3c61f7852..bbdd08764789 100644
--- a/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
+++ b/tools/testing/selftests/bpf/progs/test_sysctl_prog.c
@@ -10,6 +10,7 @@
#include <bpf/bpf_helpers.h>
#include "bpf_compiler.h"
+#include "bpf_misc.h"
/* Max supported length of a string with unsigned long in base 10 (pow2 - 1). */
#define MAX_ULONG_STR_LEN 0xF
@@ -17,10 +18,6 @@
/* Max supported length of sysctl value string (pow2). */
#define MAX_VALUE_STR_LEN 0x40
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#endif
-
const char tcp_mem_name[] = "net/ipv4/tcp_mem";
static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx)
{