Lines Matching refs:elm
179 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
180 SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
181 SLIST_NEXT((slistelm), field) = (elm); \
184 #define SLIST_INSERT_HEAD(head, elm, field) do { \
185 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
186 SLIST_FIRST((head)) = (elm); \
189 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
191 #define SLIST_REMOVE(head, elm, type, field) do { \
192 if (SLIST_FIRST((head)) == (elm)) { \
197 while (SLIST_NEXT(curelm, field) != (elm)) \
202 TRASHIT((elm)->field.sle_next); \
257 #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
258 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
259 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
260 STAILQ_NEXT((tqelm), field) = (elm); \
263 #define STAILQ_INSERT_HEAD(head, elm, field) do { \
264 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
265 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
266 STAILQ_FIRST((head)) = (elm); \
269 #define STAILQ_INSERT_TAIL(head, elm, field) do { \
270 STAILQ_NEXT((elm), field) = NULL; \
271 *(head)->stqh_last = (elm); \
272 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
281 #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
283 #define STAILQ_REMOVE(head, elm, type, field) do { \
284 if (STAILQ_FIRST((head)) == (elm)) { \
289 while (STAILQ_NEXT(curelm, field) != (elm)) \
295 TRASHIT((elm)->field.stqe_next); \
304 #define STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
305 if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL) \
338 #define QMD_LIST_CHECK_NEXT(elm, field) do { \
339 if (LIST_NEXT((elm), field) != NULL && \
340 LIST_NEXT((elm), field)->field.le_prev != \
341 &((elm)->field.le_next)) \
342 panic("Bad link elm %p next->prev != elm", (elm)); \
345 #define QMD_LIST_CHECK_PREV(elm, field) do { \
346 if (*(elm)->field.le_prev != (elm)) \
347 panic("Bad link elm %p prev->next != elm", (elm)); \
351 #define QMD_LIST_CHECK_NEXT(elm, field)
352 #define QMD_LIST_CHECK_PREV(elm, field)
373 #define LIST_INSERT_AFTER(listelm, elm, field) do { \
375 if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
377 &LIST_NEXT((elm), field); \
378 LIST_NEXT((listelm), field) = (elm); \
379 (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
382 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
384 (elm)->field.le_prev = (listelm)->field.le_prev; \
385 LIST_NEXT((elm), field) = (listelm); \
386 *(listelm)->field.le_prev = (elm); \
387 (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
390 #define LIST_INSERT_HEAD(head, elm, field) do { \
392 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
393 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
394 LIST_FIRST((head)) = (elm); \
395 (elm)->field.le_prev = &LIST_FIRST((head)); \
398 #define LIST_NEXT(elm, field) ((elm)->field.le_next)
400 #define LIST_REMOVE(elm, field) do { \
401 QMD_LIST_CHECK_NEXT(elm, field); \
402 QMD_LIST_CHECK_PREV(elm, field); \
403 if (LIST_NEXT((elm), field) != NULL) \
404 LIST_NEXT((elm), field)->field.le_prev = \
405 (elm)->field.le_prev; \
406 *(elm)->field.le_prev = LIST_NEXT((elm), field); \
407 TRASHIT((elm)->field.le_next); \
408 TRASHIT((elm)->field.le_prev); \
447 #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
448 if (TAILQ_NEXT((elm), field) != NULL && \
449 TAILQ_NEXT((elm), field)->field.tqe_prev != \
450 &((elm)->field.tqe_next)) \
451 panic("Bad link elm %p next->prev != elm", (elm)); \
454 #define QMD_TAILQ_CHECK_PREV(elm, field) do { \
455 if (*(elm)->field.tqe_prev != (elm)) \
456 panic("Bad link elm %p prev->next != elm", (elm)); \
461 #define QMD_TAILQ_CHECK_NEXT(elm, field)
462 #define QMD_TAILQ_CHECK_PREV(elm, field)
506 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
508 if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
509 TAILQ_NEXT((elm), field)->field.tqe_prev = \
510 &TAILQ_NEXT((elm), field); \
512 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
515 TAILQ_NEXT((listelm), field) = (elm); \
516 (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
517 QMD_TRACE_ELEM(&(elm)->field); \
521 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
523 (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
524 TAILQ_NEXT((elm), field) = (listelm); \
525 *(listelm)->field.tqe_prev = (elm); \
526 (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
527 QMD_TRACE_ELEM(&(elm)->field); \
531 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
533 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
535 &TAILQ_NEXT((elm), field); \
537 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
538 TAILQ_FIRST((head)) = (elm); \
539 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
541 QMD_TRACE_ELEM(&(elm)->field); \
544 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
546 TAILQ_NEXT((elm), field) = NULL; \
547 (elm)->field.tqe_prev = (head)->tqh_last; \
548 *(head)->tqh_last = (elm); \
549 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
551 QMD_TRACE_ELEM(&(elm)->field); \
557 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
559 #define TAILQ_PREV(elm, headname, field) \
560 (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
562 #define TAILQ_REMOVE(head, elm, field) do { \
563 QMD_TAILQ_CHECK_NEXT(elm, field); \
564 QMD_TAILQ_CHECK_PREV(elm, field); \
565 if ((TAILQ_NEXT((elm), field)) != NULL) \
566 TAILQ_NEXT((elm), field)->field.tqe_prev = \
567 (elm)->field.tqe_prev; \
569 (head)->tqh_last = (elm)->field.tqe_prev; \
572 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
573 TRASHIT((elm)->field.tqe_next); \
574 TRASHIT((elm)->field.tqe_prev); \
575 QMD_TRACE_ELEM(&(elm)->field); \