RTEMS CPU Kit with SuperCore  4.11.3
rbtree.h
Go to the documentation of this file.
1 #ifndef _LINUX_RBTREE_H
2 #define _LINUX_RBTREE_H
3 
4 #include <stddef.h>
5 
6 struct rb_node {
7  struct rb_node *rb_left;
8  struct rb_node *rb_right;
9  struct rb_node *rb_parent;
10  int rb_color;
11 };
12 
13 struct rb_root {
14  struct rb_node *rb_node;
15 };
16 #define RB_ROOT ((struct rb_root){0})
17 #define rb_entry(p, container, field) \
18  ((container *) ((char *)p - offsetof(container, field)))
19 
20 #define RB_BLACK 0
21 #define RB_RED 1
22 
23 
24 extern void rb_insert_color(struct rb_node *, struct rb_root *);
25 extern void rb_erase(struct rb_node *, struct rb_root *);
26 
27 extern struct rb_node *rb_next(struct rb_node *);
28 extern struct rb_node *rb_prev(struct rb_node *);
29 extern struct rb_node *rb_first(struct rb_root *);
30 extern struct rb_node *rb_last(struct rb_root *);
31 
32 extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
33  struct rb_root *root);
34 
35 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
36  struct rb_node ** rb_link)
37 {
38  node->rb_parent = parent;
39  node->rb_color = RB_RED;
40  node->rb_left = node->rb_right = NULL;
41 
42  *rb_link = node;
43 }
44 
45 static inline struct rb_node *rb_parent(struct rb_node * node)
46 {
47  return node->rb_parent;
48 }
49 
50 #endif /* _LINUX_RBTREE_H */
Definition: rbtree.h:14
Definition: rbtree.h:7