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>
This commit is contained in:

committed by
Daniel Borkmann

parent
8217ca653e
commit
aa5f0c96cc
@@ -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__ */
|
||||
|
Reference in New Issue
Block a user