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