Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
list.h File Reference

Go to the source code of this file.

Data Structures

struct  list_head
 

Macros

#define offsetof(TYPE, MEMBER)   ((size_t) &((TYPE *)0)->MEMBER)
 
#define container_of(ptr, type, member)
 
#define LIST_HEAD_INIT(name)   { &(name), &(name) }
 
#define LIST_HEAD(name)   struct list_head name = LIST_HEAD_INIT(name)
 
#define list_entry(ptr, type, member)   container_of(ptr, type, member)
 
#define list_for_each_entry(pos, head, member)
 

Macro Definition Documentation

#define container_of (   ptr,
  type,
  member 
)
Value:
({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

container_of - cast a member of a structure out to the containing structure : the pointer to the member. : the type of the container struct this is embedded in. : the name of the member within the struct.

Definition at line 18 of file list.h.

#define list_entry (   ptr,
  type,
  member 
)    container_of(ptr, type, 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.

Definition at line 39 of file list.h.

#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 cursor. : the head for your list. : the name of the list_struct within the struct.

Definition at line 48 of file list.h.

#define LIST_HEAD (   name)    struct list_head name = LIST_HEAD_INIT(name)

Definition at line 30 of file list.h.

#define LIST_HEAD_INIT (   name)    { &(name), &(name) }

Definition at line 28 of file list.h.

#define offsetof (   TYPE,
  MEMBER 
)    ((size_t) &((TYPE *)0)->MEMBER)

Definition at line 9 of file list.h.