Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-18 Thread Alexei Starovoitov
On Fri, Dec 18, 2015 at 03:04:00PM +0800, Wangnan (F) wrote: > > >>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}(), i

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-18 Thread Daniel Borkmann
On 12/18/2015 12:18 PM, pi3orama wrote: ... Get it, and I remember you told me about this once. There's another goal. When someone introduces new functions to eBPF, like object pin added in these days, switching samples to libbpf will lead he/she to help me improve libbpf, because if a new sampl

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-18 Thread pi3orama
发自我的 iPhone > 在 2015年12月18日,下午6:57,Daniel Borkmann 写道: > >> On 12/18/2015 08:04 AM, Wangnan (F) wrote: >> ... >> What I want to do in this patchset is not only removing original libbpf.c >> and bpf_load.c. In fact I want libbpf in tools/lib/bpf becomes a public >> available library for other u

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-18 Thread Daniel Borkmann
On 12/18/2015 08:04 AM, Wangnan (F) wrote: ... What I want to do in this patchset is not only removing original libbpf.c and bpf_load.c. In fact I want libbpf in tools/lib/bpf becomes a public available library for other userspace tools (tc for example). Having this as a possible user space lib

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-17 Thread Wangnan (F)
On 2015/12/18 15:04, Wangnan (F) wrote: On 2015/12/18 14:19, Alexei Starovoitov wrote: 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_P

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-17 Thread Wangnan (F)
On 2015/12/18 14:19, Alexei Starovoitov wrote: 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, whe

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-17 Thread Alexei Starovoitov
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(), calle

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-17 Thread Wangnan (F)
On 2015/12/18 7:11, Alexei Starovoitov wrote: On Thu, Dec 17, 2015 at 05:23:12AM +, Wang Nan wrote: We are going to uses libbpf to replace old libbpf.[ch] and bpf_load.[ch]. This is the first patch of this work. In this patch, several macros and helpers in libbpf.[ch] and bpf_load.[ch] are

Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF

2015-12-17 Thread Alexei Starovoitov
On Thu, Dec 17, 2015 at 05:23:12AM +, Wang Nan wrote: > We are going to uses libbpf to replace old libbpf.[ch] and > bpf_load.[ch]. This is the first patch of this work. In this patch, > several macros and helpers in libbpf.[ch] and bpf_load.[ch] are > merged into utils.[ch]. utils.[ch] utilize