diff options
author | Martin KaFai Lau <kafai@fb.com> | 2018-08-08 01:01:27 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-08-11 01:58:46 +0200 |
commit | aa5f0c96cc7b96a678779055b2ff4cd9dabd8ba7 (patch) | |
tree | 3f842ab7be06a1846f5332821006bf6d892ddedf /tools/testing/selftests/bpf/bpf_util.h | |
parent | 8217ca653ec601246832d562207bc24bdf652d2f (diff) |
bpf: Refactor ARRAY_SIZE macro to bpf_util.h
This patch refactors the ARRAY_SIZE macro to bpf_util.h.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_util.h')
-rw-r--r-- | tools/testing/selftests/bpf/bpf_util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/bpf_util.h b/tools/testing/selftests/bpf/bpf_util.h index d0811b3d6a6f..315a44fa32af 100644 --- a/tools/testing/selftests/bpf/bpf_util.h +++ b/tools/testing/selftests/bpf/bpf_util.h @@ -44,4 +44,8 @@ static inline unsigned int bpf_num_possible_cpus(void) name[bpf_num_possible_cpus()] #define bpf_percpu(name, cpu) name[(cpu)].v +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + #endif /* __BPF_UTIL__ */ |