From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757231AbcJQBsa (ORCPT ); Sun, 16 Oct 2016 21:48:30 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:23890 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716AbcJQBs3 (ORCPT ); Sun, 16 Oct 2016 21:48:29 -0400 Subject: Re: [PATCH 1/8] tools lib bpf: add error functions To: Eric Leblond , References: <20161016211834.11732-1-eric@regit.org> <20161016211834.11732-2-eric@regit.org> CC: , From: "Wangnan (F)" Message-ID: <58042DA2.30901@huawei.com> Date: Mon, 17 Oct 2016 09:47:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20161016211834.11732-2-eric@regit.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/10/17 5:18, 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. > > To fix this, let's have error handling functions provided by the > library. Furthermore this will allow user to have an homogeneous > API. > > Signed-off-by: Eric Leblond > --- > tools/lib/bpf/libbpf.c | 11 +++++++++++ > tools/lib/bpf/libbpf.h | 4 +++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index b699aea..90932f1 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -1447,3 +1448,13 @@ bpf_object__find_map_by_name(struct bpf_object *obj, const char *name) > } > return NULL; > } > + > +bool bpf__is_error(const void *ptr) Please use libbpf_is_error(), like libbpf_set_print. We use '__' because we want to use the OO concept. This utility is not OO. > +{ > + return IS_ERR(ptr); > +} > + > +long bpf__get_error(const void *ptr) Same, please call it libbpf_get_error(). Thank you.