1 #ifndef __BPF_EXPERIMENTAL__
2 #define __BPF_EXPERIMENTAL__
5 #include <bpf/bpf_tracing.h>
6 #include <bpf/bpf_helpers.h>
7 #include <bpf/bpf_core_read.h>
9 #define __contains(name, node) __attribute__((btf_decl_tag("contains:" #name ":" #node)))
12 * Allocates an object of the type represented by 'local_type_id' in
13 * program BTF. User may use the bpf_core_type_id_local macro to pass the
14 * type ID of a struct in program BTF.
16 * The 'local_type_id' parameter must be a known constant.
17 * The 'meta' parameter is a hidden argument that is ignored.
19 * A pointer to an object of the type corresponding to the passed in
20 * 'local_type_id', or NULL on failure.
22 extern void *bpf_obj_new_impl(__u64 local_type_id, void *meta) __ksym;
24 /* Convenience macro to wrap over bpf_obj_new_impl */
25 #define bpf_obj_new(type) ((type *)bpf_obj_new_impl(bpf_core_type_id_local(type), NULL))
28 * Free an allocated object. All fields of the object that require
29 * destruction will be destructed before the storage is freed.
31 * The 'meta' parameter is a hidden argument that is ignored.
35 extern void bpf_obj_drop_impl(void *kptr, void *meta) __ksym;
37 /* Convenience macro to wrap over bpf_obj_drop_impl */
38 #define bpf_obj_drop(kptr) bpf_obj_drop_impl(kptr, NULL)
41 * Add a new entry to the beginning of the BPF linked list.
45 extern void bpf_list_push_front(struct bpf_list_head *head, struct bpf_list_node *node) __ksym;
48 * Add a new entry to the end of the BPF linked list.
52 extern void bpf_list_push_back(struct bpf_list_head *head, struct bpf_list_node *node) __ksym;
55 * Remove the entry at the beginning of the BPF linked list.
57 * Pointer to bpf_list_node of deleted entry, or NULL if list is empty.
59 extern struct bpf_list_node *bpf_list_pop_front(struct bpf_list_head *head) __ksym;
62 * Remove the entry at the end of the BPF linked list.
64 * Pointer to bpf_list_node of deleted entry, or NULL if list is empty.
66 extern struct bpf_list_node *bpf_list_pop_back(struct bpf_list_head *head) __ksym;