On Fri, 2025-03-28 at 10:14 -0700, Andrii Nakryiko wrote: [...] > As Eduard mentioned, I don't think `void *` is a good interface. We > have bpf_line_info_min and bpf_func_info_min structs in > libbpf_internal.h. We have never changed those types, so at this point > I feel comfortable enough to expose them as API types. Let's drop the > _min suffix, and move definitions to btf.h? > > The only question is whether to document that each record could be > bigger in size than sizeof(struct bpf_func_info) (and similarly for > bpf_line_info), and thus user should always care about > func_info_rec_size? Or, to keep it ergonomic and simple, and basically > always return sizeof(struct bpf_func_info) data (and if it so happens > that we'll in the future have different record sizes, then we'll > create a local trimmed representation for user; it's a pain, but we > won't be really stuck from API compatibility standpoint). There is also an option to do: const struct bpf_line_info *bpf_program__line_info(const struct bpf_program *prog, u32 idx) and hide the rec_size. But yes, simply assuming the array of `struct bpf_line_info` looks reasonable. [...]