[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57B13507.7040601@huawei.com>
Date: Mon, 15 Aug 2016 11:20:39 +0800
From: "Wangnan (F)" <wangnan0@...wei.com>
To: Eric Leblond <eric@...it.org>, <netdev@...r.kernel.org>
CC: Alexei Starovoitov <ast@...com>
Subject: Re: [PATCH net-next 1/2] tools lib bpf: suppress useless include
On 2016/8/13 20:17, Eric Leblond wrote:
> The include of err.h is not explicitely needed in exported
> functions and it was causing include conflict with some existing
> code due to redefining some macros.
>
> Signed-off-by: Eric Leblond <eric@...it.org>
> ---
> tools/lib/bpf/libbpf.c | 1 +
> tools/lib/bpf/libbpf.h | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index b699aea..7872ff6 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -31,6 +31,7 @@
> #include <linux/kernel.h>
> #include <linux/bpf.h>
> #include <linux/list.h>
> +#include <linux/err.h>
> #include <libelf.h>
> #include <gelf.h>
>
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index dd7a513..a6c5cde 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -23,7 +23,6 @@
>
> #include <stdio.h>
> #include <stdbool.h>
> -#include <linux/err.h>
>
Functions declared in this header require PTR_ERR
to decode error number. Logically speaking, this
header depends linux/err.h, so this include is
required. If not, there must have another way for
caller to decode error numbers.
I know the problem you try to solve. Please have a look at thread
https://lkml.org/lkml/2015/12/17/20
At that time I think we should create a wrapper in libbpf.h like this:
#ifdef USE_LINUX_ERR
#include <linux/err.h>
#endif
...
int libbpf_ptr_err(void *ptr);
...
It is acceptable but ugly. Can you find a better method?
Thank you.
> enum libbpf_errno {
> __LIBBPF_ERRNO__START = 4000,
Powered by blists - more mailing lists