diff options
author | Yonghong Song <yhs@fb.com> | 2018-10-09 19:14:47 -0400 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-10-10 01:03:28 -0400 |
commit | 438363c0feb831ac3f66646939b3833362750d94 (patch) | |
tree | 7776e0080e981ceab260e74dc80e8da0f604886b /tools/lib/bpf | |
parent | a0f99e67969b372b9a2871c32fd97e2757021afe (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/Makefile | 2 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf.c | 8 |
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 | |||
69 | FEATURE_TESTS = libelf libelf-mmap bpf reallocarray | 69 | FEATURE_TESTS = libelf libelf-mmap bpf reallocarray |
70 | FEATURE_DISPLAY = libelf bpf | 70 | FEATURE_DISPLAY = libelf bpf |
71 | 71 | ||
72 | INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi -I$(srctree)/tools/perf | 72 | INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi |
73 | FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) | 73 | FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES) |
74 | 74 | ||
75 | check_feat := 1 | 75 | check_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 | ||
170 | struct bpf_object { | 170 | struct 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 | |||
540 | bpf_object__init_kversion(struct bpf_object *obj, | 540 | bpf_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) | |||
1295 | static int | 1295 | static int |
1296 | load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type, | 1296 | load_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]; |