mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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
This commit is contained in:
parent
f309b4ba98
commit
a710eed386
4 changed files with 20 additions and 6 deletions
|
@ -2680,7 +2680,7 @@ static int bpf_object__load_vmlinux_btf(struct bpf_object *obj, bool force)
|
|||
if (!force && !obj_needs_vmlinux_btf(obj))
|
||||
return 0;
|
||||
|
||||
obj->btf_vmlinux = libbpf_find_kernel_btf();
|
||||
obj->btf_vmlinux = btf__load_vmlinux_btf();
|
||||
err = libbpf_get_error(obj->btf_vmlinux);
|
||||
if (err) {
|
||||
pr_warn("Error loading vmlinux BTF: %d\n", err);
|
||||
|
@ -8297,7 +8297,7 @@ int libbpf_find_vmlinux_btf_id(const char *name,
|
|||
struct btf *btf;
|
||||
int err;
|
||||
|
||||
btf = libbpf_find_kernel_btf();
|
||||
btf = btf__load_vmlinux_btf();
|
||||
err = libbpf_get_error(btf);
|
||||
if (err) {
|
||||
pr_warn("vmlinux BTF is not found\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue