Re: Generic rbtree search & insert cores
From: Peter Zijlstra
Date: Tue May 01 2012 - 07:20:38 EST
On Mon, 2012-04-30 at 06:11 -0500, Daniel Santos wrote:
>
> So as long as our struct rbtree_relationship is a compile-time
> constant, the generated code will look pretty much (if not exactly)
> like that of the example code in rbtree.h. Please let me know what
> you think. I've tested this in a userspace program, but haven't fully
> stress tested it in kernelspace yet.
Right, this ought to work.
I'm not sure the root_offset thing is worth it though, passing in the
rb_root pointer isn't much of a hassle, in fact I'd expect to pass rb
related pointers to a function called rbtree_insert().
Also, using a macro to create the rbtree_relationship thing would make
it easier. Something like:
RB_RELATION(struct mouse, node, name, name_cmp);
I'd think you'd also want to provide an insertion variant that does the
leftmost thing, that's used in several places, and you'd also need one
for the augmented rb-tree.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/