- struct rb_root *root = &set->rb_root;
- struct rb_node **p = &(root->rb_node);
- struct rb_node *rb_parent = NULL;
-
- while (*p) {
- struct sd_node *this = container_of(*p, struct sd_node, rb_node);
- int cmp = hashes_cmp(new->hash, this->hash);
-
- rb_parent = *p;
- if (cmp < 0)
- p = &((*p)->rb_left);
- else if (cmp > 0)
- p = &((*p)->rb_right);
- else
- return false; /* Duplicate security descriptor */
- }
- rb_link_node(&new->rb_node, rb_parent, p);
- rb_insert_color(&new->rb_node, root);
- return true;
+ return NULL == avl_tree_insert(&set->root, &new->index_node,
+ _avl_cmp_nodes_by_hash);