On Thu, Dec 12, 2019 at 3:34 PM Andrey Ignatov <rdna@xxxxxx> wrote: > > DECLARE_LIBBPF_OPTS is the way to use option structures in a backward > compatible and extensible way. It's available only in libbpf.h. Though > public interfaces in bpf.h have the same requirement to accept options > in a way that can be simply extended w/o introducing new xattr-functions > every time. > > libbpf.c depends on bpf.h, hence to share the macros a couple of options > exist: > * either a common header should be introduced; > * or the macro can be moved to bpf.h and used by libbpf.h from there; > > The former seems to be an overkill, so do the latter: > * move DECLARE_LIBBPF_OPTS from libbpf.h to bpf.h; > * move `#include "bpf.h"` from libbpf.c to libbpf.h not to break users > of the macro who already include only libbpf.h. > > That makes the macro available to use in bpf.{h,c} and should not break > those who already use it. > > Signed-off-by: Andrey Ignatov <rdna@xxxxxx> > --- LGTM. Acked-by: Andrii Nakryiko <andriin@xxxxxx> > tools/lib/bpf/bpf.h | 22 ++++++++++++++++++++++ > tools/lib/bpf/libbpf.c | 1 - > tools/lib/bpf/libbpf.h | 24 ++---------------------- > 3 files changed, 24 insertions(+), 23 deletions(-) > [...]