mirror of https://gitee.com/openkylin/linux.git
selftests/bpf: Don't use deprecated libbpf APIs
Remove all uses of bpf_program__title() and bpf_program__find_program_by_title(). Signed-off-by: Andrii Nakryiko <andriin@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200903203542.15944-10-andriin@fb.com
This commit is contained in:
parent
fd17e272be
commit
a7659cc30b
|
@ -23,7 +23,13 @@ static inline int bpf_flow_load(struct bpf_object **obj,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
main_prog = bpf_object__find_program_by_title(*obj, section_name);
|
||||
main_prog = NULL;
|
||||
bpf_object__for_each_program(prog, *obj) {
|
||||
if (strcmp(section_name, bpf_program__section_name(prog)) == 0) {
|
||||
main_prog = prog;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!main_prog)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void test_reference_tracking(void)
|
|||
const char *title;
|
||||
|
||||
/* Ignore .text sections */
|
||||
title = bpf_program__title(prog, false);
|
||||
title = bpf_program__section_name(prog);
|
||||
if (strstr(title, ".text") != NULL)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static int run_test(int cgfd)
|
|||
}
|
||||
|
||||
bpf_object__for_each_program(prog, pobj) {
|
||||
prog_name = bpf_program__title(prog, /*needs_copy*/ false);
|
||||
prog_name = bpf_program__section_name(prog);
|
||||
|
||||
if (libbpf_attach_type_by_name(prog_name, &attach_type))
|
||||
goto err;
|
||||
|
|
Loading…
Reference in New Issue