OSDN Git Service

libbpf: Refactor CO-RE relo human description formatting routine
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 26 Apr 2022 00:45:08 +0000 (17:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 26 Apr 2022 22:41:46 +0000 (15:41 -0700)
commitb58af63aab11e4ae00fe96de9505759cfdde8ee9
tree7893daae2c48dfa9724324294b16e4b0ebca098f
parent185cfe837fdbb1fcc0f6b8fbcf5fdd2d1fccd3ad
libbpf: Refactor CO-RE relo human description formatting routine

Refactor how CO-RE relocation is formatted. Now it dumps human-readable
representation, currently used by libbpf in either debug or error
message output during CO-RE relocation resolution process, into provided
buffer. This approach allows for better reuse of this functionality
outside of CO-RE relocation resolution, which we'll use in next patch
for providing better error message for BPF verifier rejecting BPF
program due to unguarded failed CO-RE relocation.

It also gets rid of annoying "stitching" of libbpf_print() calls, which
was the only place where we did this.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220426004511.2691730-8-andrii@kernel.org
tools/lib/bpf/relo_core.c