netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
list.h File Reference
#include <stddef.h>
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  list_head
 
struct  hlist_head
 
struct  hlist_node
 

Macros

#define prefetch(x)   ((void)0)
 
#define LIST_POISON1   ((void *)0x12345678)
 
#define LIST_POISON2   ((void *)0x87654321)
 
#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)
 list_entry - get the struct for this entry : the &struct list_head pointer. More...
 
#define list_first_entry(ptr, type, member)   list_entry((ptr)->next, type, member)
 list_first_entry - get the first element from a list : the list head to take the element from. More...
 
#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 cursor. More...
 
#define list_for_each_entry_reverse(pos, head, member)
 list_for_each_entry_reverse - iterate backwards over list of given type. More...
 
#define list_prepare_entry(pos, head, member)   ((pos) ? : list_entry(head, typeof(*pos), member))
 list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() : the type * to use as a start point : the head of the list : the name of the list_struct within the struct. More...
 
#define list_for_each_entry_continue(pos, head, member)
 list_for_each_entry_continue - continue iteration over list of given type : the type * to use as a loop cursor. More...
 
#define list_for_each_entry_continue_reverse(pos, head, member)
 list_for_each_entry_continue_reverse - iterate backwards from the given point : the type * to use as a loop cursor. More...
 
#define list_for_each_entry_from(pos, head, member)
 list_for_each_entry_from - iterate over list of given type from the current point : the type * to use as a loop cursor. More...
 
#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 cursor. More...
 
#define list_for_each_entry_safe_continue(pos, n, head, member)
 list_for_each_entry_safe_continue : the type * to use as a loop cursor. More...
 
#define list_for_each_entry_safe_from(pos, n, head, member)
 list_for_each_entry_safe_from : the type * to use as a loop cursor. More...
 
#define list_for_each_entry_safe_reverse(pos, n, head, member)
 list_for_each_entry_safe_reverse : the type * to use as a loop cursor. More...
 
#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 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)
 hlist_for_each_entry - iterate over list of given type : the type * to use as a loop cursor. More...
 
#define hlist_for_each_entry_continue(tpos, pos, member)
 hlist_for_each_entry_continue - iterate over a hlist continuing after current point : the type * to use as a loop cursor. More...
 
#define hlist_for_each_entry_from(tpos, pos, member)
 hlist_for_each_entry_from - iterate over a hlist continuing from current point : the type * to use as a loop cursor. More...
 
#define hlist_for_each_entry_safe(tpos, pos, n, head, member)
 hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry : the type * to use as a loop cursor. More...
 

Macro Definition Documentation

#define hlist_entry (   ptr,
  type,
  member 
)    container_of(ptr,type,member)
#define hlist_for_each (   pos,
  head 
)
Value:
for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
pos = pos->next)
#define prefetch(x)
Definition: list.h:6
u8 pos
Definition: ip_set_hash_gen.h:187
#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)
#define prefetch(x)
Definition: list.h:6
#define hlist_entry(ptr, type, member)
Definition: list.h:565
u8 pos
Definition: ip_set_hash_gen.h:187

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

: the &struct hlist_node to use as a loop cursor. : the head for your list. : the name of the hlist_node within the struct.

#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)
#define prefetch(x)
Definition: list.h:6
#define hlist_entry(ptr, type, member)
Definition: list.h:565
u8 pos
Definition: ip_set_hash_gen.h:187

hlist_for_each_entry_continue - iterate over a hlist continuing after current point : the type * to use as a loop cursor.

: the &struct hlist_node to use as a loop cursor. : the name of the hlist_node within the struct.

#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)
#define prefetch(x)
Definition: list.h:6
#define hlist_entry(ptr, type, member)
Definition: list.h:565
u8 pos
Definition: ip_set_hash_gen.h:187

hlist_for_each_entry_from - iterate over a hlist continuing from current point : the type * to use as a loop cursor.

: the &struct hlist_node to use as a loop cursor. : the name of the hlist_node within the struct.

#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)
#define hlist_entry(ptr, type, member)
Definition: list.h:565
u8 pos
Definition: ip_set_hash_gen.h:187

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

: the &struct hlist_node to use as a loop cursor.
: another &struct hlist_node to use as temporary storage : the head for your list. : the name of the hlist_node within the struct.

#define hlist_for_each_safe (   pos,
  n,
  head 
)
Value:
for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
pos = n)
u8 pos
Definition: ip_set_hash_gen.h:187
#define HLIST_HEAD (   name)    struct hlist_head name = { .first = NULL }
#define HLIST_HEAD_INIT   { .first = NULL }
#define init_hlist_head (   ptr)    ((ptr)->first = NULL)
#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.

#define list_first_entry (   ptr,
  type,
  member 
)    list_entry((ptr)->next, type, member)

list_first_entry - get the first element from a list : the list head to take the element from.

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

Note, that list is expected to be not empty.

#define list_for_each_entry (   pos,
  head,
  member 
)
Value:
for (pos = list_entry((head)->next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
#define prefetch(x)
Definition: list.h:6
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

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.

#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))
#define prefetch(x)
Definition: list.h:6
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_continue - continue iteration 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.

Continue to iterate over list of given type, continuing after the current position.

#define list_for_each_entry_continue_reverse (   pos,
  head,
  member 
)
Value:
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
prefetch(pos->member.prev), &pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
#define prefetch(x)
Definition: list.h:6
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_continue_reverse - iterate backwards from the given point : the type * to use as a loop cursor.

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

Start to iterate over list of given type backwards, continuing after the current position.

#define list_for_each_entry_from (   pos,
  head,
  member 
)
Value:
for (; prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
#define prefetch(x)
Definition: list.h:6
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_from - iterate over list of given type from the current point : the type * to use as a loop cursor.

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

Iterate over list of given type, continuing from current position.

#define list_for_each_entry_reverse (   pos,
  head,
  member 
)
Value:
for (pos = list_entry((head)->prev, typeof(*pos), member); \
prefetch(pos->member.prev), &pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
#define prefetch(x)
Definition: list.h:6
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_reverse - iterate backwards 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.

#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)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

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


: 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_entry_safe_continue (   pos,
  n,
  head,
  member 
)
Value:
for (pos = list_entry(pos->member.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)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_safe_continue : the type * to use as a loop cursor.


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

Iterate over list of given type, continuing after current point, safe against removal of list entry.

#define list_for_each_entry_safe_from (   pos,
  n,
  head,
  member 
)
Value:
for (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)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_safe_from : the type * to use as a loop cursor.


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

Iterate over list of given type from current point, safe against removal of list entry.

#define list_for_each_entry_safe_reverse (   pos,
  n,
  head,
  member 
)
Value:
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
#define list_entry(ptr, type, member)
list_entry - get the struct for this entry : the &struct list_head pointer.
Definition: list.h:326
u8 pos
Definition: ip_set_hash_gen.h:187

list_for_each_entry_safe_reverse : the type * to use as a loop cursor.


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

Iterate backwards over list of given type, safe against removal of list entry.

#define LIST_HEAD (   name)    struct list_head name = LIST_HEAD_INIT(name)
#define LIST_HEAD_INIT (   name)    { &(name), &(name) }
#define LIST_POISON1   ((void *)0x12345678)
#define LIST_POISON2   ((void *)0x87654321)
#define list_prepare_entry (   pos,
  head,
  member 
)    ((pos) ? : list_entry(head, typeof(*pos), member))

list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() : the type * to use as a start point : the head of the list : the name of the list_struct within the struct.

Prepares a pos entry for use as a start point in list_for_each_entry_continue().

#define prefetch (   x)    ((void)0)