svn commit: r213818 - projects/ofed/head/sys/ofed/include/linux
Jeff Roberson
jeff at FreeBSD.org
Thu Oct 14 01:45:50 UTC 2010
Author: jeff
Date: Thu Oct 14 01:45:49 2010
New Revision: 213818
URL: http://svn.freebsd.org/changeset/base/213818
Log:
- Add an implementation of rb_replace_node()
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Modified:
projects/ofed/head/sys/ofed/include/linux/rbtree.h
Modified: projects/ofed/head/sys/ofed/include/linux/rbtree.h
==============================================================================
--- projects/ofed/head/sys/ofed/include/linux/rbtree.h Thu Oct 14 01:21:44 2010 (r213817)
+++ projects/ofed/head/sys/ofed/include/linux/rbtree.h Thu Oct 14 01:45:49 2010 (r213818)
@@ -84,6 +84,27 @@ rb_link_node(struct rb_node *node, struc
*rb_link = node;
}
+static inline void
+rb_replace_node(struct rb_node *victim, struct rb_node *new,
+ struct rb_root *root)
+{
+ struct rb_node *p;
+
+ p = rb_parent(victim);
+ if (p) {
+ if (p->rb_left == victim)
+ p->rb_left = new;
+ else
+ p->rb_right = new;
+ } else
+ root->rb_node = new;
+ if (victim->rb_left)
+ rb_set_parent(victim->rb_left, new);
+ if (victim->rb_right)
+ rb_set_parent(victim->rb_right, new);
+ *new = *victim;
+}
+
#undef RB_ROOT
#define RB_ROOT (struct rb_root) { NULL }
More information about the svn-src-projects
mailing list