summaryrefslogtreecommitdiff
path: root/include/linux/rbtree.h
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2002-09-09 13:31:53 +0100
committerDavid Woodhouse <dwmw2@infradead.org>2002-09-09 13:31:53 +0100
commit713fd67f97dee40399d64fdc3ce5069281185bd3 (patch)
tree3f35970962b176edb839cec042a33fcfa92912ee /include/linux/rbtree.h
parentc9581bb63607e96645f0066865464a80413a1248 (diff)
Add three functions for rbtree manipulation -- rb_next(), rb_prev() and rb_replace_node()
rb_next() and rb_prev() return the next and previous nodes in the tree, respectively. rb_replace_node() allows fast replacement of a single node without having to remove the victim, rebalance the tree, insert the replacement and then rebalance again to the original topology.
Diffstat (limited to 'include/linux/rbtree.h')
-rw-r--r--include/linux/rbtree.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 96f20e145be5..27ca30a8372c 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -121,6 +121,13 @@ rb_root_t;
extern void rb_insert_color(rb_node_t *, rb_root_t *);
extern void rb_erase(rb_node_t *, rb_root_t *);
+/* Find logical next and previous nodes in a tree */
+extern rb_node_t *rb_next(rb_node_t *);
+extern rb_node_t *rb_prev(rb_node_t *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(rb_node_t *victim, rb_node_t *new, rb_root_t *root);
+
static inline void rb_link_node(rb_node_t * node, rb_node_t * parent, rb_node_t ** rb_link)
{
node->rb_parent = parent;