Re: [PATCH v11 bpf-next 4/8] libbpf: Add layout encoding support

[email protected]
Newsgroups org.kernel.vger.dwarves,org.kernel.vger.bpf
Message-ID <81e5bdca3b0c4eb5703b200781e30fa14ac256ba8042bb27dac98d28e743b7de@mail.kernel.org>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 9f4d1bd73b4d..e87003711543 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c

[ ... ]

> @@ -1186,12 +1229,26 @@ static struct btf *btf_new_empty(struct btf *base_btf)
>
>  struct btf *btf__new_empty(void)
>  {
> -	return libbpf_ptr(btf_new_empty(NULL));
> +	LIBBPF_OPTS(btf_new_opts, opts);
> +
> +	return libbpf_ptr(btf_new_empty(&opts));
>  }

This isn't a bug, but Eduard Zingerman noted in v8 review that
btf_new_empty(NULL) should work fine because OPTS_GET already
handles NULL opts by returning default values. The LIBBPF_OPTS
wrapper could be simplified back to just passing NULL here.

https://lore.kernel.org/bpf/[email protected]/


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22574705927

AI-authorship-score: low
AI-authorship-explanation: Extensive 11-version revision history with iterative reviewer feedback responses and domain-specific BTF implementation choices consistent with experienced kernel developer.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Unaddressed minor style nit from libbpf maintainer Eduard Zingerman about simplifying btf__new_empty() to pass NULL instead of LIBBPF_OPTS wrapper.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.