ReactOS  0.4.14-dev-384-g5b37caa
list.h File Reference

Go to the source code of this file.

Classes

struct  list_head
 

Macros

#define prefetch(a)   ((void *)a)
 
#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)   ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
 
#define list_for_each(pos, head)
 
#define list_for_each_safe(pos, n, head)
 
#define list_for_each_prev(pos, head)
 
#define list_for_each_entry(pos, head, type, member)
 
#define list_for_each_entry_safe(pos, n, head, type, member)
 

Functions

static void INIT_LIST_HEAD (struct list_head *list)
 
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 (struct list_head *head)
 
static int list_empty_careful (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)
 

Macro Definition Documentation

◆ list_entry

#define list_entry (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))

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

Definition at line 191 of file list.h.

◆ list_for_each

#define list_for_each (   pos,
  head 
)
Value:
for (pos = (head)->next, prefetch(pos->next); pos != (head); \
pos = pos->next, prefetch(pos->next))
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define prefetch(a)
Definition: list.h:14
static unsigned __int64 next
Definition: rand_nt.c:6

list_for_each - iterate over a list @pos: the &struct list_head to use as a loop counter. @head: the head for your list.

Definition at line 199 of file list.h.

◆ list_for_each_entry

#define list_for_each_entry (   pos,
  head,
  type,
  member 
)
Value:
for (pos = list_entry((head)->next, type, member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, type, member), \
prefetch(pos->member.next))
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define prefetch(a)
Definition: list.h:14
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: list.h:27
#define list_entry(ptr, type, member)
Definition: list.h:191

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

Definition at line 232 of file list.h.

◆ list_for_each_entry_safe

#define list_for_each_entry_safe (   pos,
  n,
  head,
  type,
  member 
)
Value:
for (pos = list_entry((head)->next, type, member), \
n = list_entry(pos->member.next, type, member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, type, member))
struct outqueuenode * head
Definition: adnsresfilter.c:66
GLdouble n
Definition: glext.h:7729
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static unsigned __int64 next
Definition: rand_nt.c:6
Definition: list.h:27
#define list_entry(ptr, type, member)
Definition: list.h:191

list_for_each_entry_safe - iterate over list of given type safe against removal of list entry @pos: the type * to use as a loop counter.
: another type * to use as temporary storage @head: the head for your list. @member: the name of the list_struct within the struct.

Definition at line 248 of file list.h.

◆ list_for_each_prev

#define list_for_each_prev (   pos,
  head 
)
Value:
for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
pos = pos->prev, prefetch(pos->prev))
struct outqueuenode * head
Definition: adnsresfilter.c:66
#define prefetch(a)
Definition: list.h:14
struct list_head * prev
Definition: list.h:16

list_for_each_prev - iterate over a list in reverse order @pos: the &struct list_head to use as a loop counter. @head: the head for your list.

Definition at line 219 of file list.h.

◆ list_for_each_safe

#define list_for_each_safe (   pos,
  n,
  head 
)
Value:
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
struct outqueuenode * head
Definition: adnsresfilter.c:66
GLdouble n
Definition: glext.h:7729
static unsigned __int64 next
Definition: rand_nt.c:6

list_for_each_safe - iterate over a list safe against removal of list entry @pos: the &struct list_head to use as a loop counter.
: another &struct list_head to use as temporary storage @head: the head for your list.

Definition at line 209 of file list.h.

◆ LIST_HEAD

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

Definition at line 22 of file list.h.

◆ LIST_HEAD_INIT

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

Definition at line 20 of file list.h.

◆ prefetch

#define prefetch (   a)    ((void *)a)

Definition at line 14 of file list.h.

Function Documentation

◆ __list_add()

static void __list_add ( struct list_head new,
struct list_head prev,
struct list_head next 
)
inlinestatic

Definition at line 37 of file list.h.

40 {
41  next->prev = new;
42  new->next = next;
43  new->prev = prev;
44  prev->next = new;
45 }
struct list_head * prev
Definition: list.h:16
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by list_add(), and list_add_tail().

◆ __list_del()

static void __list_del ( struct list_head prev,
struct list_head next 
)
inlinestatic

Definition at line 80 of file list.h.

81 {
82  next->prev = prev;
83  prev->next = next;
84 }
struct list_head * prev
Definition: list.h:16
static unsigned __int64 next
Definition: rand_nt.c:6

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

◆ __list_splice()

static void __list_splice ( struct list_head list,
struct list_head head 
)
inlinestatic

Definition at line 144 of file list.h.

146 {
147  struct list_head *first = list->next;
148  struct list_head *last = list->prev;
149  struct list_head *at = head->next;
150 
151  first->prev = head;
152  head->next = first;
153 
154  last->next = at;
155  at->prev = last;
156 }
struct list * prev
Definition: list.h:39
struct outqueuenode * head
Definition: adnsresfilter.c:66
POINT last
Definition: font.c:46
const GLint * first
Definition: glext.h:5794
struct list_head * prev
Definition: list.h:16
Definition: list.h:15
struct list * next
Definition: list.h:38
Definition: _list.h:228

Referenced by list_splice(), and list_splice_init().

◆ INIT_LIST_HEAD()

static void INIT_LIST_HEAD ( struct list_head list)
inlinestatic

Definition at line 25 of file list.h.

26 {
27  list->next = list;
28  list->prev = list;
29 }
struct list * prev
Definition: list.h:39
struct list * next
Definition: list.h:38
Definition: _list.h:228
#define list
Definition: rosglue.h:35

Referenced by list_del_init(), and list_splice_init().

◆ list_add()

static void list_add ( struct list_head new,
struct list_head head 
)
inlinestatic

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

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

Definition at line 55 of file list.h.

56 {
57  __list_add(new, head, head->next);
58 }
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next)
Definition: list.h:37

Referenced by list_move().

◆ list_add_tail()

static void list_add_tail ( struct list_head new,
struct list_head head 
)
inlinestatic

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

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

Definition at line 68 of file list.h.

69 {
70  __list_add(new, head->prev, head);
71 }
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next)
Definition: list.h:37

Referenced by list_move_tail().

◆ list_del()

static void list_del ( struct list_head entry)
inlinestatic

list_del - deletes entry from list. @entry: 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 91 of file list.h.

92 {
93  __list_del(entry->prev, entry->next);
94 }
static void __list_del(struct list_head *prev, struct list_head *next)
Definition: list.h:80
uint32_t entry
Definition: isohybrid.c:63

◆ list_del_init()

static void list_del_init ( struct list_head entry)
inlinestatic

list_del_init - deletes entry from list and reinitialize it. @entry: the element to delete from the list.

Definition at line 100 of file list.h.

101 {
102  __list_del(entry->prev, entry->next);
104 }
static void INIT_LIST_HEAD(struct list_head *list)
Definition: list.h:25
static void __list_del(struct list_head *prev, struct list_head *next)
Definition: list.h:80
uint32_t entry
Definition: isohybrid.c:63

◆ list_empty()

static int list_empty ( struct list_head head)
inlinestatic

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

Definition at line 133 of file list.h.

134 {
135  return head->next == head;
136 }
struct outqueuenode * head
Definition: adnsresfilter.c:66

Referenced by list_splice(), and list_splice_init().

◆ list_empty_careful()

static int list_empty_careful ( const struct list_head head)
inlinestatic

Definition at line 138 of file list.h.

139 {
140  struct list_head *next = head->next;
141  return (next == head) && (next == head->prev);
142 }
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: list.h:15
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by finish_wait().

◆ list_move()

static void list_move ( struct list_head list,
struct list_head head 
)
inlinestatic

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

Definition at line 111 of file list.h.

112 {
114  list_add(list, head);
115 }
struct list * prev
Definition: list.h:39
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void list_add(struct list_head *new, struct list_head *head)
Definition: list.h:55
static void __list_del(struct list_head *prev, struct list_head *next)
Definition: list.h:80
struct list * next
Definition: list.h:38
Definition: _list.h:228

◆ list_move_tail()

static void list_move_tail ( struct list_head list,
struct list_head head 
)
inlinestatic

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

Definition at line 122 of file list.h.

124 {
127 }
struct list * prev
Definition: list.h:39
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void __list_del(struct list_head *prev, struct list_head *next)
Definition: list.h:80
struct list * next
Definition: list.h:38
static void list_add_tail(struct list_head *new, struct list_head *head)
Definition: list.h:68
Definition: _list.h:228

◆ list_splice()

static void list_splice ( struct list_head list,
struct list_head head 
)
inlinestatic

list_splice - join two lists @list: the new list to add. @head: the place to add it in the first list.

Definition at line 163 of file list.h.

164 {
165  if (!list_empty(list))
167 }
struct outqueuenode * head
Definition: adnsresfilter.c:66
static int list_empty(struct list_head *head)
Definition: list.h:133
static void __list_splice(struct list_head *list, struct list_head *head)
Definition: list.h:144
Definition: _list.h:228

◆ list_splice_init()

static void list_splice_init ( struct list_head list,
struct list_head head 
)
inlinestatic

list_splice_init - join two lists and reinitialise the emptied list. @list: the new list to add. @head: the place to add it in the first list.

The list at @list is reinitialised

Definition at line 176 of file list.h.

178 {
179  if (!list_empty(list)) {
182  }
183 }
struct outqueuenode * head
Definition: adnsresfilter.c:66
static void INIT_LIST_HEAD(struct list_head *list)
Definition: list.h:25
static int list_empty(struct list_head *head)
Definition: list.h:133
static void __list_splice(struct list_head *list, struct list_head *head)
Definition: list.h:144
Definition: _list.h:228