diff options
author | Kui-Feng Lee <kuifeng@fb.com> | 2021-12-14 06:59:30 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-12-15 01:38:05 +0300 |
commit | b098f33692d75d184a3ab62095c376fd0e52d880 (patch) | |
tree | 06a819eb47a82be44013baca4d2df66075240e4d /tools/perf/builtin-trace.c | |
parent | 7490d59268168adf16aa319b007986778080d367 (diff) | |
download | linux-b098f33692d75d184a3ab62095c376fd0e52d880.tar.xz |
tools/perf: Stop using bpf_object__find_program_by_title API.
bpf_obj__find_program_by_title() in libbpf is going to be deprecated.
Call bpf_object_for_each_program to find a program in the section with
a given name instead.
Signed-off-by: Kui-Feng Lee <kuifeng@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211214035931.1148209-4-kuifeng@fb.com
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 0b52e08e558e..97121fb45842 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -3257,10 +3257,21 @@ static void trace__set_bpf_map_syscalls(struct trace *trace) static struct bpf_program *trace__find_bpf_program_by_title(struct trace *trace, const char *name) { + struct bpf_program *pos, *prog = NULL; + const char *sec_name; + if (trace->bpf_obj == NULL) return NULL; - return bpf_object__find_program_by_title(trace->bpf_obj, name); + bpf_object__for_each_program(pos, trace->bpf_obj) { + sec_name = bpf_program__section_name(pos); + if (sec_name && !strcmp(sec_name, name)) { + prog = pos; + break; + } + } + + return prog; } static struct bpf_program *trace__find_syscall_bpf_prog(struct trace *trace, struct syscall *sc, |