mm_queue.h

00001 /*      $OpenBSD: queue.h,v 1.25 2004/04/08 16:08:21 henning Exp $      */
00002 /*      $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $       */
00003 
00004 /*
00005  * Copyright (c) 1991, 1993
00006  *      The Regents of the University of California.  All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the University nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  *      @(#)queue.h     8.5 (Berkeley) 8/20/94
00033  */
00034 
00035 #ifndef _SYS_QUEUE_H_
00036 #define _SYS_QUEUE_H_
00037 
00038 /*
00039  * This file defines five types of data structures: singly-linked lists, 
00040  * lists, simple queues, tail queues, and circular queues.
00041  *
00042  *
00043  * A singly-linked list is headed by a single forward pointer. The elements
00044  * are singly linked for minimum space and pointer manipulation overhead at
00045  * the expense of O(n) removal for arbitrary elements. New elements can be
00046  * added to the list after an existing element or at the head of the list.
00047  * Elements being removed from the head of the list should use the explicit
00048  * macro for this purpose for optimum efficiency. A singly-linked list may
00049  * only be traversed in the forward direction.  Singly-linked lists are ideal
00050  * for applications with large datasets and few or no removals or for
00051  * implementing a LIFO queue.
00052  *
00053  * A list is headed by a single forward pointer (or an array of forward
00054  * pointers for a hash table header). The elements are doubly linked
00055  * so that an arbitrary element can be removed without a need to
00056  * traverse the list. New elements can be added to the list before
00057  * or after an existing element or at the head of the list. A list
00058  * may only be traversed in the forward direction.
00059  *
00060  * A simple queue is headed by a pair of pointers, one the head of the
00061  * list and the other to the tail of the list. The elements are singly
00062  * linked to save space, so elements can only be removed from the
00063  * head of the list. New elements can be added to the list before or after
00064  * an existing element, at the head of the list, or at the end of the
00065  * list. A simple queue may only be traversed in the forward direction.
00066  *
00067  * A tail queue is headed by a pair of pointers, one to the head of the
00068  * list and the other to the tail of the list. The elements are doubly
00069  * linked so that an arbitrary element can be removed without a need to
00070  * traverse the list. New elements can be added to the list before or
00071  * after an existing element, at the head of the list, or at the end of
00072  * the list. A tail queue may be traversed in either direction.
00073  *
00074  * A circle queue is headed by a pair of pointers, one to the head of the
00075  * list and the other to the tail of the list. The elements are doubly
00076  * linked so that an arbitrary element can be removed without a need to
00077  * traverse the list. New elements can be added to the list before or after
00078  * an existing element, at the head of the list, or at the end of the list.
00079  * A circle queue may be traversed in either direction, but has a more
00080  * complex end of list detection.
00081  *
00082  * For details on the use of these macros, see the queue(3) manual page.
00083  */
00084 
00085 /*
00086  * Singly-linked List definitions.
00087  */
00088 #define SLIST_HEAD(name, type)                                          \
00089 struct name {                                                           \
00090         struct type *slh_first; /* first element */                     \
00091 }
00092  
00093 #define SLIST_HEAD_INITIALIZER(head)                                    \
00094         { NULL }
00095  
00096 #define SLIST_ENTRY(type)                                               \
00097 struct {                                                                \
00098         struct type *sle_next;  /* next element */                      \
00099 }
00100  
00101 /*
00102  * Singly-linked List access methods.
00103  */
00104 #define SLIST_FIRST(head)       ((head)->slh_first)
00105 #define SLIST_END(head)         NULL
00106 #define SLIST_EMPTY(head)       (SLIST_FIRST(head) == SLIST_END(head))
00107 #define SLIST_NEXT(elm, field)  ((elm)->field.sle_next)
00108 
00109 #define SLIST_FOREACH(var, head, field)                                 \
00110         for((var) = SLIST_FIRST(head);                                  \
00111             (var) != SLIST_END(head);                                   \
00112             (var) = SLIST_NEXT(var, field))
00113 
00114 #define SLIST_FOREACH_PREVPTR(var, varp, head, field)                   \
00115         for ((varp) = &SLIST_FIRST((head));                             \
00116             ((var) = *(varp)) != SLIST_END(head);                       \
00117             (varp) = &SLIST_NEXT((var), field))
00118 
00119 /*
00120  * Singly-linked List functions.
00121  */
00122 #define SLIST_INIT(head) {                                              \
00123         SLIST_FIRST(head) = SLIST_END(head);                            \
00124 }
00125 
00126 #define SLIST_INSERT_AFTER(slistelm, elm, field) do {                   \
00127         (elm)->field.sle_next = (slistelm)->field.sle_next;             \
00128         (slistelm)->field.sle_next = (elm);                             \
00129 } while (0)
00130 
00131 #define SLIST_INSERT_HEAD(head, elm, field) do {                        \
00132         (elm)->field.sle_next = (head)->slh_first;                      \
00133         (head)->slh_first = (elm);                                      \
00134 } while (0)
00135 
00136 #define SLIST_REMOVE_NEXT(head, elm, field) do {                        \
00137         (elm)->field.sle_next = (elm)->field.sle_next->field.sle_next;  \
00138 } while (0)
00139 
00140 #define SLIST_REMOVE_HEAD(head, field) do {                             \
00141         (head)->slh_first = (head)->slh_first->field.sle_next;          \
00142 } while (0)
00143 
00144 #define SLIST_REMOVE(head, elm, type, field) do {                       \
00145         if ((head)->slh_first == (elm)) {                               \
00146                 SLIST_REMOVE_HEAD((head), field);                       \
00147         }                                                               \
00148         else {                                                          \
00149                 struct type *curelm = (head)->slh_first;                \
00150                 while( curelm->field.sle_next != (elm) )                \
00151                         curelm = curelm->field.sle_next;                \
00152                 curelm->field.sle_next =                                \
00153                     curelm->field.sle_next->field.sle_next;             \
00154         }                                                               \
00155 } while (0)
00156 
00157 /*
00158  * List definitions.
00159  */
00160 #define LIST_HEAD(name, type)                                           \
00161 struct name {                                                           \
00162         struct type *lh_first;  /* first element */                     \
00163 }
00164 
00165 #define LIST_HEAD_INITIALIZER(head)                                     \
00166         { NULL }
00167 
00168 #define LIST_ENTRY(type)                                                \
00169 struct {                                                                \
00170         struct type *le_next;   /* next element */                      \
00171         struct type **le_prev;  /* address of previous next element */  \
00172 }
00173 
00174 /*
00175  * List access methods
00176  */
00177 #define LIST_FIRST(head)                ((head)->lh_first)
00178 #define LIST_END(head)                  NULL
00179 #define LIST_EMPTY(head)                (LIST_FIRST(head) == LIST_END(head))
00180 #define LIST_NEXT(elm, field)           ((elm)->field.le_next)
00181 
00182 #define LIST_FOREACH(var, head, field)                                  \
00183         for((var) = LIST_FIRST(head);                                   \
00184             (var)!= LIST_END(head);                                     \
00185             (var) = LIST_NEXT(var, field))
00186 
00187 /*
00188  * List functions.
00189  */
00190 #define LIST_INIT(head) do {                                            \
00191         LIST_FIRST(head) = LIST_END(head);                              \
00192 } while (0)
00193 
00194 #define LIST_INSERT_AFTER(listelm, elm, field) do {                     \
00195         if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)  \
00196                 (listelm)->field.le_next->field.le_prev =               \
00197                     &(elm)->field.le_next;                              \
00198         (listelm)->field.le_next = (elm);                               \
00199         (elm)->field.le_prev = &(listelm)->field.le_next;               \
00200 } while (0)
00201 
00202 #define LIST_INSERT_BEFORE(listelm, elm, field) do {                    \
00203         (elm)->field.le_prev = (listelm)->field.le_prev;                \
00204         (elm)->field.le_next = (listelm);                               \
00205         *(listelm)->field.le_prev = (elm);                              \
00206         (listelm)->field.le_prev = &(elm)->field.le_next;               \
00207 } while (0)
00208 
00209 #define LIST_INSERT_HEAD(head, elm, field) do {                         \
00210         if (((elm)->field.le_next = (head)->lh_first) != NULL)          \
00211                 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
00212         (head)->lh_first = (elm);                                       \
00213         (elm)->field.le_prev = &(head)->lh_first;                       \
00214 } while (0)
00215 
00216 #define LIST_REMOVE(elm, field) do {                                    \
00217         if ((elm)->field.le_next != NULL)                               \
00218                 (elm)->field.le_next->field.le_prev =                   \
00219                     (elm)->field.le_prev;                               \
00220         *(elm)->field.le_prev = (elm)->field.le_next;                   \
00221 } while (0)
00222 
00223 #define LIST_REPLACE(elm, elm2, field) do {                             \
00224         if (((elm2)->field.le_next = (elm)->field.le_next) != NULL)     \
00225                 (elm2)->field.le_next->field.le_prev =                  \
00226                     &(elm2)->field.le_next;                             \
00227         (elm2)->field.le_prev = (elm)->field.le_prev;                   \
00228         *(elm2)->field.le_prev = (elm2);                                \
00229 } while (0)
00230 
00231 /*
00232  * Simple queue definitions.
00233  */
00234 #define SIMPLEQ_HEAD(name, type)                                        \
00235 struct name {                                                           \
00236         struct type *sqh_first; /* first element */                     \
00237         struct type **sqh_last; /* addr of last next element */         \
00238 }
00239 
00240 #define SIMPLEQ_HEAD_INITIALIZER(head)                                  \
00241         { NULL, &(head).sqh_first }
00242 
00243 #define SIMPLEQ_ENTRY(type)                                             \
00244 struct {                                                                \
00245         struct type *sqe_next;  /* next element */                      \
00246 }
00247 
00248 /*
00249  * Simple queue access methods.
00250  */
00251 #define SIMPLEQ_FIRST(head)         ((head)->sqh_first)
00252 #define SIMPLEQ_END(head)           NULL
00253 #define SIMPLEQ_EMPTY(head)         (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
00254 #define SIMPLEQ_NEXT(elm, field)    ((elm)->field.sqe_next)
00255 
00256 #define SIMPLEQ_FOREACH(var, head, field)                               \
00257         for((var) = SIMPLEQ_FIRST(head);                                \
00258             (var) != SIMPLEQ_END(head);                                 \
00259             (var) = SIMPLEQ_NEXT(var, field))
00260 
00261 /*
00262  * Simple queue functions.
00263  */
00264 #define SIMPLEQ_INIT(head) do {                                         \
00265         (head)->sqh_first = NULL;                                       \
00266         (head)->sqh_last = &(head)->sqh_first;                          \
00267 } while (0)
00268 
00269 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do {                      \
00270         if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)        \
00271                 (head)->sqh_last = &(elm)->field.sqe_next;              \
00272         (head)->sqh_first = (elm);                                      \
00273 } while (0)
00274 
00275 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do {                      \
00276         (elm)->field.sqe_next = NULL;                                   \
00277         *(head)->sqh_last = (elm);                                      \
00278         (head)->sqh_last = &(elm)->field.sqe_next;                      \
00279 } while (0)
00280 
00281 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {            \
00282         if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
00283                 (head)->sqh_last = &(elm)->field.sqe_next;              \
00284         (listelm)->field.sqe_next = (elm);                              \
00285 } while (0)
00286 
00287 #define SIMPLEQ_REMOVE_HEAD(head, elm, field) do {                      \
00288         if (((head)->sqh_first = (elm)->field.sqe_next) == NULL)        \
00289                 (head)->sqh_last = &(head)->sqh_first;                  \
00290 } while (0)
00291 
00292 /*
00293  * Tail queue definitions.
00294  */
00295 #define TAILQ_HEAD(name, type)                                          \
00296 struct name {                                                           \
00297         struct type *tqh_first; /* first element */                     \
00298         struct type **tqh_last; /* addr of last next element */         \
00299 }
00300 
00301 #define TAILQ_HEAD_INITIALIZER(head)                                    \
00302         { NULL, &(head).tqh_first }
00303 
00304 #define TAILQ_ENTRY(type)                                               \
00305 struct {                                                                \
00306         struct type *tqe_next;  /* next element */                      \
00307         struct type **tqe_prev; /* address of previous next element */  \
00308 }
00309 
00310 /* 
00311  * tail queue access methods 
00312  */
00313 #define TAILQ_FIRST(head)               ((head)->tqh_first)
00314 #define TAILQ_END(head)                 NULL
00315 #define TAILQ_NEXT(elm, field)          ((elm)->field.tqe_next)
00316 #define TAILQ_LAST(head, headname)                                      \
00317         (*(((struct headname *)((head)->tqh_last))->tqh_last))
00318 /* XXX */
00319 #define TAILQ_PREV(elm, headname, field)                                \
00320         (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
00321 #define TAILQ_EMPTY(head)                                               \
00322         (TAILQ_FIRST(head) == TAILQ_END(head))
00323 
00324 #define TAILQ_FOREACH(var, head, field)                                 \
00325         for((var) = TAILQ_FIRST(head);                                  \
00326             (var) != TAILQ_END(head);                                   \
00327             (var) = TAILQ_NEXT(var, field))
00328 
00329 #define TAILQ_FOREACH_REVERSE(var, head, headname, field)               \
00330         for((var) = TAILQ_LAST(head, headname);                         \
00331             (var) != TAILQ_END(head);                                   \
00332             (var) = TAILQ_PREV(var, headname, field))
00333 
00334 /*
00335  * Tail queue functions.
00336  */
00337 #define TAILQ_INIT(head) do {                                           \
00338         (head)->tqh_first = NULL;                                       \
00339         (head)->tqh_last = &(head)->tqh_first;                          \
00340 } while (0)
00341 
00342 #define TAILQ_INSERT_HEAD(head, elm, field) do {                        \
00343         if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)        \
00344                 (head)->tqh_first->field.tqe_prev =                     \
00345                     &(elm)->field.tqe_next;                             \
00346         else                                                            \
00347                 (head)->tqh_last = &(elm)->field.tqe_next;              \
00348         (head)->tqh_first = (elm);                                      \
00349         (elm)->field.tqe_prev = &(head)->tqh_first;                     \
00350 } while (0)
00351 
00352 #define TAILQ_INSERT_TAIL(head, elm, field) do {                        \
00353         (elm)->field.tqe_next = NULL;                                   \
00354         (elm)->field.tqe_prev = (head)->tqh_last;                       \
00355         *(head)->tqh_last = (elm);                                      \
00356         (head)->tqh_last = &(elm)->field.tqe_next;                      \
00357 } while (0)
00358 
00359 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do {              \
00360         if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
00361                 (elm)->field.tqe_next->field.tqe_prev =                 \
00362                     &(elm)->field.tqe_next;                             \
00363         else                                                            \
00364                 (head)->tqh_last = &(elm)->field.tqe_next;              \
00365         (listelm)->field.tqe_next = (elm);                              \
00366         (elm)->field.tqe_prev = &(listelm)->field.tqe_next;             \
00367 } while (0)
00368 
00369 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do {                   \
00370         (elm)->field.tqe_prev = (listelm)->field.tqe_prev;              \
00371         (elm)->field.tqe_next = (listelm);                              \
00372         *(listelm)->field.tqe_prev = (elm);                             \
00373         (listelm)->field.tqe_prev = &(elm)->field.tqe_next;             \
00374 } while (0)
00375 
00376 #define TAILQ_REMOVE(head, elm, field) do {                             \
00377         if (((elm)->field.tqe_next) != NULL)                            \
00378                 (elm)->field.tqe_next->field.tqe_prev =                 \
00379                     (elm)->field.tqe_prev;                              \
00380         else                                                            \
00381                 (head)->tqh_last = (elm)->field.tqe_prev;               \
00382         *(elm)->field.tqe_prev = (elm)->field.tqe_next;                 \
00383 } while (0)
00384 
00385 #define TAILQ_REPLACE(head, elm, elm2, field) do {                      \
00386         if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL)   \
00387                 (elm2)->field.tqe_next->field.tqe_prev =                \
00388                     &(elm2)->field.tqe_next;                            \
00389         else                                                            \
00390                 (head)->tqh_last = &(elm2)->field.tqe_next;             \
00391         (elm2)->field.tqe_prev = (elm)->field.tqe_prev;                 \
00392         *(elm2)->field.tqe_prev = (elm2);                               \
00393 } while (0)
00394 
00395 /*
00396  * Circular queue definitions.
00397  */
00398 #define CIRCLEQ_HEAD(name, type)                                        \
00399 struct name {                                                           \
00400         struct type *cqh_first;         /* first element */             \
00401         struct type *cqh_last;          /* last element */              \
00402 }
00403 
00404 #define CIRCLEQ_HEAD_INITIALIZER(head)                                  \
00405         { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
00406 
00407 #define CIRCLEQ_ENTRY(type)                                             \
00408 struct {                                                                \
00409         struct type *cqe_next;          /* next element */              \
00410         struct type *cqe_prev;          /* previous element */          \
00411 }
00412 
00413 /*
00414  * Circular queue access methods 
00415  */
00416 #define CIRCLEQ_FIRST(head)             ((head)->cqh_first)
00417 #define CIRCLEQ_LAST(head)              ((head)->cqh_last)
00418 #define CIRCLEQ_END(head)               ((void *)(head))
00419 #define CIRCLEQ_NEXT(elm, field)        ((elm)->field.cqe_next)
00420 #define CIRCLEQ_PREV(elm, field)        ((elm)->field.cqe_prev)
00421 #define CIRCLEQ_EMPTY(head)                                             \
00422         (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
00423 
00424 #define CIRCLEQ_FOREACH(var, head, field)                               \
00425         for((var) = CIRCLEQ_FIRST(head);                                \
00426             (var) != CIRCLEQ_END(head);                                 \
00427             (var) = CIRCLEQ_NEXT(var, field))
00428 
00429 #define CIRCLEQ_FOREACH_REVERSE(var, head, field)                       \
00430         for((var) = CIRCLEQ_LAST(head);                                 \
00431             (var) != CIRCLEQ_END(head);                                 \
00432             (var) = CIRCLEQ_PREV(var, field))
00433 
00434 /*
00435  * Circular queue functions.
00436  */
00437 #define CIRCLEQ_INIT(head) do {                                         \
00438         (head)->cqh_first = CIRCLEQ_END(head);                          \
00439         (head)->cqh_last = CIRCLEQ_END(head);                           \
00440 } while (0)
00441 
00442 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {            \
00443         (elm)->field.cqe_next = (listelm)->field.cqe_next;              \
00444         (elm)->field.cqe_prev = (listelm);                              \
00445         if ((listelm)->field.cqe_next == CIRCLEQ_END(head))             \
00446                 (head)->cqh_last = (elm);                               \
00447         else                                                            \
00448                 (listelm)->field.cqe_next->field.cqe_prev = (elm);      \
00449         (listelm)->field.cqe_next = (elm);                              \
00450 } while (0)
00451 
00452 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {           \
00453         (elm)->field.cqe_next = (listelm);                              \
00454         (elm)->field.cqe_prev = (listelm)->field.cqe_prev;              \
00455         if ((listelm)->field.cqe_prev == CIRCLEQ_END(head))             \
00456                 (head)->cqh_first = (elm);                              \
00457         else                                                            \
00458                 (listelm)->field.cqe_prev->field.cqe_next = (elm);      \
00459         (listelm)->field.cqe_prev = (elm);                              \
00460 } while (0)
00461 
00462 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do {                      \
00463         (elm)->field.cqe_next = (head)->cqh_first;                      \
00464         (elm)->field.cqe_prev = CIRCLEQ_END(head);                      \
00465         if ((head)->cqh_last == CIRCLEQ_END(head))                      \
00466                 (head)->cqh_last = (elm);                               \
00467         else                                                            \
00468                 (head)->cqh_first->field.cqe_prev = (elm);              \
00469         (head)->cqh_first = (elm);                                      \
00470 } while (0)
00471 
00472 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do {                      \
00473         (elm)->field.cqe_next = CIRCLEQ_END(head);                      \
00474         (elm)->field.cqe_prev = (head)->cqh_last;                       \
00475         if ((head)->cqh_first == CIRCLEQ_END(head))                     \
00476                 (head)->cqh_first = (elm);                              \
00477         else                                                            \
00478                 (head)->cqh_last->field.cqe_next = (elm);               \
00479         (head)->cqh_last = (elm);                                       \
00480 } while (0)
00481 
00482 #define CIRCLEQ_REMOVE(head, elm, field) do {                           \
00483         if ((elm)->field.cqe_next == CIRCLEQ_END(head))                 \
00484                 (head)->cqh_last = (elm)->field.cqe_prev;               \
00485         else                                                            \
00486                 (elm)->field.cqe_next->field.cqe_prev =                 \
00487                     (elm)->field.cqe_prev;                              \
00488         if ((elm)->field.cqe_prev == CIRCLEQ_END(head))                 \
00489                 (head)->cqh_first = (elm)->field.cqe_next;              \
00490         else                                                            \
00491                 (elm)->field.cqe_prev->field.cqe_next =                 \
00492                     (elm)->field.cqe_next;                              \
00493 } while (0)
00494 
00495 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do {                    \
00496         if (((elm2)->field.cqe_next = (elm)->field.cqe_next) ==         \
00497             CIRCLEQ_END(head))                                          \
00498                 (head).cqh_last = (elm2);                               \
00499         else                                                            \
00500                 (elm2)->field.cqe_next->field.cqe_prev = (elm2);        \
00501         if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) ==         \
00502             CIRCLEQ_END(head))                                          \
00503                 (head).cqh_first = (elm2);                              \
00504         else                                                            \
00505                 (elm2)->field.cqe_prev->field.cqe_next = (elm2);        \
00506 } while (0)
00507 
00508 #endif  /* !_SYS_QUEUE_H_ */

Generated on Thu Mar 29 17:59:08 2007 for MiniMIME by  doxygen 1.5.1