OSDN Git Service

libbpf: Refactor codes for finding btf id of a kernel symbol
authorMartin KaFai Lau <kafai@fb.com>
Thu, 25 Mar 2021 01:52:14 +0000 (18:52 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 27 Mar 2021 03:41:51 +0000 (20:41 -0700)
commit774e132e83d0f10a7ebbfe7db1debdaed6013f83
tree7221ed70d189d87b1c69071edb4402416060eb5c
parent933d1aa32409ef4209c8065ee4ede68236659cd2
libbpf: Refactor codes for finding btf id of a kernel symbol

This patch refactors code, that finds kernel btf_id by kind
and symbol name, to a new function find_ksym_btf_id().

It also adds a new helper __btf_kind_str() to return
a string by the numeric kind value.

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