OSDN Git Service

libbpf: Minimize explicit iterator of section definition array
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 14 Sep 2021 01:47:33 +0000 (18:47 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 14 Sep 2021 22:49:24 +0000 (15:49 -0700)
commitb6291a6f30d35bd4459dc35aac2f30669a4356ac
treebe606ccb8cf5dffa18fbb25b5b8cab1ca0674bfa
parent5532dfd42e4846e84d346a6dfe01e477e35baa65
libbpf: Minimize explicit iterator of section definition array

Remove almost all the code that explicitly iterated BPF program section
definitions in favor of using find_sec_def(). The only remaining user of
section_defs is libbpf_get_type_names that has to iterate all of them to
construct its result.

Having one internal API entry point for section definitions will
simplify further refactorings around libbpf's program section
definitions parsing.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210914014733.2768-5-andrii@kernel.org
tools/lib/bpf/libbpf.c