Lines Matching refs:field
196 #define SLIST_FOREACH(var, head, field) \
199 (var) = SLIST_NEXT((var), field))
201 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \
203 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
206 #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
209 (varp) = &SLIST_NEXT((var), field))
215 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
216 SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
217 SLIST_NEXT((slistelm), field) = (elm); \
220 #define SLIST_INSERT_HEAD(head, elm, field) do { \
221 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
225 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
227 #define SLIST_REMOVE(head, elm, type, field) do { \
229 SLIST_REMOVE_HEAD((head), field); \
233 while (SLIST_NEXT(curelm, field) != (elm)) \
234 curelm = SLIST_NEXT(curelm, field); \
235 SLIST_NEXT(curelm, field) = \
236 SLIST_NEXT(SLIST_NEXT(curelm, field), field); \
238 TRASHIT((elm)->field.sle_next); \
241 #define SLIST_REMOVE_HEAD(head, field) do { \
242 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
277 #define STAILQ_FOREACH(var, head, field) \
280 (var) = STAILQ_NEXT((var), field))
283 #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
285 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
293 #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
294 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
295 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
296 STAILQ_NEXT((tqelm), field) = (elm); \
299 #define STAILQ_INSERT_HEAD(head, elm, field) do { \
300 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
301 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
305 #define STAILQ_INSERT_TAIL(head, elm, field) do { \
306 STAILQ_NEXT((elm), field) = NULL; \
308 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
311 #define STAILQ_LAST(head, type, field) \
315 ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
317 #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
319 #define STAILQ_REMOVE(head, elm, type, field) do { \
321 STAILQ_REMOVE_HEAD((head), field); \
325 while (STAILQ_NEXT(curelm, field) != (elm)) \
326 curelm = STAILQ_NEXT(curelm, field); \
327 if ((STAILQ_NEXT(curelm, field) = \
328 STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
329 (head)->stqh_last = &STAILQ_NEXT((curelm), field);\
331 TRASHIT((elm)->field.stqe_next); \
334 #define STAILQ_REMOVE_HEAD(head, field) do { \
336 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
340 #define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
341 if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
367 #define QMD_LIST_CHECK_HEAD(head, field) do { \
369 LIST_FIRST((head))->field.le_prev != \
374 #define QMD_LIST_CHECK_NEXT(elm, field) do { \
375 if (LIST_NEXT((elm), field) != NULL && \
376 LIST_NEXT((elm), field)->field.le_prev != \
377 &((elm)->field.le_next)) \
381 #define QMD_LIST_CHECK_PREV(elm, field) do { \
382 if (*(elm)->field.le_prev != (elm)) \
386 #define QMD_LIST_CHECK_HEAD(head, field)
387 #define QMD_LIST_CHECK_NEXT(elm, field)
388 #define QMD_LIST_CHECK_PREV(elm, field)
395 #define LIST_FOREACH(var, head, field) \
398 (var) = LIST_NEXT((var), field))
400 #define LIST_FOREACH_SAFE(var, head, field, tvar) \
402 (var) && ((tvar) = LIST_NEXT((var), field), 1); \
409 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
410 QMD_LIST_CHECK_NEXT(listelm, field); \
411 if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
412 LIST_NEXT((listelm), field)->field.le_prev = \
413 &LIST_NEXT((elm), field); \
414 LIST_NEXT((listelm), field) = (elm); \
415 (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
418 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
419 QMD_LIST_CHECK_PREV(listelm, field); \
420 (elm)->field.le_prev = (listelm)->field.le_prev; \
421 LIST_NEXT((elm), field) = (listelm); \
422 *(listelm)->field.le_prev = (elm); \
423 (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
426 #define LIST_INSERT_HEAD(head, elm, field) do { \
427 QMD_LIST_CHECK_HEAD((head), field); \
428 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
429 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
431 (elm)->field.le_prev = &LIST_FIRST((head)); \
434 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
436 #define LIST_REMOVE(elm, field) do { \
437 QMD_LIST_CHECK_NEXT(elm, field); \
438 QMD_LIST_CHECK_PREV(elm, field); \
439 if (LIST_NEXT((elm), field) != NULL) \
440 LIST_NEXT((elm), field)->field.le_prev = \
441 (elm)->field.le_prev; \
442 *(elm)->field.le_prev = LIST_NEXT((elm), field); \
443 TRASHIT((elm)->field.le_next); \
444 TRASHIT((elm)->field.le_prev); \
470 #define TAILQ_CONCAT(head1, head2, field) do { \
473 (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
485 #define TAILQ_FOREACH(var, head, field) \
488 (var) = TAILQ_NEXT((var), field))
490 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
492 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
495 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
498 (var) = TAILQ_PREV((var), headname, field))
500 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
502 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
511 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
512 if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
513 TAILQ_NEXT((elm), field)->field.tqe_prev = \
514 &TAILQ_NEXT((elm), field); \
516 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
519 TAILQ_NEXT((listelm), field) = (elm); \
520 (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
521 QMD_TRACE_ELEM(&(elm)->field); \
522 QMD_TRACE_ELEM(&listelm->field); \
525 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
526 (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
527 TAILQ_NEXT((elm), field) = (listelm); \
528 *(listelm)->field.tqe_prev = (elm); \
529 (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
530 QMD_TRACE_ELEM(&(elm)->field); \
531 QMD_TRACE_ELEM(&listelm->field); \
534 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
535 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
536 TAILQ_FIRST((head))->field.tqe_prev = \
537 &TAILQ_NEXT((elm), field); \
539 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
541 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
543 QMD_TRACE_ELEM(&(elm)->field); \
546 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
547 TAILQ_NEXT((elm), field) = NULL; \
548 (elm)->field.tqe_prev = (head)->tqh_last; \
550 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
552 QMD_TRACE_ELEM(&(elm)->field); \
558 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
560 #define TAILQ_PREV(elm, headname, field) \
561 (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
563 #define TAILQ_REMOVE(head, elm, field) do { \
564 if ((TAILQ_NEXT((elm), field)) != NULL) \
565 TAILQ_NEXT((elm), field)->field.tqe_prev = \
566 (elm)->field.tqe_prev; \
568 (head)->tqh_last = (elm)->field.tqe_prev; \
571 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
572 TRASHIT((elm)->field.tqe_next); \
573 TRASHIT((elm)->field.tqe_prev); \
574 QMD_TRACE_ELEM(&(elm)->field); \
599 #define CIRCLEQ_FOREACH(var, head, field) \
602 (var) = (var)->field.cqe_next)
609 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
610 (elm)->field.cqe_next = (listelm)->field.cqe_next; \
611 (elm)->field.cqe_prev = (listelm); \
612 if ((listelm)->field.cqe_next == (void *)(head)) \
615 (listelm)->field.cqe_next->field.cqe_prev = (elm); \
616 (listelm)->field.cqe_next = (elm); \
619 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
620 (elm)->field.cqe_next = (listelm); \
621 (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
622 if ((listelm)->field.cqe_prev == (void *)(head)) \
625 (listelm)->field.cqe_prev->field.cqe_next = (elm); \
626 (listelm)->field.cqe_prev = (elm); \
629 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
630 (elm)->field.cqe_next = (head)->cqh_first; \
631 (elm)->field.cqe_prev = (void *)(head); \
635 (head)->cqh_first->field.cqe_prev = (elm); \
639 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
640 (elm)->field.cqe_next = (void *)(head); \
641 (elm)->field.cqe_prev = (head)->cqh_last; \
645 (head)->cqh_last->field.cqe_next = (elm); \
651 #define CIRCLEQ_NEXT(elm,field) ((elm)->field.cqe_next)
653 #define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev)
655 #define CIRCLEQ_REMOVE(head, elm, field) do { \
656 if ((elm)->field.cqe_next == (void *)(head)) \
657 (head)->cqh_last = (elm)->field.cqe_prev; \
659 (elm)->field.cqe_next->field.cqe_prev = \
660 (elm)->field.cqe_prev; \
661 if ((elm)->field.cqe_prev == (void *)(head)) \
662 (head)->cqh_first = (elm)->field.cqe_next; \
664 (elm)->field.cqe_prev->field.cqe_next = \
665 (elm)->field.cqe_next; \