[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81276ef0-fd65-0db1-5063-efbd4ef80bfa@iogearbox.net>
Date: Tue, 6 Mar 2018 15:39:07 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Jiri Benc <jbenc@...hat.com>, netdev@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Jakub Kicinski <jakub.kicinski@...ronome.com>
Subject: Re: [PATCH bpf] tools: bpftool: fix compilation with older headers
On 03/06/2018 02:50 PM, Jiri Benc wrote:
> Compilation of bpftool on a distro that lacks eBPF support in the installed
> kernel headers fails with:
>
> common.c: In function ‘is_bpffs’:
> common.c:96:40: error: ‘BPF_FS_MAGIC’ undeclared (first use in this function)
> return (unsigned long)st_fs.f_type == BPF_FS_MAGIC;
> ^
> Fix this the same way it is already in tools/lib/bpf/libbpf.c and
> tools/lib/api/fs/fs.c.
>
> Signed-off-by: Jiri Benc <jbenc@...hat.com>
Thanks for the fix, Jiri! The standard approach to resolve such header dependencies under
tools/ would be to add a copy of magic.h uapi header into tools/include/uapi/linux/magic.h.
Both bpftool and libbpf have tools/include/uapi/ in their include path from their
Makefile, so they would pull this in automatically and it would also allow to get rid
of the extra ifdef in libbpf then. Could you look into that?
Thanks,
Daniel
> ---
> tools/bpf/bpftool/common.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c
> index 0b482c0070e0..465995281dcd 100644
> --- a/tools/bpf/bpftool/common.c
> +++ b/tools/bpf/bpftool/common.c
> @@ -55,6 +55,10 @@
>
> #include "main.h"
>
> +#ifndef BPF_FS_MAGIC
> +#define BPF_FS_MAGIC 0xcafe4a11
> +#endif
> +
> void p_err(const char *fmt, ...)
> {
> va_list ap;
>
Powered by blists - more mailing lists