mirror of https://gitee.com/openkylin/linux.git
bpftool: Use consistent include paths for libbpf
Fix bpftool to include libbpf header files with the bpf/ prefix, to be
consistent with external users of the library. Also ensure that all
includes of exported libbpf header files (those that are exported on 'make
install' of the library) use bracketed includes instead of quoted.
To make sure no new files are introduced that doesn't include the bpf/
prefix in its include, remove tools/lib/bpf from the include path entirely,
and use tools/lib instead.
Fixes: 6910d7d386
("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/157952560684.1683545.4765181397974997027.stgit@toke.dk
This commit is contained in:
parent
3e689141e6
commit
229c3b47b7
|
@ -196,7 +196,7 @@ and global variables.
|
|||
#define __EXAMPLE_SKEL_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
|
||||
struct example {
|
||||
struct bpf_object_skeleton *skeleton;
|
||||
|
|
|
@ -45,7 +45,7 @@ CFLAGS += -DPACKAGE='"bpftool"' -D__EXPORTED_HEADERS__ \
|
|||
-I$(srctree)/kernel/bpf/ \
|
||||
-I$(srctree)/tools/include \
|
||||
-I$(srctree)/tools/include/uapi \
|
||||
-I$(srctree)/tools/lib/bpf \
|
||||
-I$(srctree)/tools/lib \
|
||||
-I$(srctree)/tools/perf
|
||||
CFLAGS += -DBPFTOOL_VERSION='"$(BPFTOOL_VERSION)"'
|
||||
ifneq ($(EXTRA_CFLAGS),)
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <bpf.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/btf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <linux/btf.h>
|
||||
#include <linux/hashtable.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "btf.h"
|
||||
#include "json_writer.h"
|
||||
#include "main.h"
|
||||
|
||||
|
@ -532,7 +532,7 @@ static int do_dump(int argc, char **argv)
|
|||
if (IS_ERR(btf)) {
|
||||
err = PTR_ERR(btf);
|
||||
btf = NULL;
|
||||
p_err("failed to load BTF from %s: %s",
|
||||
p_err("failed to load BTF from %s: %s",
|
||||
*argv, strerror(err));
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <linux/bitops.h>
|
||||
#include <linux/btf.h>
|
||||
#include <linux/err.h>
|
||||
#include <bpf/btf.h>
|
||||
|
||||
#include "btf.h"
|
||||
#include "json_writer.h"
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <libbpf.h> /* libbpf_num_possible_cpus */
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/libbpf.h> /* libbpf_num_possible_cpus */
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <linux/filter.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "main.h"
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <bpf.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <bpf/btf.h>
|
||||
|
||||
#include "btf.h"
|
||||
#include "libbpf_internal.h"
|
||||
#include "bpf/libbpf_internal.h"
|
||||
#include "json_writer.h"
|
||||
#include "main.h"
|
||||
|
||||
|
@ -333,7 +333,7 @@ static int do_skeleton(int argc, char **argv)
|
|||
#define %2$s \n\
|
||||
\n\
|
||||
#include <stdlib.h> \n\
|
||||
#include <libbpf.h> \n\
|
||||
#include <bpf/libbpf.h> \n\
|
||||
\n\
|
||||
struct %1$s { \n\
|
||||
struct bpf_object_skeleton *skeleton; \n\
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <dis-asm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
|
||||
#include "json_writer.h"
|
||||
#include "main.h"
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/btf.h>
|
||||
|
||||
#include "btf.h"
|
||||
#include "json_writer.h"
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -21,7 +21,7 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <perf-sys.h>
|
||||
|
||||
#include "main.h"
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <net/if.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
@ -16,9 +17,8 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <nlattr.h>
|
||||
#include "libbpf_internal.h"
|
||||
#include "bpf/nlattr.h"
|
||||
#include "bpf/libbpf_internal.h"
|
||||
#include "main.h"
|
||||
#include "netlink_dumper.h"
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/tc_act/tc_bpf.h>
|
||||
|
||||
#include <nlattr.h>
|
||||
#include "bpf/nlattr.h"
|
||||
#include "main.h"
|
||||
#include "netlink_dumper.h"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <unistd.h>
|
||||
#include <ftw.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#include <bpf.h>
|
||||
#include <btf.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/bpf.h>
|
||||
#include <bpf/btf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
|
||||
#include "cfg.h"
|
||||
#include "main.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <libbpf.h>
|
||||
#include <bpf/libbpf.h>
|
||||
|
||||
#include "disasm.h"
|
||||
#include "json_writer.h"
|
||||
|
|
Loading…
Reference in New Issue