Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> writes: > Em Tue, Jan 18, 2022 at 03:13:27PM +0100, Toke Høiland-Jørgensen escreveu: >> The btf.h header included with libbpf contains inline helper functions to >> check for various BTF kinds. These helpers directly reference the >> BTF_KIND_* constants defined in the kernel header, and because the header >> file is included in user applications, this happens in the user application >> compile units. >> >> This presents a problem if a user application is compiled on a system with >> older kernel headers because the constants are not available. To avoid >> this, add #defines of the constants directly in btf.h before using them. >> >> Since the kernel header moved to an enum for BTF_KIND_*, the #defines can >> shadow the enum values without any errors, so we only need #ifndef guards >> for the constants that predates the conversion to enum. We group these so >> there's only one guard for groups of values that were added together. >> >> [0] Closes: https://github.com/libbpf/libbpf/issues/436 > > The coexistence of enums with the defines (in turn #ifndef guarded) as > something I hadn't considered, clever. Me neither - that bit was Andrii's idea :) > Should fix lots of build errors in my test containers :-) > > FWIW: > > Acked-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Thanks! -Toke