include/list.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_head
struct  hlist_head
struct  hlist_node

Defines

#define offsetof(TYPE, MEMBER)   ((size_t) &((TYPE *)0)->MEMBER)
#define container_of(ptr, type, member)
 container_of - cast a member of a structure out to the containing structure
#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)   container_of(ptr, type, member)
 list_entry - get the struct for this entry : the &struct list_head pointer.
#define list_for_each(pos, head)   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.
#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_reverse(pos, head, member)
 list_for_each_entry_reverse - iterate backwards over list of given type.
#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 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 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(pos, head, member)
 hlist_for_each_entry - iterate over list of given type : the &struct hlist_node to use as a loop counter.
#define hlist_for_each_entry_continue(tpos, pos, member)
 hlist_for_each_entry_continue - iterate over a hlist continuing after existing point : the type * to use as a loop counter.
#define hlist_for_each_entry_from(tpos, pos, member)
 hlist_for_each_entry_from - iterate over a hlist continuing from existing point : the type * to use as a loop counter.
#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 counter.

Functions

static void _list_add (struct list_head *new, struct list_head *prev, struct list_head *next)
static void list_add (struct list_head *new, struct list_head *head)
 list_add - add a new entry : new entry to be added : list head to add it after
static void list_add_tail (struct list_head *new, struct list_head *head)
 list_add_tail - add a new entry : new entry to be added : list head to add it before
static void list_del_internal (struct list_head *prev, struct list_head *next)
static void list_del (struct list_head *entry)
 list_del - deletes entry from list.
static void list_move (struct list_head *list, struct list_head *head)
 list_move - delete from one list and add as another's head : the entry to move : the head that will precede our entry
static void list_move_tail (struct list_head *list, struct list_head *head)
 list_move_tail - delete from one list and add as another's tail : the entry to move : the head that will follow our entry
static int list_empty (const struct list_head *head)
 list_empty - tests whether a list is empty : the list to test.
static void list_splice (struct list_head *list, struct list_head *head)
 list_splice - join two lists : the new list to add.
static __inline__ int hlist_unhashed (const struct hlist_node *h)
static __inline__ int hlist_empty (const struct hlist_head *h)
static __inline__ void hlist_del (struct hlist_node *n)
static __inline__ void hlist_add_head (struct hlist_node *n, struct hlist_head *h)
static __inline__ void hlist_add_before (struct hlist_node *n, struct hlist_node *next)
static __inline__ void hlist_add_after (struct hlist_node *n, struct hlist_node *next)

Define 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 15 of file list.h.

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

Definition at line 318 of file list.h.

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

Definition at line 320 of file list.h.

#define hlist_for_each_entry ( pos,
head,
member   ) 
Value:
for (pos = hlist_entry((head)->first, typeof(*pos), member);    \
             &pos->member != NULL;                                      \
             pos = hlist_entry(pos->member.next, typeof(*pos), member))

hlist_for_each_entry - iterate over list of given type : 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 334 of file list.h.

#define hlist_for_each_entry_continue ( tpos,
pos,
member   ) 
Value:
for (pos = (pos)->next;                                          \
             pos &&                                                      \
                ({ 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 345 of file list.h.

#define hlist_for_each_entry_from ( tpos,
pos,
member   ) 
Value:
for (; pos &&                                                    \
                ({ 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 357 of file list.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 370 of file list.h.

#define hlist_for_each_safe ( pos,
n,
head   ) 
Value:
for (pos = (head)->first; n = pos ? pos->next : 0, pos; \
             pos = n)

Definition at line 324 of file list.h.

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

Definition at line 267 of file list.h.

#define HLIST_HEAD_INIT   { .first = NULL }

Definition at line 266 of file list.h.

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

Definition at line 268 of file list.h.

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

Definition at line 269 of file list.h.

Referenced by hlist_del().

#define INIT_LIST_HEAD ( ptr   ) 
Value:
do { \
        (ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)

Definition at line 38 of file list.h.

Referenced by emv_init(), list_del(), and list_splice().

#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 169 of file list.h.

Referenced by emv_appsel_pse_first(), and emv_appsel_pse_next().

#define list_for_each ( pos,
head   )     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.

This variant differs from list_for_each() in that it's the simplest possible list iteration code, no prefetching is done. Use this for code that knows the list to be very short (empty or 1 entry) most of the time.

Definition at line 182 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 counter.

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

Definition at line 210 of file list.h.

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

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.

Definition at line 233 of file list.h.

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

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

Definition at line 221 of file list.h.

#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.

Definition at line 245 of file list.h.

Referenced by _emv_free_applist(), and emv_appsel_pse().

#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.

Definition at line 190 of file list.h.

#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.

Definition at line 200 of file list.h.

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

Definition at line 35 of file list.h.

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

Definition at line 33 of file list.h.

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

Definition at line 5 of file list.h.


Function Documentation

static void _list_add ( struct list_head new,
struct list_head prev,
struct list_head next 
) [inline, static]

Definition at line 48 of file list.h.

References list_head::next, and list_head::prev.

Referenced by list_add(), and list_add_tail().

Here is the caller graph for this function:

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

Definition at line 310 of file list.h.

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

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

Definition at line 302 of file list.h.

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

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

Definition at line 291 of file list.h.

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

static __inline__ void hlist_del ( struct hlist_node n  )  [static]

Definition at line 281 of file list.h.

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

static __inline__ int hlist_empty ( const struct hlist_head h  )  [static]

Definition at line 276 of file list.h.

References hlist_head::first.

static __inline__ int hlist_unhashed ( const struct hlist_node h  )  [static]

Definition at line 271 of file list.h.

References hlist_node::pprev.

static void list_add ( struct list_head new,
struct list_head head 
) [inline, static]

list_add - add a new entry : new entry to be added : list head to add it after

Insert a new entry after the specified head. This is good for implementing stacks.

Definition at line 66 of file list.h.

References _list_add(), and list_head::next.

Referenced by list_move().

Here is the call graph for this function:

Here is the caller graph for this function:

static void list_add_tail ( struct list_head new,
struct list_head head 
) [inline, static]

list_add_tail - add a new entry : new entry to be added : list head to add it before

Insert a new entry before the specified head. This is useful for implementing queues.

Definition at line 79 of file list.h.

References _list_add(), and list_head::prev.

Referenced by bop_dtemp(), and list_move_tail().

Here is the call graph for this function:

Here is the caller graph for this function:

static void list_del ( struct list_head entry  )  [inline, static]

list_del - deletes entry from list.

: the element to delete from the list. Note: list_empty on entry does not return true after this, the entry is in an undefined state.

Definition at line 103 of file list.h.

References INIT_LIST_HEAD, list_del_internal(), list_head::next, and list_head::prev.

Referenced by _emv_free_applist(), emv_app_delete(), and emv_appsel_pse().

Here is the call graph for this function:

Here is the caller graph for this function:

static void list_del_internal ( struct list_head prev,
struct list_head next 
) [inline, static]

Definition at line 91 of file list.h.

References list_head::next, and list_head::prev.

Referenced by list_del(), list_move(), and list_move_tail().

Here is the caller graph for this function:

static int list_empty ( const struct list_head head  )  [inline, static]

list_empty - tests whether a list is empty : the list to test.

Definition at line 136 of file list.h.

References list_head::next.

Referenced by list_splice().

Here is the caller graph for this function:

static void list_move ( struct list_head list,
struct list_head head 
) [inline, static]

list_move - delete from one list and add as another's head : the entry to move : the head that will precede our entry

Definition at line 114 of file list.h.

References list_add(), list_del_internal(), list_head::next, and list_head::prev.

Here is the call graph for this function:

static void list_move_tail ( struct list_head list,
struct list_head head 
) [inline, static]

list_move_tail - delete from one list and add as another's tail : the entry to move : the head that will follow our entry

Definition at line 125 of file list.h.

References list_add_tail(), list_del_internal(), list_head::next, and list_head::prev.

Here is the call graph for this function:

static void list_splice ( struct list_head list,
struct list_head head 
) [inline, static]

list_splice - join two lists : the new list to add.

: the place to add it in the first list.

Definition at line 146 of file list.h.

References INIT_LIST_HEAD, list_empty(), list_head::next, and list_head::prev.

Here is the call graph for this function:

Generated on Sun Jan 2 08:34:45 2011 for ccid-utils by  doxygen 1.6.3