Date: Thu, 14 Oct 2010 01:45:49 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r213818 - projects/ofed/head/sys/ofed/include/linux Message-ID: <201010140145.o9E1jnhf008325@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010140145.o9E1jnhf008325>