-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrbtree-jffs2.h
50 lines (38 loc) · 1.2 KB
/
rbtree-jffs2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef _LINUX_RBTREE_H
#define _LINUX_RBTREE_H
#include <stddef.h>
struct rb_node {
struct rb_node *rb_left;
struct rb_node *rb_right;
struct rb_node *rb_parent;
int rb_color;
};
struct rb_root {
struct rb_node *rb_node;
};
#define RB_ROOT ((struct rb_root){0})
#define rb_entry(p, container, field) \
((container *) ((char *)p - offsetof(container, field)))
#define RB_BLACK 0
#define RB_RED 1
extern void rb_jffs2_insert_color(struct rb_node *, struct rb_root *);
extern void rb_jffs2_erase(struct rb_node *, struct rb_root *);
extern struct rb_node *rb_jffs2_next(struct rb_node *);
extern struct rb_node *rb_jffs2_prev(struct rb_node *);
extern struct rb_node *rb_jffs2_first(struct rb_root *);
extern struct rb_node *rb_jffs2_last(struct rb_root *);
extern void rb_jffs2_replace_node(struct rb_node *victim, struct rb_node *new,
struct rb_root *root);
static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
struct rb_node ** rb_link)
{
node->rb_parent = parent;
node->rb_color = RB_RED;
node->rb_left = node->rb_right = NULL;
*rb_link = node;
}
static inline struct rb_node *rb_parent(struct rb_node * node)
{
return node->rb_parent;
}
#endif /* _LINUX_RBTREE_H */