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