Skip to content

Commit

Permalink
tools/bpf: use proper type and uapi perf_event.h header for libbpf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yonghong Song authored and Alexei Starovoitov committed Oct 10, 2018
1 parent a0f99e6 commit 438363c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tools/lib/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ FEATURE_USER = .libbpf
FEATURE_TESTS = libelf libelf-mmap bpf reallocarray
FEATURE_DISPLAY = libelf bpf

INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi -I$(srctree)/tools/perf
INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)

check_feat := 1
Expand Down
8 changes: 4 additions & 4 deletions tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <perf-sys.h>
#include <asm/unistd.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/bpf.h>
#include <linux/btf.h>
#include <linux/list.h>
#include <linux/limits.h>
#include <linux/perf_event.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/vfs.h>
Expand Down Expand Up @@ -169,7 +169,7 @@ static LIST_HEAD(bpf_objects_list);

struct bpf_object {
char license[64];
u32 kern_version;
__u32 kern_version;

struct bpf_program *programs;
size_t nr_programs;
Expand Down Expand Up @@ -540,7 +540,7 @@ static int
bpf_object__init_kversion(struct bpf_object *obj,
void *data, size_t size)
{
u32 kver;
__u32 kver;

if (size != sizeof(kver)) {
pr_warning("invalid kver section in %s\n", obj->path);
Expand Down Expand Up @@ -1295,7 +1295,7 @@ static int bpf_object__collect_reloc(struct bpf_object *obj)
static int
load_program(enum bpf_prog_type type, enum bpf_attach_type expected_attach_type,
const char *name, struct bpf_insn *insns, int insns_cnt,
char *license, u32 kern_version, int *pfd, int prog_ifindex)
char *license, __u32 kern_version, int *pfd, int prog_ifindex)
{
struct bpf_load_program_attr load_attr;
char *cp, errmsg[STRERR_BUFSIZE];
Expand Down

0 comments on commit 438363c

Please sign in to comment.