Re: [PATCH bpf-next v1 4/8] libbpf: Export btf__find_by_name_kind_own()

Eduard Zingerman <[email protected]> Tue, 28 Jul 2026 17:54:22 -0700
Newsgroups org.kernel.vger.linux-input,org.kernel.vger.bpf
Message-ID <[email protected]>
On Wed, 2026-07-22 at 16:35 -0700, Ihor Solodrai wrote:
> btf__find_by_name_kind() searches the base BTF before the split BTF,
> so in case of a name collision between base and split it always
> returns a base type. Tools that process split BTF may need to restrict
> a lookup to the split's own types.
> 
> The internal helper btf__find_by_name_kind_own() already does exactly
> that. Make it a public API.
> 
> Signed-off-by: Ihor Solodrai <[email protected]>
> ---

Reviewed-by: Eduard Zingerman <[email protected]>

...

> +++ b/tools/lib/bpf/btf.h
> @@ -172,6 +172,8 @@ LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
>  				   const char *type_name);
>  LIBBPF_API __s32 btf__find_by_name_kind(const struct btf *btf,
>  					const char *type_name, __u32 kind);
> +LIBBPF_API __s32 btf__find_by_name_kind_own(const struct btf *btf,
> +					    const char *type_name, __u32 kind);

Nit: please add a docstring.

...