diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-08-01 18:32:17 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-08-03 16:39:48 +0200 |
commit | 94a1fedd63edb672933bef44ca9213937e377c05 (patch) | |
tree | 819907a5a52a2fd723e3995302aa002e6d9fcef4 /tools/lib/bpf/btf.h | |
parent | tools, bpftool: Fix wrong return value in do_dump() (diff) | |
download | linux-dev-94a1fedd63edb672933bef44ca9213937e377c05.tar.xz linux-dev-94a1fedd63edb672933bef44ca9213937e377c05.zip |
libbpf: Add btf__parse_raw() and generic btf__parse() APIs
Add public APIs to parse BTF from raw data file (e.g.,
/sys/kernel/btf/vmlinux), as well as generic btf__parse(), which will try to
determine correct format, currently either raw or ELF.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200802013219.864880-2-andriin@fb.com
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r-- | tools/lib/bpf/btf.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 491c7b41ffdc..f4a1a1d2b9a3 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -64,8 +64,9 @@ struct btf_ext_header { LIBBPF_API void btf__free(struct btf *btf); LIBBPF_API struct btf *btf__new(const void *data, __u32 size); -LIBBPF_API struct btf *btf__parse_elf(const char *path, - struct btf_ext **btf_ext); +LIBBPF_API struct btf *btf__parse(const char *path, struct btf_ext **btf_ext); +LIBBPF_API struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext); +LIBBPF_API struct btf *btf__parse_raw(const char *path); LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf); LIBBPF_API int btf__load(struct btf *btf); LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, |