Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752375AbbLRGTl (ORCPT ); Fri, 18 Dec 2015 01:19:41 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:36486 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbbLRGTk (ORCPT ); Fri, 18 Dec 2015 01:19:40 -0500 Date: Thu, 17 Dec 2015 22:19:30 -0800 From: Alexei Starovoitov To: "Wangnan (F)" Cc: ast@kernel.org, agartrell@fb.com, acme@redhat.com, bblanco@plumgrid.com, daniel@iogearbox.net, daniel.wagner@bmw-carit.de, davem@davemloft.net, mingo@kernel.org, jolsa@kernel.org, xiakaixu@huawei.com, holzheu@linux.vnet.ibm.com, yang.shi@linaro.org, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Message-ID: <20151218061929.GA59584@ast-mbp.thefacebook.com> References: <1450329794-161948-1-git-send-email-wangnan0@huawei.com> <1450329794-161948-9-git-send-email-wangnan0@huawei.com> <20151217231138.GA34078@ast-mbp.thefacebook.com> <5673659F.9090004@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5673659F.9090004@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 46 On Fri, Dec 18, 2015 at 09:47:11AM +0800, Wangnan (F) wrote: > > This is a limitation in tools/lib/bpf/libbpf.h, which has a #include > > in its header. > > libbpf.h requires this include because its API uses ERR_PTR() to encode > error code. > For example, when calling bpf_object__open(), caller should use IS_ERR() to > check its > return value instead of compare with NULL, and use PTR_ERR() to retrive > error number. > > However, linux/err.h is not a part of uapi. To make libbpf work, one has to > create its > own err.h. Why tools/include/linux/err.h is not suitable for everyone? > Now I'm thinking provide LIBBPF_{IS_ERR,PTR_ERR}(), in libbpf itself. seems odd. we already have user space err.h in tools/include. > And I don't touch the setsockopt in all patches. ok, but where is the bit that does attach to perf_event to make trace_output work? > Orignally they are macros defined in linux/filter.h. no. they were never part of offical filter.h. Only in my earlier versions of bpf patches, but we decided to drop them before they got into net-next. > What about moving them into include/uapi/linux/filter.h ? Then > normal user programs like those in samples/bpf can access > them easier. we don't want to add these macros to uapi. Why not to add it to tools/include/linux/filter.h instead? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/