Lines Matching refs:head

94 #define	LIST_HEAD_INITIALIZER(head)					\  argument
107 #define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \ argument
108 if ((head)->lh_first && \
109 (head)->lh_first->field.le_prev != &(head)->lh_first) \
110 panic("LIST_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
122 #define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) argument
127 #define LIST_INIT(head) do { \ argument
128 (head)->lh_first = NULL; \
148 #define LIST_INSERT_HEAD(head, elm, field) do { \ argument
149 QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
150 if (((elm)->field.le_next = (head)->lh_first) != NULL) \
151 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
152 (head)->lh_first = (elm); \
153 (elm)->field.le_prev = &(head)->lh_first; \
165 #define LIST_FOREACH(var, head, field) \ argument
166 for ((var) = ((head)->lh_first); \
173 #define LIST_EMPTY(head) ((head)->lh_first == NULL) argument
174 #define LIST_FIRST(head) ((head)->lh_first) argument
177 #define LIST_FOREACH_SAFE(var, head, field, tvar) \ argument
178 for ((var) = LIST_FIRST((head)); \
190 #define SLIST_HEAD_INITIALIZER(head) \ argument
201 #define SLIST_INIT(head) do { \ argument
202 (head)->slh_first = NULL; \
210 #define SLIST_INSERT_HEAD(head, elm, field) do { \ argument
211 (elm)->field.sle_next = (head)->slh_first; \
212 (head)->slh_first = (elm); \
215 #define SLIST_REMOVE_HEAD(head, field) do { \ argument
216 (head)->slh_first = (head)->slh_first->field.sle_next; \
219 #define SLIST_REMOVE(head, elm, type, field) do { \ argument
220 if ((head)->slh_first == (elm)) { \
221 SLIST_REMOVE_HEAD((head), field); \
224 struct type *curelm = (head)->slh_first; \
237 #define SLIST_FOREACH(var, head, field) \ argument
238 for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
240 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ argument
241 for ((var) = SLIST_FIRST((head)); \
248 #define SLIST_EMPTY(head) ((head)->slh_first == NULL) argument
249 #define SLIST_FIRST(head) ((head)->slh_first) argument
261 #define STAILQ_HEAD_INITIALIZER(head) \ argument
262 { NULL, &(head).stqh_first }
272 #define STAILQ_INIT(head) do { \ argument
273 (head)->stqh_first = NULL; \
274 (head)->stqh_last = &(head)->stqh_first; \
277 #define STAILQ_INSERT_HEAD(head, elm, field) do { \ argument
278 if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
279 (head)->stqh_last = &(elm)->field.stqe_next; \
280 (head)->stqh_first = (elm); \
283 #define STAILQ_INSERT_TAIL(head, elm, field) do { \ argument
285 *(head)->stqh_last = (elm); \
286 (head)->stqh_last = &(elm)->field.stqe_next; \
289 #define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
291 (head)->stqh_last = &(elm)->field.stqe_next; \
295 #define STAILQ_REMOVE_HEAD(head, field) do { \ argument
296 if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
297 (head)->stqh_last = &(head)->stqh_first; \
300 #define STAILQ_REMOVE(head, elm, type, field) do { \ argument
301 if ((head)->stqh_first == (elm)) { \
302 STAILQ_REMOVE_HEAD((head), field); \
304 struct type *curelm = (head)->stqh_first; \
309 (head)->stqh_last = &(curelm)->field.stqe_next; \
313 #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ argument
316 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
319 #define STAILQ_FOREACH(var, head, field) \ argument
320 for ((var) = ((head)->stqh_first); \
324 #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ argument
325 for ((var) = STAILQ_FIRST((head)); \
340 #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) argument
341 #define STAILQ_FIRST(head) ((head)->stqh_first) argument
353 #define SIMPLEQ_HEAD_INITIALIZER(head) \ argument
354 { NULL, &(head).sqh_first }
364 #define SIMPLEQ_INIT(head) do { \ argument
365 (head)->sqh_first = NULL; \
366 (head)->sqh_last = &(head)->sqh_first; \
369 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ argument
370 if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
371 (head)->sqh_last = &(elm)->field.sqe_next; \
372 (head)->sqh_first = (elm); \
375 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ argument
377 *(head)->sqh_last = (elm); \
378 (head)->sqh_last = &(elm)->field.sqe_next; \
381 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
383 (head)->sqh_last = &(elm)->field.sqe_next; \
387 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \ argument
388 if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
389 (head)->sqh_last = &(head)->sqh_first; \
392 #define SIMPLEQ_REMOVE(head, elm, type, field) do { \ argument
393 if ((head)->sqh_first == (elm)) { \
394 SIMPLEQ_REMOVE_HEAD((head), field); \
396 struct type *curelm = (head)->sqh_first; \
401 (head)->sqh_last = &(curelm)->field.sqe_next; \
405 #define SIMPLEQ_FOREACH(var, head, field) \ argument
406 for ((var) = ((head)->sqh_first); \
413 #define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) argument
414 #define SIMPLEQ_FIRST(head) ((head)->sqh_first) argument
427 #define TAILQ_HEAD_INITIALIZER(head) \ argument
428 { NULL, &(head).tqh_first }
441 #define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \ argument
442 if ((head)->tqh_first && \
443 (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
444 panic("TAILQ_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
445 #define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \ argument
446 if (*(head)->tqh_last != NULL) \
447 panic("TAILQ_INSERT_TAIL %p %s:%d", (head), __FILE__, __LINE__);
455 #define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \ argument
457 (head)->tqh_last != &(elm)->field.tqe_next) \
459 (head), (elm), __FILE__, __LINE__);
464 #define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) argument
465 #define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) argument
467 #define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) argument
471 #define TAILQ_INIT(head) do { \ argument
472 (head)->tqh_first = NULL; \
473 (head)->tqh_last = &(head)->tqh_first; \
476 #define TAILQ_INSERT_HEAD(head, elm, field) do { \ argument
477 QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
478 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
479 (head)->tqh_first->field.tqe_prev = \
482 (head)->tqh_last = &(elm)->field.tqe_next; \
483 (head)->tqh_first = (elm); \
484 (elm)->field.tqe_prev = &(head)->tqh_first; \
487 #define TAILQ_INSERT_TAIL(head, elm, field) do { \ argument
488 QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
490 (elm)->field.tqe_prev = (head)->tqh_last; \
491 *(head)->tqh_last = (elm); \
492 (head)->tqh_last = &(elm)->field.tqe_next; \
495 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
501 (head)->tqh_last = &(elm)->field.tqe_next; \
514 #define TAILQ_REMOVE(head, elm, field) do { \ argument
515 QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
521 (head)->tqh_last = (elm)->field.tqe_prev; \
526 #define TAILQ_FOREACH(var, head, field) \ argument
527 for ((var) = ((head)->tqh_first); \
531 #define TAILQ_FOREACH_SAFE(var, head, field, next) \ argument
532 for ((var) = ((head)->tqh_first); \
536 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ argument
537 for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
541 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \ argument
542 for ((var) = TAILQ_LAST((head), headname); \
558 #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) argument
559 #define TAILQ_FIRST(head) ((head)->tqh_first) argument
562 #define TAILQ_LAST(head, headname) \ argument
563 (*(((struct headname *)((head)->tqh_last))->tqh_last))
571 #define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \ argument
572 if ((head)->cqh_first != (void *)(head) && \
573 (head)->cqh_first->field.cqe_prev != (void *)(head)) \
574 panic("CIRCLEQ head forw %p %s:%d", (head), \
576 if ((head)->cqh_last != (void *)(head) && \
577 (head)->cqh_last->field.cqe_next != (void *)(head)) \
578 panic("CIRCLEQ head back %p %s:%d", (head), \
580 #define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \ argument
581 if ((elm)->field.cqe_next == (void *)(head)) { \
582 if ((head)->cqh_last != (elm)) \
590 if ((elm)->field.cqe_prev == (void *)(head)) { \
591 if ((head)->cqh_first != (elm)) \
603 #define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) argument
604 #define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) argument
614 #define CIRCLEQ_HEAD_INITIALIZER(head) \ argument
615 { (void *)&head, (void *)&head }
626 #define CIRCLEQ_INIT(head) do { \ argument
627 (head)->cqh_first = (void *)(head); \
628 (head)->cqh_last = (void *)(head); \
631 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ argument
632 QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
633 QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
636 if ((listelm)->field.cqe_next == (void *)(head)) \
637 (head)->cqh_last = (elm); \
643 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ argument
644 QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
645 QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
648 if ((listelm)->field.cqe_prev == (void *)(head)) \
649 (head)->cqh_first = (elm); \
655 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ argument
656 QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
657 (elm)->field.cqe_next = (head)->cqh_first; \
658 (elm)->field.cqe_prev = (void *)(head); \
659 if ((head)->cqh_last == (void *)(head)) \
660 (head)->cqh_last = (elm); \
662 (head)->cqh_first->field.cqe_prev = (elm); \
663 (head)->cqh_first = (elm); \
666 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ argument
667 QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
668 (elm)->field.cqe_next = (void *)(head); \
669 (elm)->field.cqe_prev = (head)->cqh_last; \
670 if ((head)->cqh_first == (void *)(head)) \
671 (head)->cqh_first = (elm); \
673 (head)->cqh_last->field.cqe_next = (elm); \
674 (head)->cqh_last = (elm); \
677 #define CIRCLEQ_REMOVE(head, elm, field) do { \ argument
678 QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
679 QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
680 if ((elm)->field.cqe_next == (void *)(head)) \
681 (head)->cqh_last = (elm)->field.cqe_prev; \
685 if ((elm)->field.cqe_prev == (void *)(head)) \
686 (head)->cqh_first = (elm)->field.cqe_next; \
693 #define CIRCLEQ_FOREACH(var, head, field) \ argument
694 for ((var) = ((head)->cqh_first); \
695 (var) != (const void *)(head); \
698 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ argument
699 for ((var) = ((head)->cqh_last); \
700 (var) != (const void *)(head); \
706 #define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) argument
707 #define CIRCLEQ_FIRST(head) ((head)->cqh_first) argument
708 #define CIRCLEQ_LAST(head) ((head)->cqh_last) argument
712 #define CIRCLEQ_LOOP_NEXT(head, elm, field) \ argument
713 (((elm)->field.cqe_next == (void *)(head)) \
714 ? ((head)->cqh_first) \
716 #define CIRCLEQ_LOOP_PREV(head, elm, field) \ argument
717 (((elm)->field.cqe_prev == (void *)(head)) \
718 ? ((head)->cqh_last) \