]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Refactor internals of BTF type index
authorAndrii Nakryiko <andriin@fb.com>
Sat, 26 Sep 2020 01:13:49 +0000 (18:13 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 29 Sep 2020 00:27:31 +0000 (17:27 -0700)
commit5f32ba7b3a2001ce3ff570d765b6c6bbc4f3e8e4
tree4db1a22407bf940db56386762b82f349c9d7958e
parent7e9692de578b22333b14f0e91b042d0564e86d24
libbpf: Refactor internals of BTF type index

Refactor implementation of internal BTF type index to not use direct pointers.
Instead it uses offset relative to the start of types data section. This
allows for types data to be reallocatable, enabling implementation of
modifiable BTF.

As now getting type by ID has an extra indirection step, convert all internal
type lookups to a new helper btf_type_id(), that returns non-const pointer to
a type by its ID.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200926011357.2366158-2-andriin@fb.com
tools/lib/bpf/btf.c