| 390 | EXPORT_SYMBOL(rb_replace_node); |
| 391 | |
| 392 | void rb_insert(struct rb_root *root, struct rb_node *node, |
| 393 | int (*cmp)(struct rb_node *, struct rb_node *)) |
| 394 | { |
| 395 | struct rb_node **new = &(root->rb_node), *parent = NULL; |
| 396 | |
| 397 | /* Figure out where to put new node */ |
| 398 | while (*new) { |
| 399 | int result = cmp(node, *new); |
| 400 | |
| 401 | parent = *new; |
| 402 | if (result < 0) |
| 403 | new = &((*new)->rb_left); |
| 404 | else if (result > 0) |
| 405 | new = &((*new)->rb_right); |
| 406 | else |
| 407 | return; |
| 408 | |
| 409 | } |
| 410 | |
| 411 | /* Add new node and rebalance tree. */ |
| 412 | rb_link_node(node, parent, new); |
| 413 | rb_insert_color(node, root); |
| 414 | } |
| 415 | EXPORT_SYMBOL(rb_insert); |
no test coverage detected