1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */
5 #include <bpf/bpf_tracing.h>
6 #include <bpf/bpf_helpers.h>
7 #include <bpf/bpf_core_read.h>
8 #include "bpf_experimental.h"
13 struct bpf_rb_node node;
18 struct bpf_rb_node node;
22 static bool less2(struct bpf_rb_node *a, const struct bpf_rb_node *b)
24 struct node_data2 *node_a;
25 struct node_data2 *node_b;
27 node_a = container_of(a, struct node_data2, node);
28 node_b = container_of(b, struct node_data2, node);
30 return node_a->key < node_b->key;
33 #define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8)))
34 private(A) struct bpf_spin_lock glock;
35 private(A) struct bpf_rb_root groot __contains(node_data, node);
38 long rbtree_api_add__add_wrong_type(void *ctx)
42 n = bpf_obj_new(typeof(*n));
46 bpf_spin_lock(&glock);
47 bpf_rbtree_add(&groot, &n->node, less2);
48 bpf_spin_unlock(&glock);
52 char _license[] SEC("license") = "GPL";