@@ -11,12 +11,18 @@ struct node_data {
__u32 two;
};
+long calls;
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
struct {
__uint(type, BPF_MAP_TYPE_RBTREE);
__type(value, struct node_data);
-} rbtree SEC(".maps");
-
-long calls;
+ __array(lock, struct bpf_spin_lock);
+} rbtree SEC(".maps") = {
+ .lock = {
+ [0] = &rbtree_lock,
+ },
+};
static bool less(struct rb_node *a, const struct rb_node *b)
{
@@ -11,10 +11,17 @@ struct node_data {
__u32 two;
};
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
struct {
__uint(type, BPF_MAP_TYPE_RBTREE);
__type(value, struct node_data);
-} rbtree SEC(".maps");
+ __array(lock, struct bpf_spin_lock);
+} rbtree SEC(".maps") = {
+ .lock = {
+ [0] = &rbtree_lock,
+ },
+};
long calls;
@@ -14,11 +14,18 @@ struct node_data_no_rb_node {
__u64 seven;
};
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
/* Should fail because value struct has no rb_node
*/
struct {
__uint(type, BPF_MAP_TYPE_RBTREE);
__type(value, struct node_data_no_rb_node);
-} rbtree_fail_no_rb_node SEC(".maps");
+ __array(lock, struct bpf_spin_lock);
+} rbtree_fail_no_rb_node SEC(".maps") = {
+ .lock = {
+ [0] = &rbtree_lock,
+ },
+};
char _license[] SEC("license") = "GPL";
This patch contains test changes corresponding to the functional changes in patch "bpf: Support declarative association of lock with rbtree map". It will be squashed with other test patches, leaving in this state for RFCv2 feedback. Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com> --- tools/testing/selftests/bpf/progs/rbtree_map.c | 12 +++++++++--- tools/testing/selftests/bpf/progs/rbtree_map_fail.c | 9 ++++++++- .../selftests/bpf/progs/rbtree_map_load_fail.c | 9 ++++++++- 3 files changed, 25 insertions(+), 5 deletions(-)