Skip to content

Commit

Permalink
bpf: Remove bpf_sys.h from selftests
Browse files Browse the repository at this point in the history
Add require dependency headers.

Signed-off-by: Mickaë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: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mickaël Salaün authored and David S. Miller committed Feb 10, 2017
1 parent f4874d0 commit 702498a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 34 deletions.
6 changes: 6 additions & 0 deletions tools/lib/bpf/bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ static __u64 ptr_to_u64(const void *ptr)
static int sys_bpf(enum bpf_cmd 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
}

int bpf_create_map(enum bpf_map_type map_type, int key_size,
Expand Down
27 changes: 0 additions & 27 deletions tools/testing/selftests/bpf/bpf_sys.h

This file was deleted.

1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/test_lpm_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <sys/resource.h>

#include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h"

struct tlpm_node {
Expand Down
1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/test_lru_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <sys/resource.h>

#include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h"

#define LOCAL_FREE_TARGET (128)
Expand Down
1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/test_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/bpf.h>

#include <bpf/bpf.h>
#include "bpf_sys.h"
#include "bpf_util.h"

static int map_flags;
Expand Down
3 changes: 1 addition & 2 deletions tools/testing/selftests/bpf/test_tag.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
Expand All @@ -20,8 +21,6 @@

#include "../../../include/linux/filter.h"

#include "bpf_sys.h"

static struct bpf_insn prog[BPF_MAXINSNS];

static void bpf_gen_imm_prog(unsigned int insns, int fd_map)
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/selftests/bpf/test_verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* License as published by the Free Software Foundation.
*/

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
Expand All @@ -28,8 +30,6 @@

#include "../../../include/linux/filter.h"

#include "bpf_sys.h"

#ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
Expand Down

0 comments on commit 702498a

Please sign in to comment.