From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965124AbcJSBzG (ORCPT ); Tue, 18 Oct 2016 21:55:06 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:3629 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934105AbcJSByl (ORCPT ); Tue, 18 Oct 2016 21:54:41 -0400 Subject: Re: [PATCH 1/8] tools lib bpf: add error functions To: Joe Stringer , Eric Leblond References: <20161016211834.11732-1-eric@regit.org> <20161016211834.11732-2-eric@regit.org> CC: netdev , , From: "Wangnan (F)" Message-ID: <5806D208.90308@huawei.com> Date: Wed, 19 Oct 2016 09:53:12 +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: 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/19 6:52, Joe Stringer wrote: > On 16 October 2016 at 14: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 > Does it need to return the error like this or should we just fix up > the bpf_object__open() API to return errors in a simpler form? > > There's already libbpf_set_print(...) for outputting errors, is it > reasonable to just change the library to return NULLs in error cases > instead? Returning error code to caller so caller knows what happen. Other subsystems in perf also do this. Perf hides libbpf's error output (make it silent unless -v), so it needs a way for receiving libbpf's error code. I think this patch is good, decouple libbpf.h and kernel headers. Thank you.