libosmocore  1.5.1
Osmocom core library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
linuxrbtree.h File Reference
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  rb_node
 
struct  rb_root
 

Macros

#define RB_RED   0
 
#define RB_BLACK   1
 
#define rb_parent(r)   ((struct rb_node *)((r)->rb_parent_color & ~3))
 
#define rb_color(r)   ((r)->rb_parent_color & 1)
 
#define rb_is_red(r)   (!rb_color(r))
 
#define rb_is_black(r)   rb_color(r)
 
#define rb_set_red(r)   do { (r)->rb_parent_color &= ~1; } while (0)
 
#define rb_set_black(r)   do { (r)->rb_parent_color |= 1; } while (0)
 
#define RB_ROOT   { NULL, }
 
#define rb_entry(ptr, type, member)   container_of(ptr, type, member)
 
#define RB_EMPTY_ROOT(root)   ((root)->rb_node == NULL)
 
#define RB_EMPTY_NODE(node)   (rb_parent(node) == node)
 
#define RB_CLEAR_NODE(node)   (rb_set_parent(node, node))
 

Functions

struct rb_node __attribute__ ((aligned(sizeof(long))))
 
static void rb_set_parent (struct rb_node *rb, struct rb_node *p)
 
static void rb_set_color (struct rb_node *rb, int color)
 
void rb_insert_color (struct rb_node *, struct rb_root *)
 
void rb_erase (struct rb_node *, struct rb_root *)
 
struct rb_noderb_next (const struct rb_node *)
 
struct rb_noderb_prev (const struct rb_node *)
 
struct rb_noderb_first (const struct rb_root *)
 
struct rb_noderb_last (const struct rb_root *)
 
void rb_replace_node (struct rb_node *victim, struct rb_node *_new, struct rb_root *root)
 
static void rb_link_node (struct rb_node *node, struct rb_node *parent, struct rb_node **rb_link)
 

Variables

unsigned long rb_parent_color
 
struct rb_noderb_right
 
struct rb_noderb_left
 
struct rb_root __attribute__
 

Macro Definition Documentation

#define RB_BLACK   1

Referenced by rb_erase().

#define RB_CLEAR_NODE (   node)    (rb_set_parent(node, node))
#define rb_color (   r)    ((r)->rb_parent_color & 1)

Referenced by __rb_erase_color(), and rb_erase().

#define RB_EMPTY_NODE (   node)    (rb_parent(node) == node)
#define RB_EMPTY_ROOT (   root)    ((root)->rb_node == NULL)
#define rb_entry (   ptr,
  type,
  member 
)    container_of(ptr, type, member)
#define rb_is_black (   r)    rb_color(r)

Referenced by __rb_erase_color().

#define rb_is_red (   r)    (!rb_color(r))
#define rb_parent (   r)    ((struct rb_node *)((r)->rb_parent_color & ~3))
#define RB_RED   0
#define RB_ROOT   { NULL, }
#define rb_set_black (   r)    do { (r)->rb_parent_color |= 1; } while (0)
#define rb_set_red (   r)    do { (r)->rb_parent_color &= ~1; } while (0)

Function Documentation

struct rb_node __attribute__ ( (aligned(sizeof(long)))  )
struct rb_node* rb_first ( const struct rb_root )
void rb_insert_color ( struct rb_node ,
struct rb_root  
)
struct rb_node* rb_last ( const struct rb_root )
static void rb_link_node ( struct rb_node node,
struct rb_node parent,
struct rb_node **  rb_link 
)
inlinestatic
struct rb_node* rb_next ( const struct rb_node )
struct rb_node* rb_prev ( const struct rb_node )
void rb_replace_node ( struct rb_node victim,
struct rb_node _new,
struct rb_root root 
)
static void rb_set_color ( struct rb_node rb,
int  color 
)
inlinestatic

References rb_node::rb_parent_color.

Referenced by __rb_erase_color().

static void rb_set_parent ( struct rb_node rb,
struct rb_node p 
)
inlinestatic

Variable Documentation

struct rb_root __attribute__
struct rb_node* rb_left

Referenced by rb_erase().

unsigned long rb_parent_color
struct rb_node* rb_right