@@ -149,6 +149,10 @@ enum libbpf_tristate {
#define __kconfig __attribute__((section(".kconfig")))
#define __ksym __attribute__((section(".ksyms")))
+#define __kptr __attribute__((btf_type_tag("kernel.bpf.btf_id")))
+#define __kptr_ref __kptr __attribute__((btf_type_tag("kernel.bpf.ref")))
+#define __kptr_percpu __kptr __attribute__((btf_type_tag("kernel.bpf.percpu")))
+#define __kptr_user __kptr __attribute__((btf_type_tag("kernel.bpf.user")))
#ifndef ___bpf_concat
#define ___bpf_concat(a, b) a ## b
Include convenience definitions: __kptr: Unreferenced BTF ID pointer __kptr_ref: Referenced BTF ID pointer __kptr_percpu: per-CPU BTF ID pointer __kptr_user: Userspace BTF ID pointer Users can use them to tag the pointer type meant to be used with the new support directly in the map value definition. Note that these attributes require https://reviews.llvm.org/D119799 to be emitted in BPF object BTF correctly when applied to a non-builtin type. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> --- tools/lib/bpf/bpf_helpers.h | 4 ++++ 1 file changed, 4 insertions(+)