OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [compat/] [linux/] [v2_0/] [include/] [linux/] [rbtree.h] - Blame information for rev 223

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef _LINUX_RBTREE_H
2
#define _LINUX_RBTREE_H
3
 
4
 
5
struct rb_node {
6
        struct rb_node *rb_left;        /* left element */
7
        struct rb_node *rb_right;       /* right element */
8
        struct rb_node *rb_parent;      /* parent element */
9
        int rb_color;                   /* node color */
10
};
11
 
12
struct rb_root {
13
        struct rb_node *rb_node; /* root of the tree */
14
};
15
#define NULL ((void *)0)
16
#define RB_ROOT ((struct rb_root){NULL})
17
#define rb_entry(p, container, field)           \
18
        ((container *) ((void *)p - ((void *)&(((container *)0)->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
/* Find logical next and previous nodes in a tree */
28
extern struct rb_node *rb_next(struct rb_node *);
29
extern struct rb_node *rb_prev(struct rb_node *);
30
extern struct rb_node *rb_first(struct rb_root *);
31
 
32
/* Fast replacement of a single node without remove/rebalance/add/rebalance */
33
extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
34
                            struct rb_root *root);
35
 
36
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
37
                                struct rb_node ** rb_link)
38
{
39
        node->rb_parent = parent;
40
        node->rb_color = RB_RED;
41
        node->rb_left = node->rb_right = NULL;
42
 
43
        *rb_link = node;
44
}
45
 
46
#endif  /* _LINUX_RBTREE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.