]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Expose BPF program's function name
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:43:32 +0000 (17:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 15 Dec 2019 23:58:05 +0000 (15:58 -0800)
commitc39e086028198b831bef9ac5ebdc9c825eb183f0
treefbfacf758d2ebf276a6ed08123ada06e8ae28f5e
parent1e254a3bbdc7fcd70c3fb0cff366734b3ba6db86
libbpf: Expose BPF program's function name

Add APIs to get BPF program function name, as opposed to bpf_program__title(),
which returns BPF program function's section name. Function name has a benefit
of being a valid C identifier and uniquely identifies a specific BPF program,
while section name can be duplicated across multiple independent BPF programs.

Add also bpf_object__find_program_by_name(), similar to
bpf_object__find_program_by_title(), to facilitate looking up BPF programs by
their C function names.

Convert one of selftests to new API for look up.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191214014341.3442258-9-andriin@fb.com
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map
tools/testing/selftests/bpf/prog_tests/rdonly_maps.c