libbpf: Add btf__load_vmlinux_btf/btf__load_module_btf
authorHengqi Chen <hengqi.chen@gmail.com>
Fri, 30 Jul 2021 11:40:12 +0000 (19:40 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 30 Jul 2021 19:21:29 +0000 (12:21 -0700)
commita710eed386f182fcbfe517b659f60024fdb7c40c
treec69f420d037fc6bd50a4cf774c44ab30b218d1ca
parentf309b4ba989d96c192edd0d730d85bc1dd92a64a
libbpf: Add btf__load_vmlinux_btf/btf__load_module_btf

Add two new APIs: btf__load_vmlinux_btf and btf__load_module_btf.
btf__load_vmlinux_btf is just an alias to the existing API named
libbpf_find_kernel_btf, rename to be more precisely and consistent
with existing BTF APIs. btf__load_module_btf can be used to load
module BTF, add it for completeness. These two APIs are useful for
implementing tracing tools and introspection tools. This is part
of the effort towards libbpf 1.0 ([0]).

  [0] Closes: https://github.com/libbpf/libbpf/issues/280

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210730114012.494408-1-hengqi.chen@gmail.com
tools/lib/bpf/btf.c
tools/lib/bpf/btf.h
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.map