On Wed, Jul 14, 2021 at 7:15 AM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote: > > Add a new API function btf__load_from_kernel_by_id_split(), which takes > a pointer to a base BTF object in order to support split BTF objects > when retrieving BTF information from the kernel. > > Reference: https://github.com/libbpf/libbpf/issues/314 > > Signed-off-by: Quentin Monnet <quentin@xxxxxxxxxxxxx> > --- > tools/lib/bpf/btf.c | 10 ++++++++-- > tools/lib/bpf/btf.h | 2 ++ > tools/lib/bpf/libbpf.map | 1 + > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > index 05b63b63083a..15967dd80ffb 100644 > --- a/tools/lib/bpf/btf.c > +++ b/tools/lib/bpf/btf.c > @@ -1383,7 +1383,8 @@ struct btf *btf_get_from_fd(int btf_fd, struct btf *base_btf) > return btf; > } > > -int btf__load_from_kernel_by_id(__u32 id, struct btf **btf) > +int btf__load_from_kernel_by_id_split(__u32 id, struct btf **btf, > + struct btf *base_btf) here all those struct btf pointers are even more confusing, let's return the resulting struct btf * as a direct result value > { > struct btf *res; > int err, btf_fd; [...]