Skip to content

Commit

Permalink
tools/perf: Stop using bpf_object__find_program_by_title API.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Kui-Feng Lee authored and Andrii Nakryiko committed Dec 14, 2021
1 parent 7490d59 commit b098f33
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b098f33

Please sign in to comment.