On Tue, 2012-05-01 at 13:20 +0200, Peter Zijlstra wrote:> 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.

Something like the below,.. I wanted to add typechecking to__RB_RELS_KEY and __RB_RELS_LEFT like: