Lines Matching full:head
46 * added to the list after an existing element or at the head of the list.
47 * Elements being removed from the head of the list should use the explicit
57 * or after an existing element or at the head of the list. A list
60 * A simple queue is headed by a pair of pointers, one the head of the
63 * head of the list. New elements can be added to the list before or after
64 * an existing element, at the head of the list, or at the end of the
67 * A tail queue is headed by a pair of pointers, one to the head of the
71 * after an existing element, at the head of the list, or at the end of
74 * A circle queue is headed by a pair of pointers, one to the head of the
78 * an existing element, at the head of the list, or at the end of the list.
93 #define SLIST_HEAD_INITIALIZER(head) \ argument
106 #define SLIST_FIRST(head) ((head)->slh_first) argument
107 #define SLIST_END(head) NULL argument
108 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) argument
111 #define SLIST_FOREACH(var, head, field) \ argument
112 for((var) = SLIST_FIRST(head); \
113 (var) != SLIST_END(head); \
119 #define SLIST_INIT(head) { \ argument
120 SLIST_FIRST(head) = SLIST_END(head); \
128 #define SLIST_INSERT_HEAD(head, elm, field) do { \ argument
129 (elm)->field.sle_next = (head)->slh_first; \
130 (head)->slh_first = (elm); \
133 #define SLIST_REMOVE_HEAD(head, field) do { \ argument
134 (head)->slh_first = (head)->slh_first->field.sle_next; \
145 #define LIST_HEAD_INITIALIZER(head) \ argument
157 #define LIST_FIRST(head) ((head)->lh_first) argument
158 #define LIST_END(head) NULL argument
159 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head)) argument
162 #define LIST_FOREACH(var, head, field) \ argument
163 for((var) = LIST_FIRST(head); \
164 (var)!= LIST_END(head); \
170 #define LIST_INIT(head) do { \ argument
171 LIST_FIRST(head) = LIST_END(head); \
189 #define LIST_INSERT_HEAD(head, elm, field) do { \ argument
190 if (((elm)->field.le_next = (head)->lh_first) != NULL) \
191 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
192 (head)->lh_first = (elm); \
193 (elm)->field.le_prev = &(head)->lh_first; \
220 #define SIMPLEQ_HEAD_INITIALIZER(head) \ argument
221 { NULL, &(head).sqh_first }
231 #define SIMPLEQ_FIRST(head) ((head)->sqh_first) argument
232 #define SIMPLEQ_END(head) NULL argument
233 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) argument
236 #define SIMPLEQ_FOREACH(var, head, field) \ argument
237 for((var) = SIMPLEQ_FIRST(head); \
238 (var) != SIMPLEQ_END(head); \
244 #define SIMPLEQ_INIT(head) do { \ argument
245 (head)->sqh_first = NULL; \
246 (head)->sqh_last = &(head)->sqh_first; \
249 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ argument
250 if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
251 (head)->sqh_last = &(elm)->field.sqe_next; \
252 (head)->sqh_first = (elm); \
255 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ argument
257 *(head)->sqh_last = (elm); \
258 (head)->sqh_last = &(elm)->field.sqe_next; \
261 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
263 (head)->sqh_last = &(elm)->field.sqe_next; \
267 #define SIMPLEQ_REMOVE_HEAD(head, elm, field) do { \ argument
268 if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) \
269 (head)->sqh_last = &(head)->sqh_first; \
281 #define TAILQ_HEAD_INITIALIZER(head) \ argument
282 { NULL, &(head).tqh_first }
293 #define TAILQ_FIRST(head) ((head)->tqh_first) argument
294 #define TAILQ_END(head) NULL argument
296 #define TAILQ_LAST(head, headname) \ argument
297 (*(((struct headname *)((head)->tqh_last))->tqh_last))
301 #define TAILQ_EMPTY(head) \ argument
302 (TAILQ_FIRST(head) == TAILQ_END(head))
304 #define TAILQ_FOREACH(var, head, field) \ argument
305 for((var) = TAILQ_FIRST(head); \
306 (var) != TAILQ_END(head); \
309 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ argument
310 for((var) = TAILQ_LAST(head, headname); \
311 (var) != TAILQ_END(head); \
317 #define TAILQ_INIT(head) do { \ argument
318 (head)->tqh_first = NULL; \
319 (head)->tqh_last = &(head)->tqh_first; \
322 #define TAILQ_INSERT_HEAD(head, elm, field) do { \ argument
323 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
324 (head)->tqh_first->field.tqe_prev = \
327 (head)->tqh_last = &(elm)->field.tqe_next; \
328 (head)->tqh_first = (elm); \
329 (elm)->field.tqe_prev = &(head)->tqh_first; \
332 #define TAILQ_INSERT_TAIL(head, elm, field) do { \ argument
334 (elm)->field.tqe_prev = (head)->tqh_last; \
335 *(head)->tqh_last = (elm); \
336 (head)->tqh_last = &(elm)->field.tqe_next; \
339 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
344 (head)->tqh_last = &(elm)->field.tqe_next; \
356 #define TAILQ_REMOVE(head, elm, field) do { \ argument
361 (head)->tqh_last = (elm)->field.tqe_prev; \
365 #define TAILQ_REPLACE(head, elm, elm2, field) do { \ argument
370 (head)->tqh_last = &(elm2)->field.tqe_next; \
384 #define CIRCLEQ_HEAD_INITIALIZER(head) \ argument
385 { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
396 #define CIRCLEQ_FIRST(head) ((head)->cqh_first) argument
397 #define CIRCLEQ_LAST(head) ((head)->cqh_last) argument
398 #define CIRCLEQ_END(head) ((void *)(head)) argument
401 #define CIRCLEQ_EMPTY(head) \ argument
402 (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
404 #define CIRCLEQ_FOREACH(var, head, field) \ argument
405 for((var) = CIRCLEQ_FIRST(head); \
406 (var) != CIRCLEQ_END(head); \
409 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ argument
410 for((var) = CIRCLEQ_LAST(head); \
411 (var) != CIRCLEQ_END(head); \
417 #define CIRCLEQ_INIT(head) do { \ argument
418 (head)->cqh_first = CIRCLEQ_END(head); \
419 (head)->cqh_last = CIRCLEQ_END(head); \
422 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
425 if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
426 (head)->cqh_last = (elm); \
432 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ argument
435 if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
436 (head)->cqh_first = (elm); \
442 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ argument
443 (elm)->field.cqe_next = (head)->cqh_first; \
444 (elm)->field.cqe_prev = CIRCLEQ_END(head); \
445 if ((head)->cqh_last == CIRCLEQ_END(head)) \
446 (head)->cqh_last = (elm); \
448 (head)->cqh_first->field.cqe_prev = (elm); \
449 (head)->cqh_first = (elm); \
452 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ argument
453 (elm)->field.cqe_next = CIRCLEQ_END(head); \
454 (elm)->field.cqe_prev = (head)->cqh_last; \
455 if ((head)->cqh_first == CIRCLEQ_END(head)) \
456 (head)->cqh_first = (elm); \
458 (head)->cqh_last->field.cqe_next = (elm); \
459 (head)->cqh_last = (elm); \
462 #define CIRCLEQ_REMOVE(head, elm, field) do { \ argument
463 if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
464 (head)->cqh_last = (elm)->field.cqe_prev; \
468 if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
469 (head)->cqh_first = (elm)->field.cqe_next; \
475 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ argument
477 CIRCLEQ_END(head)) \
478 (head).cqh_last = (elm2); \
482 CIRCLEQ_END(head)) \
483 (head).cqh_first = (elm2); \