libbpf: Replace btf__type_by_id() with btf_type_by_id().
authorAlexei Starovoitov <ast@kernel.org>
Wed, 1 Dec 2021 18:10:24 +0000 (10:10 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 2 Dec 2021 19:18:34 +0000 (11:18 -0800)
commit74753e1462e77349525daf9eb60ea21ed92d3a97
treed467116b4c48106e4bd0cbaa04e6df823bcc2720
parent64b5b97b8cfff64409fcc234ae3151bc8de0c4d6
libbpf: Replace btf__type_by_id() with btf_type_by_id().

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@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211201181040.23337-2-alexei.starovoitov@gmail.com
tools/lib/bpf/btf.c
tools/lib/bpf/libbpf_internal.h
tools/lib/bpf/relo_core.c