veristat: avoid using kernel-internal headers
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 31 Mar 2023 22:24:04 +0000 (15:24 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 1 Apr 2023 16:05:57 +0000 (09:05 -0700)
Drop linux/compiler.h include, which seems to be needed for ARRAY_SIZE
macro only. Redefine own version of ARRAY_SIZE instead.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230331222405.3468634-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/veristat.c

index daac72b765082ca28edf0f1de43fc5ae4e38ec25..e592d05bccb2de66c974a0f79ec4fd55df3d4d62 100644 (file)
@@ -4,7 +4,6 @@
 #include <argp.h>
 #include <string.h>
 #include <stdlib.h>
-#include <linux/compiler.h>
 #include <sched.h>
 #include <pthread.h>
 #include <dirent.h>
 #include <gelf.h>
 #include <float.h>
 
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+#endif
+
 enum stat_id {
        VERDICT,
        DURATION,