Re: [PATCH bpf-next v5] selftests/bpf: trace_helpers.c: optimize kallsyms cache

From: Rong Tao
Date: Sun Aug 20 2023 - 22:04:00 EST


Sorry Song, I did not state clear.

libbpf_ensure_mem() is declared in libbpf_internal.h, we want to use
libbpf_ensure_mem() in trace_helpers.c, Unforturnately, we could only include
the headers 'install_headers:' defined in tools/lib/bpf/Makefile, the
'install_headers:' target does not include libbpf_internal.h, like:

tools/testing/selftests/bpf/trace_helpers.c:17:10:
fatal error: libbpf_internal.h: No such file or directory
17 | #include "libbpf_internal.h"
| ^~~~~~~~~~~~~~~~~~~

tools/testing/selftests/bpf/trace_helpers.c:17:10:
fatal error: bpf/libbpf_internal.h: No such file or directory
17 | #include "bpf/libbpf_internal.h"
| ^~~~~~~~~~~~~~~~~~~~~~~

How about

1. dup-declare libbpf_ensure_mem() in trace_helpers.c
2. move libbpf_ensure_mem() declare into libbpf_common.h

Which one do you like best.

Best wishes,
Rong Tao