xref: /titanic_51/usr/src/uts/intel/io/dktp/hba/ghd/ghd_queue.h (revision 507c32411f3f101e90ca2120f042b5ee698ba1d5)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*
38  *  A list of singly linked elements
39  */
40 
41 typedef 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 
48 typedef 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 
56 void	 L1_add(L1_t *lp, L1el_t *lep, void *datap);
57 void	 L1_delete(L1_t *lp, L1el_t *lep);
58 void	*L1_remove(L1_t *lp);
59 
60 
61 /*
62  * A list of doubly linked elements
63  */
64 
65 typedef 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 
76 void	L2_add(L2el_t *headp, L2el_t *elementp, void *private);
77 void	L2_delete(L2el_t *elementp);
78 void	L2_add_head(L2el_t *headp, L2el_t *elementp, void *private);
79 void	*L2_remove_head(L2el_t *headp);
80 void	*L2_next(L2el_t *elementp);
81 
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 #endif  /* _GHD_QUEUE_H */
87