libite 2.6.1
queue.h File Reference

Go to the source code of this file.

Macros

#define _SYS_QUEUE_H_
 
#define _Q_INVALIDATE(a)
 
#define SLIST_HEAD(name, type)
 
#define SLIST_HEAD_INITIALIZER(head)
 
#define SLIST_ENTRY(type)
 
#define SLIST_FIRST(head)
 
#define SLIST_END(head)
 
#define SLIST_EMPTY(head)
 
#define SLIST_NEXT(elm, field)
 
#define SLIST_FOREACH(var, head, field)
 
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
 
#define SLIST_INIT(head)
 
#define SLIST_INSERT_AFTER(slistelm, elm, field)
 
#define SLIST_INSERT_HEAD(head, elm, field)
 
#define SLIST_REMOVE_AFTER(elm, field)
 
#define SLIST_REMOVE_HEAD(head, field)
 
#define SLIST_REMOVE(head, elm, type, field)
 
#define LIST_HEAD(name, type)
 
#define LIST_HEAD_INITIALIZER(head)
 
#define LIST_ENTRY(type)
 
#define LIST_FIRST(head)
 
#define LIST_END(head)
 
#define LIST_EMPTY(head)
 
#define LIST_NEXT(elm, field)
 
#define LIST_FOREACH(var, head, field)
 
#define LIST_FOREACH_SAFE(var, head, field, tvar)
 
#define LIST_INIT(head)
 
#define LIST_INSERT_AFTER(listelm, elm, field)
 
#define LIST_INSERT_BEFORE(listelm, elm, field)
 
#define LIST_INSERT_HEAD(head, elm, field)
 
#define LIST_REMOVE(elm, field)
 
#define LIST_REPLACE(elm, elm2, field)
 
#define SIMPLEQ_HEAD(name, type)
 
#define SIMPLEQ_HEAD_INITIALIZER(head)
 
#define SIMPLEQ_ENTRY(type)
 
#define SIMPLEQ_FIRST(head)
 
#define SIMPLEQ_END(head)
 
#define SIMPLEQ_EMPTY(head)
 
#define SIMPLEQ_NEXT(elm, field)
 
#define SIMPLEQ_FOREACH(var, head, field)
 
#define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar)
 
#define SIMPLEQ_INIT(head)
 
#define SIMPLEQ_INSERT_HEAD(head, elm, field)
 
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
 
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field)
 
#define SIMPLEQ_REMOVE_HEAD(head, field)
 
#define SIMPLEQ_REMOVE_AFTER(head, elm, field)
 
#define SIMPLEQ_CONCAT(head1, head2)
 
#define XSIMPLEQ_HEAD(name, type)
 
#define XSIMPLEQ_ENTRY(type)
 
#define XSIMPLEQ_XOR(head, ptr)
 
#define XSIMPLEQ_FIRST(head)
 
#define XSIMPLEQ_END(head)
 
#define XSIMPLEQ_EMPTY(head)
 
#define XSIMPLEQ_NEXT(head, elm, field)
 
#define XSIMPLEQ_FOREACH(var, head, field)
 
#define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar)
 
#define XSIMPLEQ_INIT(head)
 
#define XSIMPLEQ_INSERT_HEAD(head, elm, field)
 
#define XSIMPLEQ_INSERT_TAIL(head, elm, field)
 
#define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field)
 
#define XSIMPLEQ_REMOVE_HEAD(head, field)
 
#define XSIMPLEQ_REMOVE_AFTER(head, elm, field)
 
#define TAILQ_HEAD(name, type)
 
#define TAILQ_HEAD_INITIALIZER(head)
 
#define TAILQ_ENTRY(type)
 
#define TAILQ_FIRST(head)
 
#define TAILQ_END(head)
 
#define TAILQ_NEXT(elm, field)
 
#define TAILQ_LAST(head, headname)
 
#define TAILQ_PREV(elm, headname, field)
 
#define TAILQ_EMPTY(head)
 
#define TAILQ_FOREACH(var, head, field)
 
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
 
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
 
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)
 
#define TAILQ_INIT(head)
 
#define TAILQ_INSERT_HEAD(head, elm, field)
 
#define TAILQ_INSERT_TAIL(head, elm, field)
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field)
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field)
 
#define TAILQ_REMOVE(head, elm, field)
 
#define TAILQ_REPLACE(head, elm, elm2, field)
 
#define TAILQ_CONCAT(head1, head2, field)
 

Detailed Description

Author
The Regents of the University of California
Date
1991, 1993

This file defines five types of data structures: singly-linked lists, lists, simple queues, tail queues and XOR simple queues.

A singly-linked list is headed by a single forward pointer. The elements are singly linked for minimum space and pointer manipulation overhead at the expense of O(n) removal for arbitrary elements. New elements can be added to the list after an existing element or at the head of the list. Elements being removed from the head of the list should use the explicit macro for this purpose for optimum efficiency. A singly-linked list may only be traversed in the forward direction. Singly-linked lists are ideal for applications with large datasets and few or no removals or for implementing a LIFO queue.

A list is headed by a single forward pointer (or an array of forward pointers for a hash table header). The elements are doubly linked so that an arbitrary element can be removed without a need to traverse the list. New elements can be added to the list before or after an existing element or at the head of the list. A list may only be traversed in the forward direction.

A simple queue is headed by a pair of pointers, one to the head of the list and the other to the tail of the list. The elements are singly linked to save space, so elements can only be removed from the head of the list. New elements can be added to the list before or after an existing element, at the head of the list, or at the end of the list. A simple queue may only be traversed in the forward direction.

A tail queue is headed by a pair of pointers, one to the head of the list and the other to the tail of the list. The elements are doubly linked so that an arbitrary element can be removed without a need to traverse the list. New elements can be added to the list before or after an existing element, at the head of the list, or at the end of the list. A tail queue may be traversed in either direction.

An XOR simple queue is used in the same way as a regular simple queue. The difference is that the head structure also includes a "cookie" that is XOR'd with the queue pointer (first, last or next) to generate the real pointer value.

For details on the use of these macros, see the queue(3) manual page.

Definition in file queue.h.

Macro Definition Documentation

◆ _Q_INVALIDATE

#define _Q_INVALIDATE ( a)

Definition at line 95 of file queue.h.

◆ _SYS_QUEUE_H_

#define _SYS_QUEUE_H_

Definition at line 41 of file queue.h.

◆ LIST_EMPTY

#define LIST_EMPTY ( head)
Value:
(LIST_FIRST(head) == LIST_END(head))

Definition at line 193 of file queue.h.

◆ LIST_END

#define LIST_END ( head)
Value:
NULL

Definition at line 192 of file queue.h.

◆ LIST_ENTRY

#define LIST_ENTRY ( type)
Value:
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}

Definition at line 182 of file queue.h.

◆ LIST_FIRST

#define LIST_FIRST ( head)
Value:
((head)->lh_first)

Definition at line 191 of file queue.h.

◆ LIST_FOREACH

#define LIST_FOREACH ( var,
head,
field )
Value:
for((var) = LIST_FIRST(head); \
(var)!= LIST_END(head); \
(var) = LIST_NEXT(var, field))

Definition at line 196 of file queue.h.

◆ LIST_FOREACH_SAFE

#define LIST_FOREACH_SAFE ( var,
head,
field,
tvar )
Value:
for ((var) = LIST_FIRST(head); \
(var) && ((tvar) = LIST_NEXT(var, field), 1); \
(var) = (tvar))

Definition at line 201 of file queue.h.

◆ LIST_HEAD

#define LIST_HEAD ( name,
type )
Value:
struct name { \
struct type *lh_first; /* first element */ \
}

Definition at line 174 of file queue.h.

◆ LIST_HEAD_INITIALIZER

#define LIST_HEAD_INITIALIZER ( head)
Value:
{ NULL }

Definition at line 179 of file queue.h.

◆ LIST_INIT

#define LIST_INIT ( head)
Value:
do { \
LIST_FIRST(head) = LIST_END(head); \
} while (0)

Definition at line 209 of file queue.h.

◆ LIST_INSERT_AFTER

#define LIST_INSERT_AFTER ( listelm,
elm,
field )
Value:
do { \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
} while (0)

Definition at line 213 of file queue.h.

◆ LIST_INSERT_BEFORE

#define LIST_INSERT_BEFORE ( listelm,
elm,
field )
Value:
do { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
} while (0)

Definition at line 221 of file queue.h.

◆ LIST_INSERT_HEAD

#define LIST_INSERT_HEAD ( head,
elm,
field )
Value:
do { \
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (0)

Definition at line 228 of file queue.h.

◆ LIST_NEXT

#define LIST_NEXT ( elm,
field )
Value:
((elm)->field.le_next)

Definition at line 194 of file queue.h.

◆ LIST_REMOVE

#define LIST_REMOVE ( elm,
field )
Value:
do { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
_Q_INVALIDATE((elm)->field.le_prev); \
_Q_INVALIDATE((elm)->field.le_next); \
} while (0)

Definition at line 235 of file queue.h.

◆ LIST_REPLACE

#define LIST_REPLACE ( elm,
elm2,
field )
Value:
do { \
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
(elm2)->field.le_next->field.le_prev = \
&(elm2)->field.le_next; \
(elm2)->field.le_prev = (elm)->field.le_prev; \
*(elm2)->field.le_prev = (elm2); \
_Q_INVALIDATE((elm)->field.le_prev); \
_Q_INVALIDATE((elm)->field.le_next); \
} while (0)

Definition at line 244 of file queue.h.

◆ SIMPLEQ_CONCAT

#define SIMPLEQ_CONCAT ( head1,
head2 )
Value:
do { \
if (!SIMPLEQ_EMPTY((head2))) { \
*(head1)->sqh_last = (head2)->sqh_first; \
(head1)->sqh_last = (head2)->sqh_last; \
SIMPLEQ_INIT((head2)); \
} \
} while (0)

Definition at line 326 of file queue.h.

◆ SIMPLEQ_EMPTY

#define SIMPLEQ_EMPTY ( head)
Value:
(SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))

Definition at line 276 of file queue.h.

◆ SIMPLEQ_END

#define SIMPLEQ_END ( head)
Value:
NULL

Definition at line 275 of file queue.h.

◆ SIMPLEQ_ENTRY

#define SIMPLEQ_ENTRY ( type)
Value:
struct { \
struct type *sqe_next; /* next element */ \
}

Definition at line 266 of file queue.h.

◆ SIMPLEQ_FIRST

#define SIMPLEQ_FIRST ( head)
Value:
((head)->sqh_first)

Definition at line 274 of file queue.h.

◆ SIMPLEQ_FOREACH

#define SIMPLEQ_FOREACH ( var,
head,
field )
Value:
for((var) = SIMPLEQ_FIRST(head); \
(var) != SIMPLEQ_END(head); \
(var) = SIMPLEQ_NEXT(var, field))

Definition at line 279 of file queue.h.

◆ SIMPLEQ_FOREACH_SAFE

#define SIMPLEQ_FOREACH_SAFE ( var,
head,
field,
tvar )
Value:
for ((var) = SIMPLEQ_FIRST(head); \
(var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
(var) = (tvar))

Definition at line 284 of file queue.h.

◆ SIMPLEQ_HEAD

#define SIMPLEQ_HEAD ( name,
type )
Value:
struct name { \
struct type *sqh_first; /* first element */ \
struct type **sqh_last; /* addr of last next element */ \
}

Definition at line 257 of file queue.h.

◆ SIMPLEQ_HEAD_INITIALIZER

#define SIMPLEQ_HEAD_INITIALIZER ( head)
Value:
{ NULL, &(head).sqh_first }

Definition at line 263 of file queue.h.

◆ SIMPLEQ_INIT

#define SIMPLEQ_INIT ( head)
Value:
do { \
(head)->sqh_first = NULL; \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)

Definition at line 292 of file queue.h.

◆ SIMPLEQ_INSERT_AFTER

#define SIMPLEQ_INSERT_AFTER ( head,
listelm,
elm,
field )
Value:
do { \
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
(head)->sqh_last = &(elm)->field.sqe_next; \
(listelm)->field.sqe_next = (elm); \
} while (0)

Definition at line 309 of file queue.h.

◆ SIMPLEQ_INSERT_HEAD

#define SIMPLEQ_INSERT_HEAD ( head,
elm,
field )
Value:
do { \
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
(head)->sqh_first = (elm); \
} while (0)

Definition at line 297 of file queue.h.

◆ SIMPLEQ_INSERT_TAIL

#define SIMPLEQ_INSERT_TAIL ( head,
elm,
field )
Value:
do { \
(elm)->field.sqe_next = NULL; \
*(head)->sqh_last = (elm); \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)

Definition at line 303 of file queue.h.

◆ SIMPLEQ_NEXT

#define SIMPLEQ_NEXT ( elm,
field )
Value:
((elm)->field.sqe_next)

Definition at line 277 of file queue.h.

◆ SIMPLEQ_REMOVE_AFTER

#define SIMPLEQ_REMOVE_AFTER ( head,
elm,
field )
Value:
do { \
if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
== NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)

Definition at line 320 of file queue.h.

◆ SIMPLEQ_REMOVE_HEAD

#define SIMPLEQ_REMOVE_HEAD ( head,
field )
Value:
do { \
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)

Definition at line 315 of file queue.h.

◆ SLIST_EMPTY

#define SLIST_EMPTY ( head)
Value:
(SLIST_FIRST(head) == SLIST_END(head))

Definition at line 119 of file queue.h.

◆ SLIST_END

#define SLIST_END ( head)
Value:
NULL

Definition at line 118 of file queue.h.

◆ SLIST_ENTRY

#define SLIST_ENTRY ( type)
Value:
struct { \
struct type *sle_next; /* next element */ \
}

Definition at line 109 of file queue.h.

◆ SLIST_FIRST

#define SLIST_FIRST ( head)
Value:
((head)->slh_first)

Definition at line 117 of file queue.h.

◆ SLIST_FOREACH

#define SLIST_FOREACH ( var,
head,
field )
Value:
for((var) = SLIST_FIRST(head); \
(var) != SLIST_END(head); \
(var) = SLIST_NEXT(var, field))

Definition at line 122 of file queue.h.

◆ SLIST_FOREACH_SAFE

#define SLIST_FOREACH_SAFE ( var,
head,
field,
tvar )
Value:
for ((var) = SLIST_FIRST(head); \
(var) && ((tvar) = SLIST_NEXT(var, field), 1); \
(var) = (tvar))

Definition at line 127 of file queue.h.

◆ SLIST_HEAD

#define SLIST_HEAD ( name,
type )
Value:
struct name { \
struct type *slh_first; /* first element */ \
}

Definition at line 101 of file queue.h.

◆ SLIST_HEAD_INITIALIZER

#define SLIST_HEAD_INITIALIZER ( head)
Value:
{ NULL }

Definition at line 106 of file queue.h.

◆ SLIST_INIT

#define SLIST_INIT ( head)
Value:
{ \
SLIST_FIRST(head) = SLIST_END(head); \
}

Definition at line 135 of file queue.h.

◆ SLIST_INSERT_AFTER

#define SLIST_INSERT_AFTER ( slistelm,
elm,
field )
Value:
do { \
(elm)->field.sle_next = (slistelm)->field.sle_next; \
(slistelm)->field.sle_next = (elm); \
} while (0)

Definition at line 139 of file queue.h.

◆ SLIST_INSERT_HEAD

#define SLIST_INSERT_HEAD ( head,
elm,
field )
Value:
do { \
(elm)->field.sle_next = (head)->slh_first; \
(head)->slh_first = (elm); \
} while (0)

Definition at line 144 of file queue.h.

◆ SLIST_NEXT

#define SLIST_NEXT ( elm,
field )
Value:
((elm)->field.sle_next)

Definition at line 120 of file queue.h.

◆ SLIST_REMOVE

#define SLIST_REMOVE ( head,
elm,
type,
field )
Value:
do { \
if ((head)->slh_first == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->slh_first; \
\
while (curelm->field.sle_next != (elm)) \
curelm = curelm->field.sle_next; \
curelm->field.sle_next = \
curelm->field.sle_next->field.sle_next; \
} \
_Q_INVALIDATE((elm)->field.sle_next); \
} while (0)

Definition at line 157 of file queue.h.

◆ SLIST_REMOVE_AFTER

#define SLIST_REMOVE_AFTER ( elm,
field )
Value:
do { \
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
} while (0)

Definition at line 149 of file queue.h.

◆ SLIST_REMOVE_HEAD

#define SLIST_REMOVE_HEAD ( head,
field )
Value:
do { \
(head)->slh_first = (head)->slh_first->field.sle_next; \
} while (0)

Definition at line 153 of file queue.h.

◆ TAILQ_CONCAT

#define TAILQ_CONCAT ( head1,
head2,
field )
Value:
do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (0)

Definition at line 534 of file queue.h.

◆ TAILQ_EMPTY

#define TAILQ_EMPTY ( head)
Value:
(TAILQ_FIRST(head) == TAILQ_END(head))

Definition at line 443 of file queue.h.

◆ TAILQ_END

#define TAILQ_END ( head)
Value:
NULL

Definition at line 436 of file queue.h.

◆ TAILQ_ENTRY

#define TAILQ_ENTRY ( type)
Value:
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}

Definition at line 426 of file queue.h.

◆ TAILQ_FIRST

#define TAILQ_FIRST ( head)
Value:
((head)->tqh_first)

Definition at line 435 of file queue.h.

◆ TAILQ_FOREACH

#define TAILQ_FOREACH ( var,
head,
field )
Value:
for((var) = TAILQ_FIRST(head); \
(var) != TAILQ_END(head); \
(var) = TAILQ_NEXT(var, field))

Definition at line 446 of file queue.h.

◆ TAILQ_FOREACH_REVERSE

#define TAILQ_FOREACH_REVERSE ( var,
head,
headname,
field )
Value:
for((var) = TAILQ_LAST(head, headname); \
(var) != TAILQ_END(head); \
(var) = TAILQ_PREV(var, headname, field))

Definition at line 458 of file queue.h.

◆ TAILQ_FOREACH_REVERSE_SAFE

#define TAILQ_FOREACH_REVERSE_SAFE ( var,
head,
headname,
field,
tvar )
Value:
for ((var) = TAILQ_LAST(head, headname); \
(var) != TAILQ_END(head) && \
((tvar) = TAILQ_PREV(var, headname, field), 1); \
(var) = (tvar))

Definition at line 463 of file queue.h.

◆ TAILQ_FOREACH_SAFE

#define TAILQ_FOREACH_SAFE ( var,
head,
field,
tvar )
Value:
for ((var) = TAILQ_FIRST(head); \
(var) != TAILQ_END(head) && \
((tvar) = TAILQ_NEXT(var, field), 1); \
(var) = (tvar))

Definition at line 451 of file queue.h.

◆ TAILQ_HEAD

#define TAILQ_HEAD ( name,
type )
Value:
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}

Definition at line 417 of file queue.h.

◆ TAILQ_HEAD_INITIALIZER

#define TAILQ_HEAD_INITIALIZER ( head)
Value:
{ NULL, &(head).tqh_first }

Definition at line 423 of file queue.h.

◆ TAILQ_INIT

#define TAILQ_INIT ( head)
Value:
do { \
(head)->tqh_first = NULL; \
(head)->tqh_last = &(head)->tqh_first; \
} while (0)

Definition at line 472 of file queue.h.

◆ TAILQ_INSERT_AFTER

#define TAILQ_INSERT_AFTER ( head,
listelm,
elm,
field )
Value:
do { \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
} while (0)

Definition at line 494 of file queue.h.

◆ TAILQ_INSERT_BEFORE

#define TAILQ_INSERT_BEFORE ( listelm,
elm,
field )
Value:
do { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
} while (0)

Definition at line 504 of file queue.h.

◆ TAILQ_INSERT_HEAD

#define TAILQ_INSERT_HEAD ( head,
elm,
field )
Value:
do { \
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
} while (0)

Definition at line 477 of file queue.h.

◆ TAILQ_INSERT_TAIL

#define TAILQ_INSERT_TAIL ( head,
elm,
field )
Value:
do { \
(elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
} while (0)

Definition at line 487 of file queue.h.

◆ TAILQ_LAST

#define TAILQ_LAST ( head,
headname )
Value:
(*(((struct headname *)((head)->tqh_last))->tqh_last))

Definition at line 438 of file queue.h.

◆ TAILQ_NEXT

#define TAILQ_NEXT ( elm,
field )
Value:
((elm)->field.tqe_next)

Definition at line 437 of file queue.h.

◆ TAILQ_PREV

#define TAILQ_PREV ( elm,
headname,
field )
Value:
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))

Definition at line 441 of file queue.h.

◆ TAILQ_REMOVE

#define TAILQ_REMOVE ( head,
elm,
field )
Value:
do { \
if (((elm)->field.tqe_next) != NULL) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
_Q_INVALIDATE((elm)->field.tqe_prev); \
_Q_INVALIDATE((elm)->field.tqe_next); \
} while (0)

Definition at line 511 of file queue.h.

◆ TAILQ_REPLACE

#define TAILQ_REPLACE ( head,
elm,
elm2,
field )
Value:
do { \
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
(elm2)->field.tqe_next->field.tqe_prev = \
&(elm2)->field.tqe_next; \
else \
(head)->tqh_last = &(elm2)->field.tqe_next; \
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
*(elm2)->field.tqe_prev = (elm2); \
_Q_INVALIDATE((elm)->field.tqe_prev); \
_Q_INVALIDATE((elm)->field.tqe_next); \
} while (0)

Definition at line 522 of file queue.h.

◆ XSIMPLEQ_EMPTY

#define XSIMPLEQ_EMPTY ( head)
Value:
(XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))

Definition at line 356 of file queue.h.

◆ XSIMPLEQ_END

#define XSIMPLEQ_END ( head)
Value:
NULL

Definition at line 355 of file queue.h.

◆ XSIMPLEQ_ENTRY

#define XSIMPLEQ_ENTRY ( type)
Value:
struct { \
struct type *sqx_next; /* next element */ \
}

Definition at line 344 of file queue.h.

◆ XSIMPLEQ_FIRST

#define XSIMPLEQ_FIRST ( head)
Value:
XSIMPLEQ_XOR(head, ((head)->sqx_first))

Definition at line 354 of file queue.h.

◆ XSIMPLEQ_FOREACH

#define XSIMPLEQ_FOREACH ( var,
head,
field )
Value:
for ((var) = XSIMPLEQ_FIRST(head); \
(var) != XSIMPLEQ_END(head); \
(var) = XSIMPLEQ_NEXT(head, var, field))

Definition at line 360 of file queue.h.

◆ XSIMPLEQ_FOREACH_SAFE

#define XSIMPLEQ_FOREACH_SAFE ( var,
head,
field,
tvar )
Value:
for ((var) = XSIMPLEQ_FIRST(head); \
(var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
(var) = (tvar))

Definition at line 365 of file queue.h.

◆ XSIMPLEQ_HEAD

#define XSIMPLEQ_HEAD ( name,
type )
Value:
struct name { \
struct type *sqx_first; /* first element */ \
struct type **sqx_last; /* addr of last next element */ \
unsigned long sqx_cookie; \
}

Definition at line 337 of file queue.h.

◆ XSIMPLEQ_INIT

#define XSIMPLEQ_INIT ( head)
Value:
do { \
arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
(head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
} while (0)

Definition at line 373 of file queue.h.

◆ XSIMPLEQ_INSERT_AFTER

#define XSIMPLEQ_INSERT_AFTER ( head,
listelm,
elm,
field )
Value:
do { \
if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
(listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
} while (0)

Definition at line 392 of file queue.h.

◆ XSIMPLEQ_INSERT_HEAD

#define XSIMPLEQ_INSERT_HEAD ( head,
elm,
field )
Value:
do { \
if (((elm)->field.sqx_next = (head)->sqx_first) == \
XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
(head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
} while (0)

Definition at line 379 of file queue.h.

◆ XSIMPLEQ_INSERT_TAIL

#define XSIMPLEQ_INSERT_TAIL ( head,
elm,
field )
Value:
do { \
(elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
*(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
} while (0)

Definition at line 386 of file queue.h.

◆ XSIMPLEQ_NEXT

#define XSIMPLEQ_NEXT ( head,
elm,
field )
Value:
XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))

Definition at line 357 of file queue.h.

◆ XSIMPLEQ_REMOVE_AFTER

#define XSIMPLEQ_REMOVE_AFTER ( head,
elm,
field )
Value:
do { \
if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
(elm)->field.sqx_next)->field.sqx_next) \
== XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = \
XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
} while (0)

Definition at line 405 of file queue.h.

◆ XSIMPLEQ_REMOVE_HEAD

#define XSIMPLEQ_REMOVE_HEAD ( head,
field )
Value:
do { \
if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
(head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
} while (0)

Definition at line 399 of file queue.h.

◆ XSIMPLEQ_XOR

#define XSIMPLEQ_XOR ( head,
ptr )
Value:
((__typeof(ptr))((head)->sqx_cookie ^ \
(unsigned long)(ptr)))

Definition at line 352 of file queue.h.