]> 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)
commit740e69c3c511aa207155ba993a854b5bee79cdc2
tree4db1a22407bf940db56386762b82f349c9d7958e
parentb000def2e052fc8ddea31a18019f6ebe044defb3
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