On Mon, Apr 26, 2021 at 1:22 PM Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> wrote: > > This helps people writing language bindings to not have to rewrite C > wrappers for inline functions in the headers. We force inline the > definition from the header for C and C++ consumers, but also export a > symbol in the library for others. This keeps the performance > advantages similar to using static inline, while also allowing tools > like Rust's bindgen to generate wrappers for the functions. > > Also see > https://lore.kernel.org/bpf/CAJ8uoz0QqR97qEYYK=VVCE9A=V=k2tKnH6wNM48jeak2RAmL0A@xxxxxxxxxxxxxx/ > for some context. > > Also see https://github.com/xdp-project/xdp-tools/pull/97 for more > discussion on the same. > > extern inline is used as it's slightly better since it warns when an > inline definition is missing. > > The fvisibility attribute goes on the inline definition, as essentially > it acts as a declaration for the function, while the extern inline > declaration ends up acting as a definition. > > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> > --- xsk is moving into libxdp, why not do this there, instead of exporting a lot of symbols that we'll be deprecating very soon. It will also incentivise customers to make a move more promptly. Bjorn, Magnus, what's the status of libxsk in libxdp? > tools/lib/bpf/libbpf.map | 16 ++++++++++++++ > tools/lib/bpf/xsk.c | 24 +++++++++++++++++++++ > tools/lib/bpf/xsk.h | 45 +++++++++++++++++++++++----------------- > 3 files changed, 66 insertions(+), 19 deletions(-) > [...]