diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-04-21 08:12:44 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-04-21 08:12:44 -0400 |
commit | 7fe1e133bf45b0fe70491ed3d4c5b491feff7aa8 (patch) | |
tree | f21150f65eeaa03fc624c312dfc71d9f912983c2 | |
parent | f4ffaa452e71495a06376f12f772342bc57051fc (diff) |
[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 <dwmw2@infradead.org>
-rw-r--r-- | include/linux/rbtree.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 4b7cc4fe366d..ffee81ce7b6f 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h | |||
@@ -107,6 +107,15 @@ struct rb_node | |||
107 | struct rb_node *rb_left; | 107 | struct rb_node *rb_left; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | #define rb_parent(r) ((r)->rb_parent) | ||
111 | #define rb_set_parent(r,p) do { (r)->rb_parent = p; } while (0) | ||
112 | #define rb_colour(r) ((r)->rb_colour) | ||
113 | #define rb_is_red(r) ((r)->colour == RB_RED) | ||
114 | #define rb_is_black(r) ((r)->colour == RB_BLACK) | ||
115 | #define rb_set_red(r) do { (r)->colour = RB_RED; } while (0) | ||
116 | #define rb_set_black(r) do { (r)->colour = RB_BLACK; } while (0) | ||
117 | #define rb_set_colour(r,c) do { (r)->colour = (c); } while (0) | ||
118 | |||
110 | struct rb_root | 119 | struct rb_root |
111 | { | 120 | { |
112 | struct rb_node *rb_node; | 121 | struct rb_node *rb_node; |