From: David Woodhouse Date: Fri, 21 Apr 2006 12:12:44 +0000 (+0100) Subject: [RBTREE] Add accessor macros for colour and parent fields of rb_node X-Git-Tag: v2.6.18-rc1~1104^2~11 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fe1e133bf45b0fe70491ed3d4c5b491feff7aa8;p=linux-2.6 [RBTREE] Add accessor macros for colour and parent fields of rb_node This is in preparation for merging those fields into a single 'unsigned long', because using a whole machine-word for a single bit of colour information is wasteful. Signed-off-by: David Woodhouse --- diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 4b7cc4fe36..ffee81ce7b 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -107,6 +107,15 @@ struct rb_node struct rb_node *rb_left; }; +#define rb_parent(r) ((r)->rb_parent) +#define rb_set_parent(r,p) do { (r)->rb_parent = p; } while (0) +#define rb_colour(r) ((r)->rb_colour) +#define rb_is_red(r) ((r)->colour == RB_RED) +#define rb_is_black(r) ((r)->colour == RB_BLACK) +#define rb_set_red(r) do { (r)->colour = RB_RED; } while (0) +#define rb_set_black(r) do { (r)->colour = RB_BLACK; } while (0) +#define rb_set_colour(r,c) do { (r)->colour = (c); } while (0) + struct rb_root { struct rb_node *rb_node;