15#ifndef _LINUX_RBTREE_H
16#define _LINUX_RBTREE_H
24#define rb_node RBTree_Node
26#define rb_left Node.rbe_left
28#define rb_right Node.rbe_right
57 sizeof(
struct rb_root ) ==
sizeof( RBTree_Control ),
62 offsetof(
struct rb_root, rb_node ) == offsetof( RBTree_Control, rbh_root ),
67#define RB_ROOT ( (struct rb_root) { NULL } )
69#define rb_entry( p, container, field ) RTEMS_CONTAINER_OF( p, container, field )
71static inline void rb_insert_color(
struct rb_node *node,
struct rb_root *root)
76static inline void rb_erase(
struct rb_node *node,
struct rb_root *root )
81static inline struct rb_node *rb_next(
struct rb_node *node )
86static inline struct rb_node *rb_prev(
struct rb_node *node )
91static inline struct rb_node *rb_first(
struct rb_root *root )
96static inline struct rb_node *rb_last(
struct rb_root *root )
101static inline void rb_replace_node(
102 struct rb_node *victim,
103 struct rb_node *replacement,
108 (RBTree_Control *) root,
114static inline void rb_link_node(
115 struct rb_node *node,
116 struct rb_node *parent,
117 struct rb_node **
link
124static inline struct rb_node *rb_parent(
struct rb_node *node )
129#define rbtree_postorder_for_each_entry_safe( node, next, root, field ) \
131 node = _RBTree_Postorder_first( \
132 (RBTree_Control *) root, \
133 offsetof( __typeof__( *node ), field ) \
136 next = _RBTree_Postorder_next( \
138 offsetof( __typeof__( *node ), field ) \
RBTree_Node * _RBTree_Predecessor(const RBTree_Node *node)
Returns the predecessor of a node.
Definition: rbtreenext.c:51
RTEMS_INLINE_ROUTINE void _RBTree_Add_child(RBTree_Node *child, RBTree_Node *parent, RBTree_Node **link)
Adds a child node to a parent node.
Definition: rbtree.h:145
RTEMS_INLINE_ROUTINE RBTree_Node * _RBTree_Parent(const RBTree_Node *the_node)
Returns a pointer to the parent of this node.
Definition: rbtree.h:295
void _RBTree_Extract(RBTree_Control *the_rbtree, RBTree_Node *the_node)
Extracts (removes) the node from the red-black tree.
Definition: rbtreeextract.c:35
RBTree_Node * _RBTree_Maximum(const RBTree_Control *the_rbtree)
Returns the maximum node of the red-black tree.
Definition: rbtreenext.c:41
RBTree_Node * _RBTree_Successor(const RBTree_Node *node)
Returns the successor of a node.
Definition: rbtreenext.c:46
void _RBTree_Insert_color(RBTree_Control *the_rbtree, RBTree_Node *the_node)
Rebalances the red-black tree after insertion of the node.
Definition: rbtreeinsert.c:17
RTEMS_INLINE_ROUTINE void _RBTree_Initialize_node(RBTree_Node *the_node)
Initializes a red-black tree node.
Definition: rbtree.h:129
void _RBTree_Replace_node(RBTree_Control *the_rbtree, RBTree_Node *victim, RBTree_Node *replacement)
Replaces a node in the red-black tree without a rebalance.
Definition: rbtreereplace.c:29
RBTree_Node * _RBTree_Minimum(const RBTree_Control *the_rbtree)
Returns the minimum node of the red-black tree.
Definition: rbtreenext.c:36
int link(const char *path1, const char *path2)
Definition: link.c:28
Constants and Structures Associated with the Red-Black Tree Handler.
Red-black tree node.
Definition: rbtree.h:55