]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
bpftool: Use consistent include paths for libbpf
authorToke Høiland-Jørgensen <toke@redhat.com>
Mon, 20 Jan 2020 13:06:46 +0000 (14:06 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jan 2020 00:37:45 +0000 (16:37 -0800)
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: 6910d7d3867a ("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
17 files changed:
tools/bpf/bpftool/Documentation/bpftool-gen.rst
tools/bpf/bpftool/Makefile
tools/bpf/bpftool/btf.c
tools/bpf/bpftool/btf_dumper.c
tools/bpf/bpftool/cgroup.c
tools/bpf/bpftool/common.c
tools/bpf/bpftool/feature.c
tools/bpf/bpftool/gen.c
tools/bpf/bpftool/jit_disasm.c
tools/bpf/bpftool/main.c
tools/bpf/bpftool/map.c
tools/bpf/bpftool/map_perf_ring.c
tools/bpf/bpftool/net.c
tools/bpf/bpftool/netlink_dumper.c
tools/bpf/bpftool/perf.c
tools/bpf/bpftool/prog.c
tools/bpf/bpftool/xlated_dumper.c

index 86a87da97d0bb69cde1e55aa73921a7c2279ace8..94d91322895ab735f11447ae078363b2012c3aed 100644 (file)
@@ -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;
index 39bc6f0f4f0bb839ade8b6962bff515729f318ea..c4e8103358104efcd792791e6dc2d89b171773c5 100644 (file)
@@ -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),)
index 60c75be0666da92121f11a436df490b40315501f..4ba90d81b6a1856bcc0f94e69a95622e24f1dd30 100644 (file)
@@ -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;
                }
index d66131f696892065240e225e2c86d44278ea4e6e..eb4a142016a0b66bc9fb0c4562b2df0880207742 100644 (file)
@@ -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"
 
index 2f017caa678dc973d6c697a0d70a29ca22d49d5f..62c6a1d7cd18b66261f17d9d8b14571f85bcd8e1 100644 (file)
@@ -14,7 +14,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <bpf.h>
+#include <bpf/bpf.h>
 
 #include "main.h"
 
index 88264abaa738ad1dbab60b407ba584dac617a0b6..b75b8ec5469c207cce1dc4c72f8e21bcea5a7ce9 100644 (file)
@@ -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"
 
index 94735d968c34ed247e28a1914f042983a09d80f9..446ba891f1e23311799726bc9ce1082e9acc3dc3 100644 (file)
@@ -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"
index 7ce09a9a69994c666cc2733b9f844372b63a70b1..f8113b3646f52b328c1ce409fe4da09384dfdf5d 100644 (file)
 #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\
index bfed711258cedd26ab93da98bab17ea1b91fdc9e..f7f5885aa3ba2bae338bbe23e8ece4ce337812b8 100644 (file)
@@ -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"
index 1fe91c55850833da48cbea721a40d7de08bcf0d1..6d41bbfc645937debb45753501c34f71802ffd2d 100644 (file)
@@ -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"
 
index 86f8ab0b7e63d8145ec490a728ddc1832eeba6b2..e6c85680b34d70d810b287926a1a77b4e265c027 100644 (file)
@@ -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"
 
index 4c5531d1a45002e79f2e0b2de48317bb408d9988..d9b29c17fbb8e53f01c4b0807811812b38a5c54f 100644 (file)
@@ -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"
index d93bee298e54c320030290302f66b853128f9c8f..c5e3895b7c8b6a94a84758774eae400eb40432c6 100644 (file)
@@ -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"
 
index 550a0f537eedd8b0fc0a1b0df7d448916a24690d..5f65140b003b2e6a2d8460b64d2cb47700174014 100644 (file)
@@ -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"
 
index b2046f33e23f1b719a617f7a66f96d5bb13cb934..3341aa14acdacced1a52fc136d0b8fc146c1030c 100644 (file)
@@ -13,7 +13,7 @@
 #include <unistd.h>
 #include <ftw.h>
 
-#include <bpf.h>
+#include <bpf/bpf.h>
 
 #include "main.h"
 
index 47a61ac42dc05648634bc63b94f024053cc364f9..a3521deca86943aa93e24560b5aa7a47d1fb983d 100644 (file)
@@ -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"
index 5b91ee65a080260e857187a30b921687c1532ab4..8608cd68cdd0794ba711925e0ca71e6bf98f33ff 100644 (file)
@@ -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"