aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-10-09 19:14:47 -0400
committerAlexei Starovoitov <ast@kernel.org>2018-10-10 01:03:28 -0400
commit438363c0feb831ac3f66646939b3833362750d94 (patch)
tree7776e0080e981ceab260e74dc80e8da0f604886b /tools/lib/bpf
parenta0f99e67969b372b9a2871c32fd97e2757021afe (diff)
tools/bpf: use proper type and uapi perf_event.h header for libbpf
Use __u32 instead u32 in libbpf.c and also use uapi perf_event.h instead of tools/perf/perf-sys.h. Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf')
-rw-r--r--tools/lib/bpf/Makefile2
-rw-r--r--tools/lib/bpf/libbpf.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 6ad27257fd67..79d84413ddf2 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -69,7 +69,7 @@ FEATURE_USER = .libbpf
69FEATURE_TESTS = libelf libelf-mmap bpf reallocarray 69FEATURE_TESTS = libelf libelf-mmap bpf reallocarray
70FEATURE_DISPLAY = libelf bpf 70FEATURE_DISPLAY = libelf bpf
71 71
72INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi -I$(srctree)/tools/perf 72INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
73FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) 73FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
74 74
75check_feat := 1 75check_feat := 1
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ceb918c14d80..176cf5523728 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -19,7 +19,6 @@
19#include <unistd.h> 19#include <unistd.h>
20#include <fcntl.h> 20#include <fcntl.h>
21#include <errno.h> 21#include <errno.h>
22#include <perf-sys.h>
23#include <asm/unistd.h> 22#include <asm/unistd.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -27,6 +26,7 @@
27#include <linux/btf.h> 26#include <linux/btf.h>
28#include <linux/list.h> 27#include <linux/list.h>
29#include <linux/limits.h> 28#include <linux/limits.h>
29#include <linux/perf_event.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/vfs.h> 32#include <sys/vfs.h>
@@ -169,7 +169,7 @@ static LIST_HEAD(bpf_objects_list);
169 169
170struct bpf_object { 170struct bpf_object {
171 char license[64]; 171 char license[64];
172 u32 kern_version; 172 __u32 kern_version;
173 173
174 struct bpf_program *programs; 174 struct bpf_program *programs;
175 size_t nr_programs; 175 size_t nr_programs;
@@ -540,7 +540,7 @@ static int
540bpf_object__init_kversion(struct bpf_object *obj, 540bpf_object__init_kversion(struct bpf_object *obj,
541 void *data, size_t size) 541 void *data, size_t size)
542{ 542{
543 u32 kver; 543 __u32 kver;
544 544
545 if (size != sizeof(kver)) { 545 if (size != sizeof(kver)) {
546 pr_warning("invalid kver section in %s\n", obj->path); 546 pr_warning("invalid kver section in %s\n", obj->path);
@@ -1295,7 +1295,7 @@ static int bpf_object__collect_reloc(struct bpf_object *obj)
1295static int 1295static int
1296load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type, 1296load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type,
1297 const char *name, struct bpf_insn *insns, int insns_cnt, 1297 const char *name, struct bpf_insn *insns, int insns_cnt,
1298 char *license, u32 kern_version, int *pfd, int prog_ifindex) 1298 char *license, __u32 kern_version, int *pfd, int prog_ifindex)
1299{ 1299{
1300 struct bpf_load_program_attr load_attr; 1300 struct bpf_load_program_attr load_attr;
1301 char *cp, errmsg[STRERR_BUFSIZE]; 1301 char *cp, errmsg[STRERR_BUFSIZE];