[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9459104d-3c7b-c77a-be59-c236dc495952@fb.com>
Date: Thu, 30 Mar 2017 19:56:24 -0700
From: Alexei Starovoitov <ast@...com>
To: "Wangnan (F)" <wangnan0@...wei.com>,
"David S . Miller" <davem@...emloft.net>
CC: Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>, <netdev@...r.kernel.org>,
<kernel-team@...com>
Subject: Re: [PATCH net-next 4/6] tools/lib/bpf: expose
bpf_program__set_type()
On 3/30/17 7:48 PM, Wangnan (F) wrote:
>
>
> On 2017/3/31 10:37, Alexei Starovoitov wrote:
>> On 3/30/17 7:33 PM, Wangnan (F) wrote:
>>>> +void bpf_program__set_type(struct bpf_program *prog, enum
>>>> bpf_prog_type type);
>>>>
>>>
>>> This makes libbpf.h depend on uapi/linux/bpf.h (because of enum
>>> bpf_prog_type), which is not always available.
>>>
>>> What about defining another enum inside libbpf.h?
>>
>> how about just including bpf.h? or making it 'int' instead of enum?
>>
>
> Including either kernel header into libbpf.h makes a lot of trouble,
> because kernel header and uapi have many other things we don't need
> and may conflict with existing code.
I'm not proposing to include kernel headers. Regular
/usr/include/linux/bpf.h is enough. This library isn't going to be
compiled on distros
that don't have bpf support anyway.
> Making it 'int' looks like a backdoor. We still need macro to define
> each program type.
macro for each program wasn't the greatest idea. It always
behind new program types and not usable for this use case.
See patches 5 and 6.
Powered by blists - more mailing lists