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