libqb
1.0.2
|
This is a kernel style list implementation. More...
Data Structures | |
struct | qb_list_head |
Macros | |
#define | QB_LIST_DECLARE(name) struct qb_list_head name = { &(name), &(name) } |
Declare and initialize a list head. More... | |
#define | QB_INIT_LIST_HEAD(ptr) |
#define | qb_list_entry(ptr, type, member) ((type *)((char *)(ptr)-(char*)(&((type *)0)->member))) |
Get the struct for this entry. More... | |
#define | qb_list_first_entry(ptr, type, member) qb_list_entry((ptr)->next, type, member) |
Get the first element from a list. More... | |
#define | qb_list_for_each(pos, head) for (pos = (head)->next; pos != (head); pos = pos->next) |
Iterate over a list. More... | |
#define | qb_list_for_each_reverse(pos, head) for (pos = (head)->prev; pos != (head); pos = pos->prev) |
Iterate over a list backwards. More... | |
#define | qb_list_for_each_safe(pos, n, head) |
Iterate over a list safe against removal of list entry. More... | |
#define | qb_list_for_each_entry(pos, head, member) |
Iterate over list of given type. More... | |
#define | qb_list_for_each_entry_reverse(pos, head, member) |
Iterate backwards over list of given type. More... | |
#define | qb_list_for_each_entry_safe(pos, n, head, member) |
Iterate over list of given type safe against removal of list entry. More... | |
#define | qb_list_for_each_entry_safe_reverse(pos, n, head, member) |
Iterate backwards over list safe against removal. More... | |
#define | qb_list_for_each_entry_from(pos, head, member) |
Iterate over list of given type from the current point. More... | |
Functions | |
static void | qb_list_init (struct qb_list_head *head) |
Initialize the list entry. More... | |
static void | qb_list_add (struct qb_list_head *element, struct qb_list_head *head) |
Add this element to the list. More... | |
static void | qb_list_add_tail (struct qb_list_head *element, struct qb_list_head *head) |
Add to the list (but at the end of the list). More... | |
static void | qb_list_del (struct qb_list_head *_remove) |
Delete an entry from the list. More... | |
static void | qb_list_replace (struct qb_list_head *old, struct qb_list_head *new) |
Replace old entry by new one. More... | |
static int | qb_list_is_last (const struct qb_list_head *list, const struct qb_list_head *head) |
Tests whether list is the last entry in list head. More... | |
static int32_t | qb_list_empty (const struct qb_list_head *head) |
A quick test to see if the list is empty (pointing to it's self). More... | |
static void | qb_list_splice (struct qb_list_head *list, struct qb_list_head *head) |
Join two lists. More... | |
static void | qb_list_splice_tail (struct qb_list_head *list, struct qb_list_head *head) |
Join two lists, each list being a queue. More... | |
static int32_t | qb_list_length (struct qb_list_head *head) |
Count the number of items in the list. More... | |
This is a kernel style list implementation.
#define QB_INIT_LIST_HEAD | ( | ptr | ) |
#define QB_LIST_DECLARE | ( | name | ) | struct qb_list_head name = { &(name), &(name) } |
Declare and initialize a list head.
#define qb_list_entry | ( | ptr, | |
type, | |||
member | |||
) | ((type *)((char *)(ptr)-(char*)(&((type *)0)->member))) |
Get the struct for this entry.
ptr,: | the &struct list_head pointer. |
type,: | the type of the struct this is embedded in. |
member,: | the name of the list_struct within the struct. |
#define qb_list_first_entry | ( | ptr, | |
type, | |||
member | |||
) | qb_list_entry((ptr)->next, type, member) |
Get the first element from a list.
ptr,: | the &struct list_head pointer. |
type,: | the type of the struct this is embedded in. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each | ( | pos, | |
head | |||
) | for (pos = (head)->next; pos != (head); pos = pos->next) |
Iterate over a list.
pos,: | the &struct list_head to use as a loop counter. |
head,: | the head for your list. |
Referenced by qb_list_length().
#define qb_list_for_each_entry | ( | pos, | |
head, | |||
member | |||
) |
Iterate over list of given type.
pos,: | the type * to use as a loop counter. |
head,: | the head for your list. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each_entry_from | ( | pos, | |
head, | |||
member | |||
) |
Iterate over list of given type from the current point.
pos,: | the type * to use as a loop cursor. |
head,: | the head for your list. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each_entry_reverse | ( | pos, | |
head, | |||
member | |||
) |
Iterate backwards over list of given type.
pos,: | the type to use as a loop counter. |
head,: | the head for your list. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each_entry_safe | ( | pos, | |
n, | |||
head, | |||
member | |||
) |
Iterate over list of given type safe against removal of list entry.
pos,: | the type * to use as a loop cursor. |
n,: | another type * to use as temporary storage |
head,: | the head for your list. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each_entry_safe_reverse | ( | pos, | |
n, | |||
head, | |||
member | |||
) |
Iterate backwards over list safe against removal.
pos,: | the type * to use as a loop cursor. |
n,: | another type * to use as temporary storage |
head,: | the head for your list. |
member,: | the name of the list_struct within the struct. |
#define qb_list_for_each_reverse | ( | pos, | |
head | |||
) | for (pos = (head)->prev; pos != (head); pos = pos->prev) |
Iterate over a list backwards.
pos,: | the &struct list_head to use as a loop counter. |
head,: | the head for your list. |
#define qb_list_for_each_safe | ( | pos, | |
n, | |||
head | |||
) |
Iterate over a list safe against removal of list entry.
pos,: | the &struct list_head to use as a loop counter. |
n,: | another &struct list_head to use as temporary storage |
head,: | the head for your list. |
|
inlinestatic |
Add this element to the list.
element | the new element to insert. |
head | pointer to the list head |
References qb_list_head::next, and qb_list_head::prev.
|
inlinestatic |
Add to the list (but at the end of the list).
element | pointer to the element to add |
head | pointer to the list head |
References qb_list_head::next, and qb_list_head::prev.
|
inlinestatic |
Delete an entry from the list.
_remove | the list item to remove |
References qb_list_head::next, and qb_list_head::prev.
|
inlinestatic |
A quick test to see if the list is empty (pointing to it's self).
head | pointer to the list head |
References qb_list_head::next.
Referenced by qb_list_splice(), and qb_list_splice_tail().
|
inlinestatic |
Initialize the list entry.
Points next and prev pointers to head.
head | pointer to the list head |
References qb_list_head::next, and qb_list_head::prev.
|
inlinestatic |
Tests whether list is the last entry in list head.
list,: | the entry to test |
head,: | the head of the list |
References qb_list_head::next.
|
inlinestatic |
Count the number of items in the list.
head,: | the head for your list. |
References qb_list_for_each.
|
inlinestatic |
Replace old entry by new one.
old,: | the element to be replaced |
new,: | the new element to insert |
References qb_list_head::next, and qb_list_head::prev.
|
inlinestatic |
Join two lists.
list | the new list to add. |
head | the place to add it in the first list. |
References qb_list_head::next, qb_list_head::prev, and qb_list_empty().
|
inlinestatic |
Join two lists, each list being a queue.
list,: | the new list to add. |
head,: | the place to add it in the first list. |
References qb_list_head::next, qb_list_head::prev, and qb_list_empty().