]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/libuutil_impl.h
ddt: remove struct names and forward declarations
[FreeBSD/FreeBSD.git] / include / libuutil_impl.h
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 https://opensource.org/licenses/CDDL-1.0.
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26
27 #ifndef _LIBUUTIL_IMPL_H
28 #define _LIBUUTIL_IMPL_H
29
30
31
32 #include <libuutil.h>
33 #include <pthread.h>
34
35 #include <sys/avl_impl.h>
36 #include <sys/byteorder.h>
37
38 #ifdef  __cplusplus
39 extern "C" {
40 #endif
41
42 void uu_set_error(uint_t);
43
44
45 __attribute__((format(printf, 1, 2), __noreturn__))
46 void uu_panic(const char *format, ...);
47
48
49 /*
50  * uu_list structures
51  */
52 typedef struct uu_list_node_impl {
53         struct uu_list_node_impl *uln_next;
54         struct uu_list_node_impl *uln_prev;
55 } uu_list_node_impl_t;
56
57 struct uu_list_walk {
58         uu_list_walk_t  *ulw_next;
59         uu_list_walk_t  *ulw_prev;
60
61         uu_list_t       *ulw_list;
62         int8_t          ulw_dir;
63         uint8_t         ulw_robust;
64         uu_list_node_impl_t *ulw_next_result;
65 };
66
67 struct uu_list {
68         uu_list_t       *ul_next;
69         uu_list_t       *ul_prev;
70
71         uu_list_pool_t  *ul_pool;
72         void            *ul_parent;
73         size_t          ul_offset;
74         size_t          ul_numnodes;
75         uint8_t         ul_debug;
76         uint8_t         ul_sorted;
77         uint8_t         ul_index;       /* mark for uu_list_index_ts */
78
79         uu_list_node_impl_t ul_null_node;
80         uu_list_walk_t  ul_null_walk;   /* for robust walkers */
81 };
82
83 #define UU_LIST_POOL_MAXNAME    64
84
85 struct uu_list_pool {
86         uu_list_pool_t  *ulp_next;
87         uu_list_pool_t  *ulp_prev;
88
89         char            ulp_name[UU_LIST_POOL_MAXNAME];
90         size_t          ulp_nodeoffset;
91         size_t          ulp_objsize;
92         uu_compare_fn_t *ulp_cmp;
93         uint8_t         ulp_debug;
94         uint8_t         ulp_last_index;
95         pthread_mutex_t ulp_lock;               /* protects null_list */
96         uu_list_t       ulp_null_list;
97 };
98
99 /*
100  * uu_avl structures
101  */
102 typedef struct avl_node         uu_avl_node_impl_t;
103
104 struct uu_avl_walk {
105         uu_avl_walk_t   *uaw_next;
106         uu_avl_walk_t   *uaw_prev;
107
108         uu_avl_t        *uaw_avl;
109         void            *uaw_next_result;
110         int8_t          uaw_dir;
111         uint8_t         uaw_robust;
112 };
113
114 struct uu_avl {
115         uu_avl_t        *ua_next;
116         uu_avl_t        *ua_prev;
117
118         uu_avl_pool_t   *ua_pool;
119         void            *ua_parent;
120         uint8_t         ua_debug;
121         uint8_t         ua_index;       /* mark for uu_avl_index_ts */
122
123         struct avl_tree ua_tree;
124         uu_avl_walk_t   ua_null_walk;
125 };
126
127 #define UU_AVL_POOL_MAXNAME     64
128
129 struct uu_avl_pool {
130         uu_avl_pool_t   *uap_next;
131         uu_avl_pool_t   *uap_prev;
132
133         char            uap_name[UU_AVL_POOL_MAXNAME];
134         size_t          uap_nodeoffset;
135         size_t          uap_objsize;
136         uu_compare_fn_t *uap_cmp;
137         uint8_t         uap_debug;
138         uint8_t         uap_last_index;
139         pthread_mutex_t uap_lock;               /* protects null_avl */
140         uu_avl_t        uap_null_avl;
141 };
142
143 /*
144  * atfork() handlers
145  */
146 void uu_avl_lockup(void);
147 void uu_avl_release(void);
148
149 void uu_list_lockup(void);
150 void uu_list_release(void);
151
152 #ifdef  __cplusplus
153 }
154 #endif
155
156 #endif  /* _LIBUUTIL_IMPL_H */