On Fri, Nov 19, 2021 at 7:33 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > From: Alexei Starovoitov <ast@xxxxxxxxxx> > > To prepare relo_core.c to be compiled in the kernel and the user space > replace btf__type_by_id with btf_type_by_id. > > In libbpf btf__type_by_id and btf_type_by_id have different behavior. > > bpf_core_apply_relo_insn() needs behavior of uapi btf__type_by_id > vs internal btf_type_by_id, but type_id range check is already done > in bpf_core_apply_relo(), so it's safe to replace it everywhere. > The kernel btf_type_by_id() does the check anyway. It doesn't hurt. > > Suggested-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> > --- LGTM. Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > tools/lib/bpf/btf.c | 2 +- > tools/lib/bpf/libbpf_internal.h | 2 +- > tools/lib/bpf/relo_core.c | 19 ++++++++----------- > 3 files changed, 10 insertions(+), 13 deletions(-) > [...]