1*7c478bd9Sstevel@tonic-gate /* BSDI $Id: queue.h,v 2.4 1996/07/02 13:22:11 bostic Exp $ */ 2*7c478bd9Sstevel@tonic-gate 3*7c478bd9Sstevel@tonic-gate /* 4*7c478bd9Sstevel@tonic-gate * Copyright (c) 1991, 1993 5*7c478bd9Sstevel@tonic-gate * The Regents of the University of California. All rights reserved. 6*7c478bd9Sstevel@tonic-gate * 7*7c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 8*7c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 9*7c478bd9Sstevel@tonic-gate * are met: 10*7c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 11*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 12*7c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 13*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 14*7c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 15*7c478bd9Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this software 16*7c478bd9Sstevel@tonic-gate * must display the following acknowledgement: 17*7c478bd9Sstevel@tonic-gate * This product includes software developed by the University of 18*7c478bd9Sstevel@tonic-gate * California, Berkeley and its contributors. 19*7c478bd9Sstevel@tonic-gate * 4. Neither the name of the University nor the names of its contributors 20*7c478bd9Sstevel@tonic-gate * may be used to endorse or promote products derived from this software 21*7c478bd9Sstevel@tonic-gate * without specific prior written permission. 22*7c478bd9Sstevel@tonic-gate * 23*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24*7c478bd9Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26*7c478bd9Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27*7c478bd9Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28*7c478bd9Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29*7c478bd9Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30*7c478bd9Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31*7c478bd9Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32*7c478bd9Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33*7c478bd9Sstevel@tonic-gate * SUCH DAMAGE. 34*7c478bd9Sstevel@tonic-gate * 35*7c478bd9Sstevel@tonic-gate * @(#)queue.h 8.5 (Berkeley) 8/20/94 36*7c478bd9Sstevel@tonic-gate * %W% (Sun) %G% 37*7c478bd9Sstevel@tonic-gate */ 38*7c478bd9Sstevel@tonic-gate /* 39*7c478bd9Sstevel@tonic-gate * Copyright (c) 1998 by Sun Microsystems, Inc. 40*7c478bd9Sstevel@tonic-gate * All rights reserved. 41*7c478bd9Sstevel@tonic-gate */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #ifndef _SYS_QUEUE_H_ 46*7c478bd9Sstevel@tonic-gate #define _SYS_QUEUE_H_ 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* 49*7c478bd9Sstevel@tonic-gate * This file defines three types of data structures: lists, tail queues, 50*7c478bd9Sstevel@tonic-gate * and circular queues. 51*7c478bd9Sstevel@tonic-gate * 52*7c478bd9Sstevel@tonic-gate * A list is headed by a single forward pointer (or an array of forward 53*7c478bd9Sstevel@tonic-gate * pointers for a hash table header). The elements are doubly linked 54*7c478bd9Sstevel@tonic-gate * so that an arbitrary element can be removed without a need to 55*7c478bd9Sstevel@tonic-gate * traverse the list. New elements can be added to the list before 56*7c478bd9Sstevel@tonic-gate * or after an existing element or at the head of the list. A list 57*7c478bd9Sstevel@tonic-gate * may only be traversed in the forward direction. 58*7c478bd9Sstevel@tonic-gate * 59*7c478bd9Sstevel@tonic-gate * A tail queue is headed by a pair of pointers, one to the head of the 60*7c478bd9Sstevel@tonic-gate * list and the other to the tail of the list. The elements are doubly 61*7c478bd9Sstevel@tonic-gate * linked so that an arbitrary element can be removed without a need to 62*7c478bd9Sstevel@tonic-gate * traverse the list. New elements can be added to the list before or 63*7c478bd9Sstevel@tonic-gate * after an existing element, at the head of the list, or at the end of 64*7c478bd9Sstevel@tonic-gate * the list. A tail queue may only be traversed in the forward direction. 65*7c478bd9Sstevel@tonic-gate * 66*7c478bd9Sstevel@tonic-gate * A circle queue is headed by a pair of pointers, one to the head of the 67*7c478bd9Sstevel@tonic-gate * list and the other to the tail of the list. The elements are doubly 68*7c478bd9Sstevel@tonic-gate * linked so that an arbitrary element can be removed without a need to 69*7c478bd9Sstevel@tonic-gate * traverse the list. New elements can be added to the list before or after 70*7c478bd9Sstevel@tonic-gate * an existing element, at the head of the list, or at the end of the list. 71*7c478bd9Sstevel@tonic-gate * A circle queue may be traversed in either direction, but has a more 72*7c478bd9Sstevel@tonic-gate * complex end of list detection. 73*7c478bd9Sstevel@tonic-gate * 74*7c478bd9Sstevel@tonic-gate * For details on the use of these macros, see the queue(3) manual page. 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * List definitions. 79*7c478bd9Sstevel@tonic-gate */ 80*7c478bd9Sstevel@tonic-gate #define LIST_HEAD(name, type) \ 81*7c478bd9Sstevel@tonic-gate struct name { \ 82*7c478bd9Sstevel@tonic-gate struct type *lh_first; /* first element */ \ 83*7c478bd9Sstevel@tonic-gate } 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate #define LIST_ENTRY(type) \ 86*7c478bd9Sstevel@tonic-gate struct { \ 87*7c478bd9Sstevel@tonic-gate struct type *le_next; /* next element */ \ 88*7c478bd9Sstevel@tonic-gate struct type **le_prev; /* address of previous next element */ \ 89*7c478bd9Sstevel@tonic-gate } 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate #define LIST_FIRST(head) ((head)->lh_first) 92*7c478bd9Sstevel@tonic-gate #define LIST_NEXT(elm, field) ((elm)->field.le_next) 93*7c478bd9Sstevel@tonic-gate #define LIST_END(head) NULL 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate /* 96*7c478bd9Sstevel@tonic-gate * List functions. 97*7c478bd9Sstevel@tonic-gate */ 98*7c478bd9Sstevel@tonic-gate #define LIST_INIT(head) { \ 99*7c478bd9Sstevel@tonic-gate (head)->lh_first = NULL; \ 100*7c478bd9Sstevel@tonic-gate } 101*7c478bd9Sstevel@tonic-gate 102*7c478bd9Sstevel@tonic-gate #define LIST_INSERT_AFTER(listelm, elm, field) do { \ 103*7c478bd9Sstevel@tonic-gate if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ 104*7c478bd9Sstevel@tonic-gate (listelm)->field.le_next->field.le_prev = \ 105*7c478bd9Sstevel@tonic-gate &(elm)->field.le_next; \ 106*7c478bd9Sstevel@tonic-gate (listelm)->field.le_next = (elm); \ 107*7c478bd9Sstevel@tonic-gate (elm)->field.le_prev = &(listelm)->field.le_next; \ 108*7c478bd9Sstevel@tonic-gate } while (0) 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ 111*7c478bd9Sstevel@tonic-gate (elm)->field.le_prev = (listelm)->field.le_prev; \ 112*7c478bd9Sstevel@tonic-gate (elm)->field.le_next = (listelm); \ 113*7c478bd9Sstevel@tonic-gate *(listelm)->field.le_prev = (elm); \ 114*7c478bd9Sstevel@tonic-gate (listelm)->field.le_prev = &(elm)->field.le_next; \ 115*7c478bd9Sstevel@tonic-gate } while (0) 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate #define LIST_INSERT_HEAD(head, elm, field) do { \ 118*7c478bd9Sstevel@tonic-gate if (((elm)->field.le_next = (head)->lh_first) != NULL) \ 119*7c478bd9Sstevel@tonic-gate (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ 120*7c478bd9Sstevel@tonic-gate (head)->lh_first = (elm); \ 121*7c478bd9Sstevel@tonic-gate (elm)->field.le_prev = &(head)->lh_first; \ 122*7c478bd9Sstevel@tonic-gate } while (0) 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate #define LIST_REMOVE(elm, field) do { \ 125*7c478bd9Sstevel@tonic-gate if ((elm)->field.le_next != NULL) \ 126*7c478bd9Sstevel@tonic-gate (elm)->field.le_next->field.le_prev = \ 127*7c478bd9Sstevel@tonic-gate (elm)->field.le_prev; \ 128*7c478bd9Sstevel@tonic-gate *(elm)->field.le_prev = (elm)->field.le_next; \ 129*7c478bd9Sstevel@tonic-gate } while (0) 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate /* 132*7c478bd9Sstevel@tonic-gate * Tail queue definitions. 133*7c478bd9Sstevel@tonic-gate */ 134*7c478bd9Sstevel@tonic-gate #define TAILQ_HEAD(name, type) \ 135*7c478bd9Sstevel@tonic-gate struct name { \ 136*7c478bd9Sstevel@tonic-gate struct type *tqh_first; /* first element */ \ 137*7c478bd9Sstevel@tonic-gate struct type **tqh_last; /* addr of last next element */ \ 138*7c478bd9Sstevel@tonic-gate } 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate #define TAILQ_ENTRY(type) \ 141*7c478bd9Sstevel@tonic-gate struct { \ 142*7c478bd9Sstevel@tonic-gate struct type *tqe_next; /* next element */ \ 143*7c478bd9Sstevel@tonic-gate struct type **tqe_prev; /* address of previous next element */ \ 144*7c478bd9Sstevel@tonic-gate } 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate #define TAILQ_FIRST(head) ((head)->tqh_first) 147*7c478bd9Sstevel@tonic-gate #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) 148*7c478bd9Sstevel@tonic-gate #define TAILQ_END(head) NULL 149*7c478bd9Sstevel@tonic-gate 150*7c478bd9Sstevel@tonic-gate /* 151*7c478bd9Sstevel@tonic-gate * Tail queue functions. 152*7c478bd9Sstevel@tonic-gate */ 153*7c478bd9Sstevel@tonic-gate #define TAILQ_INIT(head) do { \ 154*7c478bd9Sstevel@tonic-gate (head)->tqh_first = NULL; \ 155*7c478bd9Sstevel@tonic-gate (head)->tqh_last = &(head)->tqh_first; \ 156*7c478bd9Sstevel@tonic-gate } while (0) 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate #define TAILQ_INSERT_HEAD(head, elm, field) do { \ 159*7c478bd9Sstevel@tonic-gate if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ 160*7c478bd9Sstevel@tonic-gate (head)->tqh_first->field.tqe_prev = \ 161*7c478bd9Sstevel@tonic-gate &(elm)->field.tqe_next; \ 162*7c478bd9Sstevel@tonic-gate else \ 163*7c478bd9Sstevel@tonic-gate (head)->tqh_last = &(elm)->field.tqe_next; \ 164*7c478bd9Sstevel@tonic-gate (head)->tqh_first = (elm); \ 165*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_prev = &(head)->tqh_first; \ 166*7c478bd9Sstevel@tonic-gate } while (0) 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate #define TAILQ_INSERT_TAIL(head, elm, field) do { \ 169*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_next = NULL; \ 170*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_prev = (head)->tqh_last; \ 171*7c478bd9Sstevel@tonic-gate *(head)->tqh_last = (elm); \ 172*7c478bd9Sstevel@tonic-gate (head)->tqh_last = &(elm)->field.tqe_next; \ 173*7c478bd9Sstevel@tonic-gate } while (0) 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ 176*7c478bd9Sstevel@tonic-gate if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ 177*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_next->field.tqe_prev = \ 178*7c478bd9Sstevel@tonic-gate &(elm)->field.tqe_next; \ 179*7c478bd9Sstevel@tonic-gate else \ 180*7c478bd9Sstevel@tonic-gate (head)->tqh_last = &(elm)->field.tqe_next; \ 181*7c478bd9Sstevel@tonic-gate (listelm)->field.tqe_next = (elm); \ 182*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ 183*7c478bd9Sstevel@tonic-gate } while (0) 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ 186*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ 187*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_next = (listelm); \ 188*7c478bd9Sstevel@tonic-gate *(listelm)->field.tqe_prev = (elm); \ 189*7c478bd9Sstevel@tonic-gate (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ 190*7c478bd9Sstevel@tonic-gate } while (0) 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate #define TAILQ_REMOVE(head, elm, field) do { \ 193*7c478bd9Sstevel@tonic-gate if (((elm)->field.tqe_next) != NULL) \ 194*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_next->field.tqe_prev = \ 195*7c478bd9Sstevel@tonic-gate (elm)->field.tqe_prev; \ 196*7c478bd9Sstevel@tonic-gate else \ 197*7c478bd9Sstevel@tonic-gate (head)->tqh_last = (elm)->field.tqe_prev; \ 198*7c478bd9Sstevel@tonic-gate *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ 199*7c478bd9Sstevel@tonic-gate } while (0) 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate /* 202*7c478bd9Sstevel@tonic-gate * Circular queue definitions. 203*7c478bd9Sstevel@tonic-gate */ 204*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_HEAD(name, type) \ 205*7c478bd9Sstevel@tonic-gate struct name { \ 206*7c478bd9Sstevel@tonic-gate struct type *cqh_first; /* first element */ \ 207*7c478bd9Sstevel@tonic-gate struct type *cqh_last; /* last element */ \ 208*7c478bd9Sstevel@tonic-gate } 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_ENTRY(type) \ 211*7c478bd9Sstevel@tonic-gate struct { \ 212*7c478bd9Sstevel@tonic-gate struct type *cqe_next; /* next element */ \ 213*7c478bd9Sstevel@tonic-gate struct type *cqe_prev; /* previous element */ \ 214*7c478bd9Sstevel@tonic-gate } 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_FIRST(head) ((head)->cqh_first) 217*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_LAST(head) ((head)->cqh_last) 218*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_END(head) ((void *)(head)) 219*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) 220*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate /* 223*7c478bd9Sstevel@tonic-gate * Circular queue functions. 224*7c478bd9Sstevel@tonic-gate */ 225*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_INIT(head) do { \ 226*7c478bd9Sstevel@tonic-gate (head)->cqh_first = (void *)(head); \ 227*7c478bd9Sstevel@tonic-gate (head)->cqh_last = (void *)(head); \ 228*7c478bd9Sstevel@tonic-gate } while (0) 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ 231*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next = (listelm)->field.cqe_next; \ 232*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev = (listelm); \ 233*7c478bd9Sstevel@tonic-gate if ((listelm)->field.cqe_next == (void *)(head)) \ 234*7c478bd9Sstevel@tonic-gate (head)->cqh_last = (elm); \ 235*7c478bd9Sstevel@tonic-gate else \ 236*7c478bd9Sstevel@tonic-gate (listelm)->field.cqe_next->field.cqe_prev = (elm); \ 237*7c478bd9Sstevel@tonic-gate (listelm)->field.cqe_next = (elm); \ 238*7c478bd9Sstevel@tonic-gate } while (0) 239*7c478bd9Sstevel@tonic-gate 240*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ 241*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next = (listelm); \ 242*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ 243*7c478bd9Sstevel@tonic-gate if ((listelm)->field.cqe_prev == (void *)(head)) \ 244*7c478bd9Sstevel@tonic-gate (head)->cqh_first = (elm); \ 245*7c478bd9Sstevel@tonic-gate else \ 246*7c478bd9Sstevel@tonic-gate (listelm)->field.cqe_prev->field.cqe_next = (elm); \ 247*7c478bd9Sstevel@tonic-gate (listelm)->field.cqe_prev = (elm); \ 248*7c478bd9Sstevel@tonic-gate } while (0) 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ 251*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next = (head)->cqh_first; \ 252*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev = (void *)(head); \ 253*7c478bd9Sstevel@tonic-gate if ((head)->cqh_last == (void *)(head)) \ 254*7c478bd9Sstevel@tonic-gate (head)->cqh_last = (elm); \ 255*7c478bd9Sstevel@tonic-gate else \ 256*7c478bd9Sstevel@tonic-gate (head)->cqh_first->field.cqe_prev = (elm); \ 257*7c478bd9Sstevel@tonic-gate (head)->cqh_first = (elm); \ 258*7c478bd9Sstevel@tonic-gate } while (0) 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ 261*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next = (void *)(head); \ 262*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev = (head)->cqh_last; \ 263*7c478bd9Sstevel@tonic-gate if ((head)->cqh_first == (void *)(head)) \ 264*7c478bd9Sstevel@tonic-gate (head)->cqh_first = (elm); \ 265*7c478bd9Sstevel@tonic-gate else \ 266*7c478bd9Sstevel@tonic-gate (head)->cqh_last->field.cqe_next = (elm); \ 267*7c478bd9Sstevel@tonic-gate (head)->cqh_last = (elm); \ 268*7c478bd9Sstevel@tonic-gate } while (0) 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate #define CIRCLEQ_REMOVE(head, elm, field) do { \ 271*7c478bd9Sstevel@tonic-gate if ((elm)->field.cqe_next == (void *)(head)) \ 272*7c478bd9Sstevel@tonic-gate (head)->cqh_last = (elm)->field.cqe_prev; \ 273*7c478bd9Sstevel@tonic-gate else \ 274*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next->field.cqe_prev = \ 275*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev; \ 276*7c478bd9Sstevel@tonic-gate if ((elm)->field.cqe_prev == (void *)(head)) \ 277*7c478bd9Sstevel@tonic-gate (head)->cqh_first = (elm)->field.cqe_next; \ 278*7c478bd9Sstevel@tonic-gate else \ 279*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_prev->field.cqe_next = \ 280*7c478bd9Sstevel@tonic-gate (elm)->field.cqe_next; \ 281*7c478bd9Sstevel@tonic-gate } while (0) 282*7c478bd9Sstevel@tonic-gate #endif /* !_SYS_QUEUE_H_ */ 283