Skip to content

Commit

Permalink
libbpf: Add kptr type tag macros to bpf_helpers.h
Browse files Browse the repository at this point in the history
Include convenience definitions:
__kptr:	Unreferenced kptr
__kptr_ref: Referenced kptr

Users can use them to tag the pointer type meant to be used with the new
support directly in the map value definition.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220424214901.2743946-11-memxor@gmail.com
  • Loading branch information
Kumar Kartikeya Dwivedi authored and Alexei Starovoitov committed Apr 26, 2022
1 parent 2ab3b38 commit ef89654
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/lib/bpf/bpf_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ enum libbpf_tristate {

#define __kconfig __attribute__((section(".kconfig")))
#define __ksym __attribute__((section(".ksyms")))
#if __has_attribute(btf_type_tag)
#define __kptr __attribute__((btf_type_tag("kptr")))
#define __kptr_ref __attribute__((btf_type_tag("kptr_ref")))
#else
#define __kptr
#define __kptr_ref
#endif

#ifndef ___bpf_concat
#define ___bpf_concat(a, b) a ## b
Expand Down

0 comments on commit ef89654

Please sign in to comment.