1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 1999 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _GHD_QUEUE_H 28 #define _GHD_QUEUE_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 35 /* 36 * A list of singly linked elements 37 */ 38 39 typedef struct L1el { 40 struct L1el *le_nextp; 41 void *le_datap; 42 } L1el_t; 43 44 #define L1EL_INIT(lep) ((lep)->le_nextp = NULL, (lep)->le_datap = 0) 45 46 typedef struct L1_head { 47 L1el_t *l1_headp; 48 L1el_t *l1_tailp; 49 } L1_t; 50 51 #define L1HEADER_INIT(lp) (((lp)->l1_headp = NULL), ((lp)->l1_tailp = NULL)) 52 #define L1_EMPTY(lp) ((lp)->l1_headp == NULL) 53 54 void L1_add(L1_t *lp, L1el_t *lep, void *datap); 55 void L1_delete(L1_t *lp, L1el_t *lep); 56 void *L1_remove(L1_t *lp); 57 58 59 /* 60 * A list of doubly linked elements 61 */ 62 63 typedef struct L2el { 64 struct L2el *l2_nextp; 65 struct L2el *l2_prevp; 66 void *l2_private; 67 } L2el_t; 68 69 #define L2_INIT(headp) \ 70 (((headp)->l2_nextp = (headp)), ((headp)->l2_prevp = (headp))) 71 72 #define L2_EMPTY(headp) ((headp)->l2_nextp == (headp)) 73 74 void L2_add(L2el_t *headp, L2el_t *elementp, void *private); 75 void L2_delete(L2el_t *elementp); 76 void L2_add_head(L2el_t *headp, L2el_t *elementp, void *private); 77 void *L2_remove_head(L2el_t *headp); 78 void *L2_next(L2el_t *elementp); 79 80 81 #ifdef __cplusplus 82 } 83 #endif 84 #endif /* _GHD_QUEUE_H */ 85