#include "prefetch.h"
Include dependency graph for slist.h:
Go to the source code of this file.
Data Structures | |
struct | list_head |
Defines | |
#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) |
#define | list_for_each(pos, head) |
#define | __list_for_each(pos, head) for (pos = (head)->next; pos != (head); pos = pos->next) |
#define | list_for_each_prev(pos, head) |
#define | list_for_each_safe(pos, n, head) |
#define | list_for_each_entry(pos, head, member) |
#define | list_for_each_entry_reverse(pos, head, member) |
#define | list_prepare_entry(pos, head, member) ((pos) ? : list_entry(head, typeof(*pos), member)) |
#define | list_for_each_entry_continue(pos, head, member) |
#define | list_for_each_entry_safe(pos, n, head, member) |
#define | list_for_each_entry_safe_continue(pos, n, head, member) |
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) |
static void | list_add_tail (struct list_head *new, struct list_head *head) |
static void | __list_del (struct list_head *prev, struct list_head *next) |
static void | list_del (struct list_head *entry) |
static void | list_del_init (struct list_head *entry) |
static void | list_move (struct list_head *list, struct list_head *head) |
static void | list_move_tail (struct list_head *list, struct list_head *head) |
static int | list_empty (const struct list_head *head) |
static void | __list_splice (struct list_head *list, struct list_head *head) |
static void | list_splice (struct list_head *list, struct list_head *head) |
static void | list_splice_init (struct list_head *list, struct list_head *head) |
#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.
#define INIT_LIST_HEAD | ( | ptr | ) |
Value:
do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0)
Definition at line 24 of file slist.h.
Referenced by list_del_init(), and list_splice_init().
#define list_entry | ( | ptr, | |||
type, | |||||
member | ) | container_of(ptr, type, member) |
#define list_for_each | ( | pos, | |||
head | ) |
#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 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 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 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_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_for_each_prev | ( | pos, | |||
head | ) |
#define list_for_each_safe | ( | pos, | |||
n, | |||||
head | ) |
#define list_prepare_entry | ( | pos, | |||
head, | |||||
member | ) | ((pos) ? : list_entry(head, typeof(*pos), member)) |
static void __list_add | ( | struct list_head * | new, | |
struct list_head * | prev, | |||
struct list_head * | next | |||
) | [inline, static] |
Definition at line 34 of file slist.h.
References list_head::next, and list_head::prev.
Referenced by list_add(), and list_add_tail().
00037 { 00038 next->prev = new; 00039 new->next = next; 00040 new->prev = prev; 00041 prev->next = new; 00042 }
Definition at line 77 of file slist.h.
References list_head::next, and list_head::prev.
Referenced by list_del(), list_del_init(), list_move(), and list_move_tail().
Definition at line 138 of file slist.h.
References list_head::next, and list_head::prev.
Referenced by list_splice(), and list_splice_init().
00140 { 00141 struct list_head *first = list->next; 00142 struct list_head *last = list->prev; 00143 struct list_head *at = head->next; 00144 00145 first->prev = head; 00146 head->next = first; 00147 00148 last->next = at; 00149 at->prev = last; 00150 }
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 52 of file slist.h.
References __list_add(), and list_head::next.
Referenced by list_move().
00053 { 00054 __list_add(new, head, head->next); 00055 }
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 65 of file slist.h.
References __list_add(), and list_head::prev.
Referenced by list_move_tail().
00066 { 00067 __list_add(new, head->prev, head); 00068 }
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 89 of file slist.h.
References __list_del(), list_head::next, and list_head::prev.
00090 { 00091 __list_del(entry->prev, entry->next); 00092 entry->next = LIST_POISON1; 00093 entry->prev = LIST_POISON2; 00094 }
static void list_del_init | ( | struct list_head * | entry | ) | [inline, static] |
list_del_init - deletes entry from list and reinitialize it. : the element to delete from the list.
Definition at line 100 of file slist.h.
References __list_del(), INIT_LIST_HEAD, list_head::next, and list_head::prev.
00101 { 00102 __list_del(entry->prev, entry->next); 00103 INIT_LIST_HEAD(entry); 00104 }
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 133 of file slist.h.
References list_head::next.
Referenced by list_splice(), and list_splice_init().
00134 { 00135 return head->next == head; 00136 }
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 111 of file slist.h.
References __list_del(), list_add(), list_head::next, and list_head::prev.
00112 { 00113 __list_del(list->prev, list->next); 00114 list_add(list, head); 00115 }
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 122 of file slist.h.
References __list_del(), list_add_tail(), list_head::next, and list_head::prev.
00124 { 00125 __list_del(list->prev, list->next); 00126 list_add_tail(list, head); 00127 }
list_splice - join two lists : the new list to add. : the place to add it in the first list.
Definition at line 157 of file slist.h.
References __list_splice(), and list_empty().
00158 { 00159 if (!list_empty(list)) 00160 __list_splice(list, head); 00161 }
list_splice_init - join two lists and reinitialise the emptied list. : the new list to add. : the place to add it in the first list.
The list at is reinitialised
Definition at line 170 of file slist.h.
References __list_splice(), INIT_LIST_HEAD, and list_empty().
00172 { 00173 if (!list_empty(list)) { 00174 __list_splice(list, head); 00175 INIT_LIST_HEAD(list); 00176 } 00177 }