Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1295248

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

From Alexei Starovoitov <alexei.starovoitov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF
Date 2015-12-19 01:40 +0100
Message-ID <qHdJ0-4oP-7@gated-at.bofh.it> (permalink)
References (1 earlier) <qGziy-3tt-7@gated-at.bofh.it> <qGQ01-66V-11@gated-at.bofh.it> <qGSlb-7uA-1@gated-at.bofh.it> <qGWIa-1Xj-5@gated-at.bofh.it> <qGXkR-2qN-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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}(),  in libbpf itself.
> >seems odd. we already have user space err.h in tools/include.
> 
> Currently samples/bpf doesn't have an -I$(srctree)/tools/include.
> 
> I tried to add it into CFLAGS of samples/bpf. It causes other problems,

let's fix those problem then.

> 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). Switching
> samples/bpf into libbpf is the first step of this goal. From doing this
> I found and fixed some limitation, like those missed BPF map operations.
> Making libbpf.h and bpf.h available for normal userspace programs is also
> important.
> 
> Having the above goal, I think you can understand why improving
> tools/include
> is not a good idea. You don't want to force a normal userspace program setup
> a similar header environment for using libbpf. It is relatively a small
> library. So it would be good if bpf.h and libbpf.h only depend on what can
> be found in uapi.

completely agree on the goal of making libbpf to be a standalone library,
but disagree on tools/include dependency.
If you copy-paste err.h into libbpf either as-is or as LIBBPF_IS_ERR,
it's not going to be enough. Soon you'll need another macro from tools/include
and so on. imo it's much easier to include tools/include/ as part of
standalone libbpf.

Also at the time of creation of tools/lib/bpf we agreed that it's LGPL
just like tools/lib/traceevent, but I don't see any mention of it in
the libbpf source.

--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Wang Nan <wangnan0@huawei.com> - 2015-12-17 06:30 +0100
  Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-12-18 00:20 +0100
    Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-18 02:50 +0100
      Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-12-18 07:30 +0100
        Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-18 08:10 +0100
          Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-18 08:20 +0100
          Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Daniel Borkmann <daniel@iogearbox.net> - 2015-12-18 12:00 +0100
            Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Daniel Borkmann <daniel@iogearbox.net> - 2015-12-18 12:30 +0100
            Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF pi3orama <pi3orama@163.com> - 2015-12-18 12:30 +0100
          Re: [PATCH 08/10] bpf samples: Add utils.[ch] for using BPF Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2015-12-19 01:40 +0100

csiph-web