Commit 0cfdcd63 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov
Browse files

libbpf: Add base BTF accessor



Add ability to get base BTF. It can be also used to check if BTF is split BTF.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201202065244.530571-3-andrii@kernel.org
parent 71ccb500
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -432,6 +432,11 @@ __u32 btf__get_nr_types(const struct btf *btf)
	return btf->start_id + btf->nr_types - 1;
}

const struct btf *btf__base_btf(const struct btf *btf)
{
	return btf->base_btf;
}

/* internal helper returning non-const pointer to a type */
static struct btf_type *btf_type_by_id(struct btf *btf, __u32 type_id)
{
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
LIBBPF_API __s32 btf__find_by_name_kind(const struct btf *btf,
					const char *type_name, __u32 kind);
LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
LIBBPF_API const struct btf *btf__base_btf(const struct btf *btf);
LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
						  __u32 id);
LIBBPF_API size_t btf__pointer_size(const struct btf *btf);
+1 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ LIBBPF_0.2.0 {

LIBBPF_0.3.0 {
	global:
		btf__base_btf;
		btf__parse_elf_split;
		btf__parse_raw_split;
		btf__parse_split;