src/dlist.h File Reference

#include "prefetch.h"

Include dependency graph for dlist.h:

Go to the source code of this file.

Data Structures

struct  hlist_head
struct  hlist_node

Defines

#define HLIST_HEAD_INIT   { .first = NULL }
#define HLIST_HEAD(name)   struct hlist_head name = { .first = NULL }
#define INIT_HLIST_HEAD(ptr)   ((ptr)->first = NULL)
#define INIT_HLIST_NODE(ptr)   ((ptr)->next = NULL, (ptr)->pprev = NULL)
#define hlist_entry(ptr, type, member)   container_of(ptr,type,member)
#define hlist_for_each(pos, head)
#define hlist_for_each_safe(pos, n, head)
#define hlist_for_each_entry(tpos, pos, head, member)
#define hlist_for_each_entry_continue(tpos, pos, member)
#define hlist_for_each_entry_from(tpos, pos, member)
#define hlist_for_each_entry_safe(tpos, pos, n, head, member)

Functions

static int hlist_unhashed (const struct hlist_node *h)
static int hlist_empty (const struct hlist_head *h)
static void __hlist_del (struct hlist_node *n)
static void hlist_del (struct hlist_node *n)
static void hlist_del_init (struct hlist_node *n)
static void hlist_add_head (struct hlist_node *n, struct hlist_head *h)
static void hlist_add_before (struct hlist_node *n, struct hlist_node *next)
static void hlist_add_after (struct hlist_node *n, struct hlist_node *next)


Define Documentation

#define hlist_entry ( ptr,
type,
member   )     container_of(ptr,type,member)

Definition at line 90 of file dlist.h.

#define hlist_for_each ( pos,
head   ) 

Value:

for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
         pos = pos->next)

Definition at line 92 of file dlist.h.

#define hlist_for_each_entry ( tpos,
pos,
head,
member   ) 

Value:

for (pos = (head)->first;                    \
         pos && ({ prefetch(pos->next); 1;}) &&          \
        ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
         pos = pos->next)
hlist_for_each_entry - iterate over list of given type : the type * to use as a loop counter. : the &struct hlist_node to use as a loop counter. : the head for your list. : the name of the hlist_node within the struct.

Definition at line 107 of file dlist.h.

#define hlist_for_each_entry_continue ( tpos,
pos,
member   ) 

Value:

for (pos = (pos)->next;                      \
         pos && ({ prefetch(pos->next); 1;}) &&          \
        ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
         pos = pos->next)
hlist_for_each_entry_continue - iterate over a hlist continuing after existing point : the type * to use as a loop counter. : the &struct hlist_node to use as a loop counter. : the name of the hlist_node within the struct.

Definition at line 119 of file dlist.h.

#define hlist_for_each_entry_from ( tpos,
pos,
member   ) 

Value:

for (; pos && ({ prefetch(pos->next); 1;}) &&            \
        ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
         pos = pos->next)
hlist_for_each_entry_from - iterate over a hlist continuing from existing point : the type * to use as a loop counter. : the &struct hlist_node to use as a loop counter. : the name of the hlist_node within the struct.

Definition at line 131 of file dlist.h.

#define hlist_for_each_entry_safe ( tpos,
pos,
n,
head,
member   ) 

Value:

for (pos = (head)->first;                    \
         pos && ({ n = pos->next; 1; }) &&               \
        ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
         pos = n)
hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry : the type * to use as a loop counter. : the &struct hlist_node to use as a loop counter.
: another &struct hlist_node to use as temporary storage : the head for your list. : the name of the hlist_node within the struct.

Definition at line 144 of file dlist.h.

#define hlist_for_each_safe ( pos,
n,
head   ) 

Value:

for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
         pos = n)

Definition at line 96 of file dlist.h.

#define HLIST_HEAD ( name   )     struct hlist_head name = { .first = NULL }

Definition at line 21 of file dlist.h.

#define HLIST_HEAD_INIT   { .first = NULL }

Definition at line 20 of file dlist.h.

#define INIT_HLIST_HEAD ( ptr   )     ((ptr)->first = NULL)

Definition at line 22 of file dlist.h.

#define INIT_HLIST_NODE ( ptr   )     ((ptr)->next = NULL, (ptr)->pprev = NULL)

Definition at line 23 of file dlist.h.

Referenced by hlist_del_init().


Function Documentation

static void __hlist_del ( struct hlist_node n  )  [inline, static]

Definition at line 35 of file dlist.h.

References hlist_node::next, and hlist_node::pprev.

Referenced by hlist_del(), and hlist_del_init().

00036 {
00037     struct hlist_node *next = n->next;
00038     struct hlist_node **pprev = n->pprev;
00039     *pprev = next;
00040     if (next)
00041         next->pprev = pprev;
00042 }

static void hlist_add_after ( struct hlist_node n,
struct hlist_node next 
) [inline, static]

Definition at line 79 of file dlist.h.

References hlist_node::next, and hlist_node::pprev.

00081 {
00082     next->next = n->next;
00083     n->next = next;
00084     next->pprev = &n->next;
00085 
00086     if(next->next)
00087         next->next->pprev  = &next->next;
00088 }

static void hlist_add_before ( struct hlist_node n,
struct hlist_node next 
) [inline, static]

Definition at line 70 of file dlist.h.

References hlist_node::next, and hlist_node::pprev.

00072 {
00073     n->pprev = next->pprev;
00074     n->next = next;
00075     next->pprev = &n->next;
00076     *(n->pprev) = n;
00077 }

static void hlist_add_head ( struct hlist_node n,
struct hlist_head h 
) [inline, static]

Definition at line 59 of file dlist.h.

References hlist_head::first, hlist_node::next, and hlist_node::pprev.

00060 {
00061     struct hlist_node *first = h->first;
00062     n->next = first;
00063     if (first)
00064         first->pprev = &n->next;
00065     h->first = n;
00066     n->pprev = &h->first;
00067 }

static void hlist_del ( struct hlist_node n  )  [inline, static]

Definition at line 44 of file dlist.h.

References __hlist_del(), hlist_node::next, and hlist_node::pprev.

00045 {
00046     __hlist_del(n);
00047     n->next = LIST_POISON1;
00048     n->pprev = LIST_POISON2;
00049 }

static void hlist_del_init ( struct hlist_node n  )  [inline, static]

Definition at line 51 of file dlist.h.

References __hlist_del(), INIT_HLIST_NODE, and hlist_node::pprev.

00052 {
00053     if (n->pprev)  {
00054         __hlist_del(n);
00055         INIT_HLIST_NODE(n);
00056     }
00057 }

static int hlist_empty ( const struct hlist_head h  )  [inline, static]

Definition at line 30 of file dlist.h.

References hlist_head::first.

00031 {
00032     return !h->first;
00033 }

static int hlist_unhashed ( const struct hlist_node h  )  [inline, static]

Definition at line 25 of file dlist.h.

References hlist_node::pprev.

00026 {
00027     return !h->pprev;
00028 }


Generated on Mon May 28 04:25:28 2007 for BattletechMUX by  doxygen 1.4.7