Skip to content

Commit 4a3d6c6

Browse files
anakryikoAlexei Starovoitov
authored and
Alexei Starovoitov
committed
libbpf: Reduce log level for custom section names
Libbpf is trying to recognize BPF program type based on its section name during bpf_object__open() phase. This is not strictly enforced and user code has ability to specify/override correct BPF program type after open. But if BPF program is using custom section name, libbpf will still emit warnings, which can be quite annoying to users. This patch reduces log level of information messages emitted by libbpf if section name is not canonical. User can still get a list of all supported section names as debug-level message. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent fb9a98e commit 4a3d6c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5883,7 +5883,7 @@ int libbpf_prog_type_by_name(const char *name, enum bpf_prog_type *prog_type,
58835883
return 0;
58845884
}
58855885

5886-
pr_warn("failed to guess program type from ELF section '%s'\n", name);
5886+
pr_debug("failed to guess program type from ELF section '%s'\n", name);
58875887
type_names = libbpf_get_type_names(false);
58885888
if (type_names != NULL) {
58895889
pr_debug("supported section(type) names are:%s\n", type_names);
@@ -6001,10 +6001,10 @@ int libbpf_attach_type_by_name(const char *name,
60016001
*attach_type = section_defs[i].attach_type;
60026002
return 0;
60036003
}
6004-
pr_warn("failed to guess attach type based on ELF section name '%s'\n", name);
6004+
pr_debug("failed to guess attach type based on ELF section name '%s'\n", name);
60056005
type_names = libbpf_get_type_names(true);
60066006
if (type_names != NULL) {
6007-
pr_info("attachable section(type) names are:%s\n", type_names);
6007+
pr_debug("attachable section(type) names are:%s\n", type_names);
60086008
free(type_names);
60096009
}
60106010

0 commit comments

Comments
 (0)