summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/bpf_experimental.h
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2022-11-18 04:56:09 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-11-18 06:22:14 +0300
commit64069c72b4b8e44f6876249cc8f2e2ee4d209a93 (patch)
treef91299450a71edf9e67b52bc3090e7e8ef5473e5 /tools/testing/selftests/bpf/bpf_experimental.h
parentc22dfdd21592c5d56b49d5fba8de300ad7bf293c (diff)
downloadlinux-64069c72b4b8e44f6876249cc8f2e2ee4d209a93.tar.xz
selftests/bpf: Add __contains macro to bpf_experimental.h
Add user facing __contains macro which provides a convenient wrapper over the verbose kernel specific BTF declaration tag required to annotate BPF list head structs in user types. Acked-by: Dave Marchevsky <davemarchevsky@fb.com> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20221118015614.2013203-20-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_experimental.h')
-rw-r--r--tools/testing/selftests/bpf/bpf_experimental.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
index d6b143275e82..424f7bbbfe9b 100644
--- a/tools/testing/selftests/bpf/bpf_experimental.h
+++ b/tools/testing/selftests/bpf/bpf_experimental.h
@@ -6,6 +6,8 @@
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_core_read.h>
+#define __contains(name, node) __attribute__((btf_decl_tag("contains:" #name ":" #node)))
+
/* Description
* Allocates an object of the type represented by 'local_type_id' in
* program BTF. User may use the bpf_core_type_id_local macro to pass the