CLD  0.1git
Data Structures | Defines
include/elist.h File Reference

Data Structures

struct  list_head

Defines

#define LIST_HEAD_INIT(name)   { &(name), &(name) }
#define LIST_HEAD(name)   struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr)
#define list_entry(ptr, type, member)   ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 list_entry - get the struct for this entry : the &struct list_head pointer.
#define list_for_each(pos, head)
 list_for_each - iterate over a list : the &struct list_head to use as a loop counter.
#define list_for_each_prev(pos, head)
 list_for_each_prev - iterate over a list backwards : the &struct list_head to use as a loop counter.
#define list_for_each_safe(pos, n, head)
 list_for_each_safe - iterate over a list safe against removal of list entry : the &struct list_head to use as a loop counter.
#define list_for_each_entry(pos, head, member)
 list_for_each_entry - iterate over list of given type : the type * to use as a loop counter.
#define list_for_each_entry_safe(pos, n, head, member)
 list_for_each_entry_safe - iterate over list of given type safe against removal of list entry : the type * to use as a loop counter.
#define list_for_each_entry_continue(pos, head, member)
 list_for_each_entry_continue - iterate over list of given type continuing after existing point : the type * to use as a loop counter.

Define Documentation

#define INIT_LIST_HEAD (   ptr)
Value:
do { \
        (ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
#define list_entry (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

list_entry - get the struct for this entry : the &struct list_head pointer.

: the type of the struct this is embedded in. : the name of the list_struct within the struct.

#define list_for_each (   pos,
  head 
)
Value:
for (pos = (head)->next; pos != (head); \
                pos = pos->next)

list_for_each - iterate over a list : the &struct list_head to use as a loop counter.

: the head for your list.

#define list_for_each_entry (   pos,
  head,
  member 
)
Value:
for (pos = list_entry((head)->next, typeof(*pos), member);      \
             &pos->member != (head);                                    \
             pos = list_entry(pos->member.next, typeof(*pos), member))

list_for_each_entry - iterate over list of given type : the type * to use as a loop counter.

: the head for your list. : the name of the list_struct within the struct.

#define list_for_each_entry_continue (   pos,
  head,
  member 
)
Value:
for (pos = list_entry(pos->member.next, typeof(*pos), member),  \
                     prefetch(pos->member.next);                        \
             &pos->member != (head);                                    \
             pos = list_entry(pos->member.next, typeof(*pos), member),  \
                     prefetch(pos->member.next))

list_for_each_entry_continue - iterate over list of given type continuing after existing point : the type * to use as a loop counter.

: the head for your list. : the name of the list_struct within the struct.

#define list_for_each_entry_safe (   pos,
  n,
  head,
  member 
)
Value:
for (pos = list_entry((head)->next, typeof(*pos), member),      \
                n = list_entry(pos->member.next, typeof(*pos), member); \
             &pos->member != (head);                                    \
             pos = n, n = list_entry(n->member.next, typeof(*n), member))

list_for_each_entry_safe - iterate over list of given type safe against removal of list entry : the type * to use as a loop counter.


: another type * to use as temporary storage : the head for your list. : the name of the list_struct within the struct.

#define list_for_each_prev (   pos,
  head 
)
Value:
for (pos = (head)->prev; pos != (head); \
                pos = pos->prev)

list_for_each_prev - iterate over a list backwards : the &struct list_head to use as a loop counter.

: the head for your list.

#define list_for_each_safe (   pos,
  n,
  head 
)
Value:
for (pos = (head)->next, n = pos->next; pos != (head); \
                pos = n, n = pos->next)

list_for_each_safe - iterate over a list safe against removal of list entry : the &struct list_head to use as a loop counter.


: another &struct list_head to use as temporary storage : the head for your list.

#define LIST_HEAD (   name)    struct list_head name = LIST_HEAD_INIT(name)
#define LIST_HEAD_INIT (   name)    { &(name), &(name) }