Lines Matching refs:head

45  * added to the list after an existing element or at the head of the list.
46 * Elements being removed from the head of the list should use the explicit
53 * head of the list and the other to the tail of the list. The elements are
56 * to the list after an existing element, at the head of the list, or at the
57 * end of the list. Elements being removed from the head of the tail queue
67 * or after an existing element or at the head of the list. A list
70 * A tail queue is headed by a pair of pointers, one to the head of the
74 * after an existing element, at the head of the list, or at the end of
112 #define SLIST_HEAD_INITIALIZER(head) \
123 #define SLIST_EMPTY(head) ((head)->slh_first == NULL)
125 #define SLIST_FIRST(head) ((head)->slh_first)
127 #define SLIST_FOREACH(var, head, field) \
128 for ((var) = SLIST_FIRST((head)); \
132 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
133 for ((var) = SLIST_FIRST((head)); \
137 #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
138 for ((varp) = &SLIST_FIRST((head)); \
142 #define SLIST_INIT(head) do { \
143 SLIST_FIRST((head)) = NULL; \
151 #define SLIST_INSERT_HEAD(head, elm, field) do { \
152 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
153 SLIST_FIRST((head)) = (elm); \
158 #define SLIST_REMOVE(head, elm, type, field) do { \
159 if (SLIST_FIRST((head)) == (elm)) { \
160 SLIST_REMOVE_HEAD((head), field); \
163 struct type *curelm = SLIST_FIRST((head)); \
171 #define SLIST_REMOVE_HEAD(head, field) do { \
172 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
184 #define STAILQ_HEAD_INITIALIZER(head) \
185 { NULL, &(head).stqh_first }
203 #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
205 #define STAILQ_FIRST(head) ((head)->stqh_first)
207 #define STAILQ_FOREACH(var, head, field) \
208 for((var) = STAILQ_FIRST((head)); \
213 #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
214 for ((var) = STAILQ_FIRST((head)); \
218 #define STAILQ_INIT(head) do { \
219 STAILQ_FIRST((head)) = NULL; \
220 (head)->stqh_last = &STAILQ_FIRST((head)); \
223 #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
225 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
229 #define STAILQ_INSERT_HEAD(head, elm, field) do { \
230 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
231 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
232 STAILQ_FIRST((head)) = (elm); \
235 #define STAILQ_INSERT_TAIL(head, elm, field) do { \
237 *(head)->stqh_last = (elm); \
238 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
241 #define STAILQ_LAST(head, type, field) \
242 (STAILQ_EMPTY((head)) ? \
245 ((char *)((head)->stqh_last) - offsetof(struct type, field))))
249 #define STAILQ_REMOVE(head, elm, type, field) do { \
250 if (STAILQ_FIRST((head)) == (elm)) { \
251 STAILQ_REMOVE_HEAD((head), field); \
254 struct type *curelm = STAILQ_FIRST((head)); \
259 (head)->stqh_last = &STAILQ_NEXT((curelm), field);\
263 #define STAILQ_REMOVE_HEAD(head, field) do { \
264 if ((STAILQ_FIRST((head)) = \
265 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
266 (head)->stqh_last = &STAILQ_FIRST((head)); \
269 #define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
270 if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
271 (head)->stqh_last = &STAILQ_FIRST((head)); \
282 #define LIST_HEAD_INITIALIZER(head) \
295 #define LIST_EMPTY(head) ((head)->lh_first == NULL)
297 #define LIST_FIRST(head) ((head)->lh_first)
299 #define LIST_FOREACH(var, head, field) \
300 for ((var) = LIST_FIRST((head)); \
304 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
305 for ((var) = LIST_FIRST((head)); \
309 #define LIST_INIT(head) do { \
310 LIST_FIRST((head)) = NULL; \
328 #define LIST_INSERT_HEAD(head, elm, field) do { \
329 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
330 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
331 LIST_FIRST((head)) = (elm); \
332 (elm)->field.le_prev = &LIST_FIRST((head)); \
353 #define TAILQ_HEAD_INITIALIZER(head) \
354 { NULL, &(head).tqh_first }
374 #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
376 #define TAILQ_FIRST(head) ((head)->tqh_first)
378 #define TAILQ_FOREACH(var, head, field) \
379 for ((var) = TAILQ_FIRST((head)); \
383 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
384 for ((var) = TAILQ_FIRST((head)); \
388 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
389 for ((var) = TAILQ_LAST((head), headname); \
393 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
394 for ((var) = TAILQ_LAST((head), headname); \
398 #define TAILQ_INIT(head) do { \
399 TAILQ_FIRST((head)) = NULL; \
400 (head)->tqh_last = &TAILQ_FIRST((head)); \
403 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
408 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
421 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
422 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
423 TAILQ_FIRST((head))->field.tqe_prev = \
426 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
427 TAILQ_FIRST((head)) = (elm); \
428 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
431 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
433 (elm)->field.tqe_prev = (head)->tqh_last; \
434 *(head)->tqh_last = (elm); \
435 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
438 #define TAILQ_LAST(head, headname) \
439 (*(((struct headname *)((head)->tqh_last))->tqh_last))
446 #define TAILQ_REMOVE(head, elm, field) do { \
451 (head)->tqh_last = (elm)->field.tqe_prev; \