Commit 702498a1 authored by Mickaël Salaün's avatar Mickaël Salaün Committed by David S. Miller

bpf: Remove bpf_sys.h from selftests

Add require dependency headers.
Signed-off-by: default avatarMickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4874d01
...@@ -50,7 +50,13 @@ static __u64 ptr_to_u64(const void *ptr) ...@@ -50,7 +50,13 @@ static __u64 ptr_to_u64(const void *ptr)
static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
unsigned int size) unsigned int size)
{ {
#ifdef __NR_bpf
return syscall(__NR_bpf, cmd, attr, size); return syscall(__NR_bpf, cmd, attr, size);
#else
fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
errno = ENOSYS;
return -1;
#endif
} }
int bpf_create_map(enum bpf_map_type map_type, int key_size, int bpf_create_map(enum bpf_map_type map_type, int key_size,
......
#ifndef __BPF_SYS__
#define __BPF_SYS__
#include <stdint.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <linux/bpf.h>
static inline __u64 bpf_ptr_to_u64(const void *ptr)
{
return (__u64)(unsigned long) ptr;
}
static inline int bpf(int cmd, union bpf_attr *attr, unsigned int size)
{
#ifdef __NR_bpf
return syscall(__NR_bpf, cmd, attr, size);
#else
fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
errno = ENOSYS;
return -1;
#endif
}
#endif /* __BPF_SYS__ */
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <bpf/bpf.h> #include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h" #include "bpf_util.h"
struct tlpm_node { struct tlpm_node {
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <bpf/bpf.h> #include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h" #include "bpf_util.h"
#define LOCAL_FREE_TARGET (128) #define LOCAL_FREE_TARGET (128)
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/bpf.h> #include <linux/bpf.h>
#include <bpf/bpf.h> #include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h" #include "bpf_util.h"
static int map_flags; static int map_flags;
......
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
...@@ -20,8 +21,6 @@ ...@@ -20,8 +21,6 @@
#include "../../../include/linux/filter.h" #include "../../../include/linux/filter.h"
#include "bpf_sys.h"
static struct bpf_insn prog[BPF_MAXINSNS]; static struct bpf_insn prog[BPF_MAXINSNS];
static void bpf_gen_imm_prog(unsigned int insns, int fd_map) static void bpf_gen_imm_prog(unsigned int insns, int fd_map)
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
* License as published by the Free Software Foundation. * License as published by the Free Software Foundation.
*/ */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
...@@ -28,8 +30,6 @@ ...@@ -28,8 +30,6 @@
#include "../../../include/linux/filter.h" #include "../../../include/linux/filter.h"
#include "bpf_sys.h"
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment