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

From: Rong Tao
Date: Fri Aug 18 2023 - 11:37:30 EST


Hi, jirka

Sadly, we can't include libbpf_internal.h in trace_helpers.{h,c}.
we only have the following headers when compile samples/bpf/:

tree of samples/bpf/libbpf/
+-- bpf_helper_defs.h
+-- include
|   '-- bpf
|   +-- bpf_core_read.h
|   +-- bpf_endian.h
|   +-- bpf.h
|   +-- bpf_helper_defs.h
|   +-- bpf_helpers.h
|   +-- bpf_tracing.h
|   +-- btf.h
|   +-- libbpf_common.h
|   +-- libbpf.h
|   +-- libbpf_legacy.h
|   +-- libbpf_version.h
|   +-- skel_internal.h
|   '-- usdt.bpf.h
+-- libbpf.a

No libbpf_internal.h here.

What if we add a declaration to libbpf_ensure_mem() in trace_helpers.c?

Good Day,
Rong Tao