Re: [PATCH bpf-next v2 05/10] bpftool: Use consistent include paths for libbpf
From: Andrii Nakryiko
Date: Wed Jan 15 2020 - 12:44:36 EST
On Wed, Jan 15, 2020 at 6:14 AM Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx> wrote:
>
> From: Toke HÃiland-JÃrgensen <toke@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
> tools/bpf/bpftool/Documentation/bpftool-gen.rst | 2 +-
> tools/bpf/bpftool/Makefile | 2 +-
> tools/bpf/bpftool/btf.c | 8 ++++----
> tools/bpf/bpftool/btf_dumper.c | 2 +-
> tools/bpf/bpftool/cgroup.c | 2 +-
> tools/bpf/bpftool/common.c | 4 ++--
> tools/bpf/bpftool/feature.c | 4 ++--
> tools/bpf/bpftool/gen.c | 10 +++++-----
> tools/bpf/bpftool/jit_disasm.c | 2 +-
> tools/bpf/bpftool/main.c | 4 ++--
> tools/bpf/bpftool/map.c | 4 ++--
> tools/bpf/bpftool/map_perf_ring.c | 4 ++--
> tools/bpf/bpftool/net.c | 8 ++++----
> tools/bpf/bpftool/netlink_dumper.c | 4 ++--
> tools/bpf/bpftool/perf.c | 2 +-
> tools/bpf/bpftool/prog.c | 6 +++---
> tools/bpf/bpftool/xlated_dumper.c | 2 +-
> 17 files changed, 35 insertions(+), 35 deletions(-)
>
[...]
> diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> index 7ce09a9a6999..b0695aa543d2 100644
> --- a/tools/bpf/bpftool/gen.c
> +++ b/tools/bpf/bpftool/gen.c
> @@ -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\
please fix \n\ alignment
> \n\
> struct %1$s { \n\
> struct bpf_object_skeleton *skeleton; \n\
[...]