My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros
sw_list.h File Reference

Go to the source code of this file.

Classes

struct  list
 

Macros

#define LIST_POISON_PREV   0xDEADBEEF
 
#define LIST_POISON_NEXT   0xFADEBABE
 
#define INIT_HEAD(__lname)   { &(__lname), &(__lname) }
 
#define LIST_HEAD(_lname)   struct list _lname = INIT_HEAD(_lname)
 
#define INIT_LIST_HEAD(ptr)
 
#define list_entry(ptr, type, member)   ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
 
#define list_for_each(curr, head)   for (curr = (head)->next; curr != head; curr = (curr)->next)
 
#define list_for_each_entry(ptr, head,member)
 
#define list_for_each_entry_safe(pos, n, head, member)
 

Macro Definition Documentation

#define INIT_HEAD (   __lname)    { &(__lname), &(__lname) }
#define INIT_LIST_HEAD (   ptr)
Value:
do { \
(ptr)->next = ptr; (ptr)->prev = ptr; \
}while (0);
struct list * prev
Definition: sw_list.h:57
struct list * next
Definition: sw_list.h:57
#define list_entry (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
#define list_for_each (   curr,
  head 
)    for (curr = (head)->next; curr != head; curr = (curr)->next)
#define list_for_each_entry (   ptr,
  head,
  member 
)
Value:
for(ptr = list_entry((head)->next, __typeof__(*ptr), member); \
&ptr->member != (head); \
ptr = list_entry(ptr->member.next , __typeof__(*ptr), member))\
#define list_entry(ptr, type, member)
Definition: sw_list.h:66
struct list * next
Definition: sw_list.h:57
struct list head
Definition: sw_buddy.h:36
#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))
#define list_entry(ptr, type, member)
Definition: sw_list.h:66
struct list * next
Definition: sw_list.h:57
struct list head
Definition: sw_buddy.h:36

list_for_each_entry_safe - iterate over list of given type safe against removal of list entry

Parameters
posthe type * to use as a loop cursor.
nanother type * to use as temporary storage
headthe head for your list.
memberthe name of the list_struct within the struct.
#define LIST_HEAD (   _lname)    struct list _lname = INIT_HEAD(_lname)
#define LIST_POISON_NEXT   0xFADEBABE
#define LIST_POISON_PREV   0xDEADBEEF