OSDN Git Service

libbpf: Make btf_dump work with modifiable BTF
authorAndrii Nakryiko <andriin@fb.com>
Tue, 29 Sep 2020 23:28:40 +0000 (16:28 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 30 Sep 2020 19:30:22 +0000 (12:30 -0700)
commit9c6c5c48d7e9c00c541e0f1a5cea3a96767e825c
treed1ebdedabbbeefc0dbd72a35a9186fb30208f3eb
parentea7da1d563f11ee5f853fd19fc178ff17e990d09
libbpf: Make btf_dump work with modifiable BTF

Ensure that btf_dump can accommodate new BTF types being appended to BTF
instance after struct btf_dump was created. This came up during attemp to
use btf_dump for raw type dumping in selftests, but given changes are not
excessive, it's good to not have any gotchas in API usage, so I decided to
support such use case in general.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200929232843.1249318-2-andriin@fb.com
tools/lib/bpf/btf.c
tools/lib/bpf/btf_dump.c
tools/lib/bpf/libbpf_internal.h