aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <[email protected]>2022-11-18 07:26:09 +0530
committerAlexei Starovoitov <[email protected]>2022-11-17 19:22:14 -0800
commit64069c72b4b8e44f6876249cc8f2e2ee4d209a93 (patch)
treef91299450a71edf9e67b52bc3090e7e8ef5473e5
parentc22dfdd21592c5d56b49d5fba8de300ad7bf293c (diff)
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 <[email protected]> Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
-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