Lines Matching defs:head

120 /* Enqueue element to head of queue */
130 /* Dequeue element from head of queue */
344 #define queue_enter(head, elt, type, field) \
348 __prev = (head)->prev; \
349 if ((head) == __prev) { \
350 (head)->next = (queue_entry_t) (elt); \
356 (elt)->field.next = head; \
357 (head)->prev = (queue_entry_t) elt; \
363 * Insert a new element at the head of the queue.
371 #define queue_enter_first(head, elt, type, field) \
375 __next = (head)->next; \
376 if ((head) == __next) { \
377 (head)->prev = (queue_entry_t) (elt); \
383 (elt)->field.prev = head; \
384 (head)->next = (queue_entry_t) elt; \
399 #define queue_insert_before(head, elt, cur, type, field) \
403 if ((head) == (queue_entry_t)(cur)) { \
404 (elt)->field.next = (head); \
405 if ((head)->next == (head)) { /* only element */ \
406 (elt)->field.prev = (head); \
407 (head)->next = (queue_entry_t)(elt); \
409 __prev = (elt)->field.prev = (head)->prev; \
412 (head)->prev = (queue_entry_t)(elt); \
415 if ((head)->next == (queue_entry_t)(cur)) { \
417 (elt)->field.prev = (head); \
418 (head)->next = (queue_entry_t)(elt); \
439 #define queue_insert_after(head, elt, cur, type, field) \
443 if ((head) == (queue_entry_t)(cur)) { \
444 (elt)->field.prev = (head); \
445 if ((head)->next == (head)) { /* only element */ \
446 (elt)->field.next = (head); \
447 (head)->prev = (queue_entry_t)(elt); \
449 __next = (elt)->field.next = (head)->next; \
452 (head)->next = (queue_entry_t)(elt); \
455 if ((head)->prev == (queue_entry_t)(cur)) { \
457 (elt)->field.next = (head); \
458 (head)->prev = (queue_entry_t)(elt); \
471 * given element (thing) in the given queue (head)
473 #define queue_field(head, thing, type, field) \
474 (((head) == (thing)) ? (head) : &((type)(thing))->field)
484 #define queue_remove(head, elt, type, field) \
491 if ((head) == __next) \
492 (head)->prev = __prev; \
496 if ((head) == __prev) \
497 (head)->next = __next; \
508 * Remove and return the entry at the head of
511 * queue_remove_first(head, entry, type, field)
514 #define queue_remove_first(head, entry, type, field) \
518 (entry) = (type) ((head)->next); \
521 if ((head) == __next) \
522 (head)->prev = (head); \
524 ((type)(__next))->field.prev = (head); \
525 (head)->next = __next; \
537 * queue_remove_last(head, entry, type, field)
540 #define queue_remove_last(head, entry, type, field) \
544 (entry) = (type) ((head)->prev); \
547 if ((head) == __prev) \
548 (head)->next = (head); \
550 ((type)(__prev))->field.next = (head); \
551 (head)->prev = __prev; \
570 * rebase old queue to new queue head
602 #define queue_iterate(head, elt, type, field) \
603 for ((elt) = (type) queue_first(head); \
604 !queue_end((head), (queue_entry_t)(elt)); \
616 struct queue_entry head; /* header for queue */
634 queue_init(&(q)->head); \
645 queue_init(&(q)->head); \
656 enqueue_tail(&(q)->head, elt); \
663 if (queue_empty(&(q)->head)) \
666 *(elt) = dequeue_head(&(q)->head); \