1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_LIBUUTIL_H
28*0Sstevel@tonic-gate #define	_LIBUUTIL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <stdarg.h>
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #ifdef	__cplusplus
36*0Sstevel@tonic-gate extern "C" {
37*0Sstevel@tonic-gate #endif
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate /*
40*0Sstevel@tonic-gate  * Standard flags codes.
41*0Sstevel@tonic-gate  */
42*0Sstevel@tonic-gate #define	UU_DEFAULT		0
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * Standard error codes.
46*0Sstevel@tonic-gate  */
47*0Sstevel@tonic-gate #define	UU_ERROR_NONE		0	/* no error */
48*0Sstevel@tonic-gate #define	UU_ERROR_INVALID_ARGUMENT 1	/* invalid argument */
49*0Sstevel@tonic-gate #define	UU_ERROR_UNKNOWN_FLAG	2	/* passed flag invalid */
50*0Sstevel@tonic-gate #define	UU_ERROR_NO_MEMORY	3	/* out of memory */
51*0Sstevel@tonic-gate #define	UU_ERROR_CALLBACK_FAILED 4	/* callback-initiated error */
52*0Sstevel@tonic-gate #define	UU_ERROR_NOT_SUPPORTED	5	/* operation not supported */
53*0Sstevel@tonic-gate #define	UU_ERROR_EMPTY		6	/* no value provided */
54*0Sstevel@tonic-gate #define	UU_ERROR_UNDERFLOW	7	/* value is too small */
55*0Sstevel@tonic-gate #define	UU_ERROR_OVERFLOW	8	/* value is too value */
56*0Sstevel@tonic-gate #define	UU_ERROR_INVALID_CHAR	9	/* value contains unexpected char */
57*0Sstevel@tonic-gate #define	UU_ERROR_INVALID_DIGIT	10	/* value contains digit not in base */
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate #define	UU_ERROR_SYSTEM		99	/* underlying system error */
60*0Sstevel@tonic-gate #define	UU_ERROR_UNKNOWN	100	/* error status not known */
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate /*
63*0Sstevel@tonic-gate  * Standard program exit codes.
64*0Sstevel@tonic-gate  */
65*0Sstevel@tonic-gate #define	UU_EXIT_OK	(*(uu_exit_ok()))
66*0Sstevel@tonic-gate #define	UU_EXIT_FATAL	(*(uu_exit_fatal()))
67*0Sstevel@tonic-gate #define	UU_EXIT_USAGE	(*(uu_exit_usage()))
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate /*
70*0Sstevel@tonic-gate  * Exit status profiles.
71*0Sstevel@tonic-gate  */
72*0Sstevel@tonic-gate #define	UU_PROFILE_DEFAULT	0
73*0Sstevel@tonic-gate #define	UU_PROFILE_LAUNCHER	1
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate /*
76*0Sstevel@tonic-gate  * Error reporting functions.
77*0Sstevel@tonic-gate  */
78*0Sstevel@tonic-gate uint32_t uu_error(void);
79*0Sstevel@tonic-gate const char *uu_strerror(uint32_t);
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate  * Program notification functions.
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate extern void uu_alt_exit(int);
85*0Sstevel@tonic-gate extern const char *uu_setpname(char *);
86*0Sstevel@tonic-gate extern const char *uu_getpname(void);
87*0Sstevel@tonic-gate /*PRINTFLIKE1*/
88*0Sstevel@tonic-gate extern void uu_warn(const char *, ...);
89*0Sstevel@tonic-gate extern void uu_vwarn(const char *, va_list);
90*0Sstevel@tonic-gate /*PRINTFLIKE1*/
91*0Sstevel@tonic-gate extern void uu_die(const char *, ...);
92*0Sstevel@tonic-gate extern void uu_vdie(const char *, va_list);
93*0Sstevel@tonic-gate /*PRINTFLIKE2*/
94*0Sstevel@tonic-gate extern void uu_xdie(int, const char *, ...);
95*0Sstevel@tonic-gate extern void uu_vxdie(int, const char *, va_list);
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate /*
98*0Sstevel@tonic-gate  * Exit status functions (not to be used directly)
99*0Sstevel@tonic-gate  */
100*0Sstevel@tonic-gate extern int *uu_exit_ok(void);
101*0Sstevel@tonic-gate extern int *uu_exit_fatal(void);
102*0Sstevel@tonic-gate extern int *uu_exit_usage(void);
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate  * string->number conversions
106*0Sstevel@tonic-gate  */
107*0Sstevel@tonic-gate extern int uu_strtoint(const char *, void *, size_t, int, int64_t, int64_t);
108*0Sstevel@tonic-gate extern int uu_strtouint(const char *, void *, size_t, int, uint64_t, uint64_t);
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate /*
111*0Sstevel@tonic-gate  * Debug print facility functions.
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate typedef struct uu_dprintf uu_dprintf_t;
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate typedef enum {
116*0Sstevel@tonic-gate 	UU_DPRINTF_SILENT,
117*0Sstevel@tonic-gate 	UU_DPRINTF_FATAL,
118*0Sstevel@tonic-gate 	UU_DPRINTF_WARNING,
119*0Sstevel@tonic-gate 	UU_DPRINTF_NOTICE,
120*0Sstevel@tonic-gate 	UU_DPRINTF_INFO,
121*0Sstevel@tonic-gate 	UU_DPRINTF_DEBUG
122*0Sstevel@tonic-gate } uu_dprintf_severity_t;
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate extern uu_dprintf_t *uu_dprintf_create(const char *, uu_dprintf_severity_t,
125*0Sstevel@tonic-gate     uint_t);
126*0Sstevel@tonic-gate /*PRINTFLIKE3*/
127*0Sstevel@tonic-gate extern void uu_dprintf(uu_dprintf_t *, uu_dprintf_severity_t,
128*0Sstevel@tonic-gate     const char *, ...);
129*0Sstevel@tonic-gate extern void uu_dprintf_destroy(uu_dprintf_t *);
130*0Sstevel@tonic-gate extern const char *uu_dprintf_getname(uu_dprintf_t *);
131*0Sstevel@tonic-gate 
132*0Sstevel@tonic-gate /*
133*0Sstevel@tonic-gate  * Identifier test flags and function.
134*0Sstevel@tonic-gate  */
135*0Sstevel@tonic-gate #define	UU_NAME_DOMAIN		0x1	/* allow SUNW, or com.sun, prefix */
136*0Sstevel@tonic-gate #define	UU_NAME_PATH		0x2	/* allow '/'-delimited paths */
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate int uu_check_name(const char *, uint_t);
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate /*
141*0Sstevel@tonic-gate  * File creation functions.
142*0Sstevel@tonic-gate  */
143*0Sstevel@tonic-gate extern int uu_open_tmp(const char *dir, uint_t uflags);
144*0Sstevel@tonic-gate 
145*0Sstevel@tonic-gate /*
146*0Sstevel@tonic-gate  * Convenience functions.
147*0Sstevel@tonic-gate  */
148*0Sstevel@tonic-gate /*PRINTFLIKE1*/
149*0Sstevel@tonic-gate extern char *uu_msprintf(const char *format, ...);
150*0Sstevel@tonic-gate extern void *uu_zalloc(size_t);
151*0Sstevel@tonic-gate extern void uu_free(void *);
152*0Sstevel@tonic-gate 
153*0Sstevel@tonic-gate /*
154*0Sstevel@tonic-gate  * Comparison function type definition.
155*0Sstevel@tonic-gate  *   Developers should be careful in their use of the _private argument. If you
156*0Sstevel@tonic-gate  *   break interface guarantees, you get undefined behavior.
157*0Sstevel@tonic-gate  */
158*0Sstevel@tonic-gate typedef int uu_compare_fn_t(const void *__left, const void *__right,
159*0Sstevel@tonic-gate     void *__private);
160*0Sstevel@tonic-gate 
161*0Sstevel@tonic-gate /*
162*0Sstevel@tonic-gate  * Walk variant flags.
163*0Sstevel@tonic-gate  *   A data structure need not provide support for all variants and
164*0Sstevel@tonic-gate  *   combinations.  Refer to the appropriate documentation.
165*0Sstevel@tonic-gate  */
166*0Sstevel@tonic-gate #define	UU_WALK_ROBUST		0x00000001	/* walk can survive removes */
167*0Sstevel@tonic-gate #define	UU_WALK_REVERSE		0x00000002	/* reverse walk order */
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate #define	UU_WALK_PREORDER	0x00000010	/* walk tree in pre-order */
170*0Sstevel@tonic-gate #define	UU_WALK_POSTORDER	0x00000020	/* walk tree in post-order */
171*0Sstevel@tonic-gate 
172*0Sstevel@tonic-gate /*
173*0Sstevel@tonic-gate  * Walk callback function return codes.
174*0Sstevel@tonic-gate  */
175*0Sstevel@tonic-gate #define	UU_WALK_ERROR		-1
176*0Sstevel@tonic-gate #define	UU_WALK_NEXT		0
177*0Sstevel@tonic-gate #define	UU_WALK_DONE		1
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate /*
180*0Sstevel@tonic-gate  * Walk callback function type definition.
181*0Sstevel@tonic-gate  */
182*0Sstevel@tonic-gate typedef int uu_walk_fn_t(void *_elem, void *_private);
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate /*
185*0Sstevel@tonic-gate  * lists: opaque structures
186*0Sstevel@tonic-gate  */
187*0Sstevel@tonic-gate typedef struct uu_list_pool uu_list_pool_t;
188*0Sstevel@tonic-gate typedef struct uu_list uu_list_t;
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate typedef struct uu_list_node {
191*0Sstevel@tonic-gate 	uintptr_t uln_opaque[2];
192*0Sstevel@tonic-gate } uu_list_node_t;
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate typedef struct uu_list_walk uu_list_walk_t;
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate typedef uintptr_t uu_list_index_t;
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate /*
199*0Sstevel@tonic-gate  * lists: interface
200*0Sstevel@tonic-gate  *
201*0Sstevel@tonic-gate  * basic usage:
202*0Sstevel@tonic-gate  *	typedef struct foo {
203*0Sstevel@tonic-gate  *		...
204*0Sstevel@tonic-gate  *		uu_list_node_t foo_node;
205*0Sstevel@tonic-gate  *		...
206*0Sstevel@tonic-gate  *	} foo_t;
207*0Sstevel@tonic-gate  *
208*0Sstevel@tonic-gate  *	static int
209*0Sstevel@tonic-gate  *	foo_compare(void *l_arg, void *r_arg, void *private)
210*0Sstevel@tonic-gate  *	{
211*0Sstevel@tonic-gate  *		foo_t *l = l_arg;
212*0Sstevel@tonic-gate  *		foo_t *r = r_arg;
213*0Sstevel@tonic-gate  *
214*0Sstevel@tonic-gate  *		if (... l greater than r ...)
215*0Sstevel@tonic-gate  *			return (1);
216*0Sstevel@tonic-gate  *		if (... l less than r ...)
217*0Sstevel@tonic-gate  *			return (-1);
218*0Sstevel@tonic-gate  *		return (0);
219*0Sstevel@tonic-gate  *	}
220*0Sstevel@tonic-gate  *
221*0Sstevel@tonic-gate  *	...
222*0Sstevel@tonic-gate  *		// at initialization time
223*0Sstevel@tonic-gate  *		foo_pool = uu_list_pool_create("foo_pool",
224*0Sstevel@tonic-gate  *		    sizeof (foo_t), offsetof(foo_t, foo_node), foo_compare,
225*0Sstevel@tonic-gate  *		    debugging? 0 : UU_AVL_POOL_DEBUG);
226*0Sstevel@tonic-gate  *	...
227*0Sstevel@tonic-gate  */
228*0Sstevel@tonic-gate uu_list_pool_t *uu_list_pool_create(const char *, size_t, size_t,
229*0Sstevel@tonic-gate     uu_compare_fn_t *, uint32_t);
230*0Sstevel@tonic-gate #define	UU_LIST_POOL_DEBUG	0x00000001
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate void uu_list_pool_destroy(uu_list_pool_t *);
233*0Sstevel@tonic-gate 
234*0Sstevel@tonic-gate /*
235*0Sstevel@tonic-gate  * usage:
236*0Sstevel@tonic-gate  *
237*0Sstevel@tonic-gate  *	foo_t *a;
238*0Sstevel@tonic-gate  *	a = malloc(sizeof(*a));
239*0Sstevel@tonic-gate  *	uu_list_node_init(a, &a->foo_list, pool);
240*0Sstevel@tonic-gate  *	...
241*0Sstevel@tonic-gate  *	uu_list_node_fini(a, &a->foo_list, pool);
242*0Sstevel@tonic-gate  *	free(a);
243*0Sstevel@tonic-gate  */
244*0Sstevel@tonic-gate void uu_list_node_init(void *, uu_list_node_t *, uu_list_pool_t *);
245*0Sstevel@tonic-gate void uu_list_node_fini(void *, uu_list_node_t *, uu_list_pool_t *);
246*0Sstevel@tonic-gate 
247*0Sstevel@tonic-gate uu_list_t *uu_list_create(uu_list_pool_t *, void *_parent, uint32_t);
248*0Sstevel@tonic-gate #define	UU_LIST_DEBUG	0x00000001
249*0Sstevel@tonic-gate #define	UU_LIST_SORTED	0x00000002	/* list is sorted */
250*0Sstevel@tonic-gate 
251*0Sstevel@tonic-gate void uu_list_destroy(uu_list_t *);	/* list must be empty */
252*0Sstevel@tonic-gate 
253*0Sstevel@tonic-gate size_t uu_list_numnodes(uu_list_t *);
254*0Sstevel@tonic-gate 
255*0Sstevel@tonic-gate void *uu_list_first(uu_list_t *);
256*0Sstevel@tonic-gate void *uu_list_last(uu_list_t *);
257*0Sstevel@tonic-gate 
258*0Sstevel@tonic-gate void *uu_list_next(uu_list_t *, void *);
259*0Sstevel@tonic-gate void *uu_list_prev(uu_list_t *, void *);
260*0Sstevel@tonic-gate 
261*0Sstevel@tonic-gate int uu_list_walk(uu_list_t *, uu_walk_fn_t *, void *, uint32_t);
262*0Sstevel@tonic-gate 
263*0Sstevel@tonic-gate uu_list_walk_t *uu_list_walk_start(uu_list_t *, uint32_t);
264*0Sstevel@tonic-gate void *uu_list_walk_next(uu_list_walk_t *);
265*0Sstevel@tonic-gate void uu_list_walk_end(uu_list_walk_t *);
266*0Sstevel@tonic-gate 
267*0Sstevel@tonic-gate void *uu_list_find(uu_list_t *, void *, void *, uu_list_index_t *);
268*0Sstevel@tonic-gate void uu_list_insert(uu_list_t *, void *, uu_list_index_t);
269*0Sstevel@tonic-gate 
270*0Sstevel@tonic-gate void *uu_list_nearest_next(uu_list_t *, uu_list_index_t);
271*0Sstevel@tonic-gate void *uu_list_nearest_prev(uu_list_t *, uu_list_index_t);
272*0Sstevel@tonic-gate 
273*0Sstevel@tonic-gate void *uu_list_teardown(uu_list_t *, void **);
274*0Sstevel@tonic-gate 
275*0Sstevel@tonic-gate void uu_list_remove(uu_list_t *, void *);
276*0Sstevel@tonic-gate 
277*0Sstevel@tonic-gate /*
278*0Sstevel@tonic-gate  * lists: interfaces for non-sorted lists only
279*0Sstevel@tonic-gate  */
280*0Sstevel@tonic-gate int uu_list_insert_before(uu_list_t *, void *_target, void *_elem);
281*0Sstevel@tonic-gate int uu_list_insert_after(uu_list_t *, void *_target, void *_elem);
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate /*
284*0Sstevel@tonic-gate  * avl trees: opaque structures
285*0Sstevel@tonic-gate  */
286*0Sstevel@tonic-gate typedef struct uu_avl_pool uu_avl_pool_t;
287*0Sstevel@tonic-gate typedef struct uu_avl uu_avl_t;
288*0Sstevel@tonic-gate 
289*0Sstevel@tonic-gate typedef struct uu_avl_node {
290*0Sstevel@tonic-gate #ifdef _LP64
291*0Sstevel@tonic-gate 	uintptr_t uan_opaque[3];
292*0Sstevel@tonic-gate #else
293*0Sstevel@tonic-gate 	uintptr_t uan_opaque[4];
294*0Sstevel@tonic-gate #endif
295*0Sstevel@tonic-gate } uu_avl_node_t;
296*0Sstevel@tonic-gate 
297*0Sstevel@tonic-gate typedef struct uu_avl_walk uu_avl_walk_t;
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate typedef uintptr_t uu_avl_index_t;
300*0Sstevel@tonic-gate 
301*0Sstevel@tonic-gate /*
302*0Sstevel@tonic-gate  * avl trees: interface
303*0Sstevel@tonic-gate  *
304*0Sstevel@tonic-gate  * basic usage:
305*0Sstevel@tonic-gate  *	typedef struct foo {
306*0Sstevel@tonic-gate  *		...
307*0Sstevel@tonic-gate  *		uu_avl_node_t foo_node;
308*0Sstevel@tonic-gate  *		...
309*0Sstevel@tonic-gate  *	} foo_t;
310*0Sstevel@tonic-gate  *
311*0Sstevel@tonic-gate  *	static int
312*0Sstevel@tonic-gate  *	foo_compare(void *l_arg, void *r_arg, void *private)
313*0Sstevel@tonic-gate  *	{
314*0Sstevel@tonic-gate  *		foo_t *l = l_arg;
315*0Sstevel@tonic-gate  *		foo_t *r = r_arg;
316*0Sstevel@tonic-gate  *
317*0Sstevel@tonic-gate  *		if (... l greater than r ...)
318*0Sstevel@tonic-gate  *			return (1);
319*0Sstevel@tonic-gate  *		if (... l less than r ...)
320*0Sstevel@tonic-gate  *			return (-1);
321*0Sstevel@tonic-gate  *		return (0);
322*0Sstevel@tonic-gate  *	}
323*0Sstevel@tonic-gate  *
324*0Sstevel@tonic-gate  *	...
325*0Sstevel@tonic-gate  *		// at initialization time
326*0Sstevel@tonic-gate  *		foo_pool = uu_avl_pool_create("foo_pool",
327*0Sstevel@tonic-gate  *		    sizeof (foo_t), offsetof(foo_t, foo_node), foo_compare,
328*0Sstevel@tonic-gate  *		    debugging? 0 : UU_AVL_POOL_DEBUG);
329*0Sstevel@tonic-gate  *	...
330*0Sstevel@tonic-gate  */
331*0Sstevel@tonic-gate uu_avl_pool_t *uu_avl_pool_create(const char *, size_t, size_t,
332*0Sstevel@tonic-gate     uu_compare_fn_t *, uint32_t);
333*0Sstevel@tonic-gate #define	UU_AVL_POOL_DEBUG	0x00000001
334*0Sstevel@tonic-gate 
335*0Sstevel@tonic-gate void uu_avl_pool_destroy(uu_avl_pool_t *);
336*0Sstevel@tonic-gate 
337*0Sstevel@tonic-gate /*
338*0Sstevel@tonic-gate  * usage:
339*0Sstevel@tonic-gate  *
340*0Sstevel@tonic-gate  *	foo_t *a;
341*0Sstevel@tonic-gate  *	a = malloc(sizeof(*a));
342*0Sstevel@tonic-gate  *	uu_avl_node_init(a, &a->foo_avl, pool);
343*0Sstevel@tonic-gate  *	...
344*0Sstevel@tonic-gate  *	uu_avl_node_fini(a, &a->foo_avl, pool);
345*0Sstevel@tonic-gate  *	free(a);
346*0Sstevel@tonic-gate  */
347*0Sstevel@tonic-gate void uu_avl_node_init(void *, uu_avl_node_t *, uu_avl_pool_t *);
348*0Sstevel@tonic-gate void uu_avl_node_fini(void *, uu_avl_node_t *, uu_avl_pool_t *);
349*0Sstevel@tonic-gate 
350*0Sstevel@tonic-gate uu_avl_t *uu_avl_create(uu_avl_pool_t *, void *_parent, uint32_t);
351*0Sstevel@tonic-gate #define	UU_AVL_DEBUG	0x00000001
352*0Sstevel@tonic-gate 
353*0Sstevel@tonic-gate void uu_avl_destroy(uu_avl_t *);	/* list must be empty */
354*0Sstevel@tonic-gate 
355*0Sstevel@tonic-gate size_t uu_avl_numnodes(uu_avl_t *);
356*0Sstevel@tonic-gate 
357*0Sstevel@tonic-gate void *uu_avl_first(uu_avl_t *);
358*0Sstevel@tonic-gate void *uu_avl_last(uu_avl_t *);
359*0Sstevel@tonic-gate 
360*0Sstevel@tonic-gate void *uu_avl_next(uu_avl_t *, void *);
361*0Sstevel@tonic-gate void *uu_avl_prev(uu_avl_t *, void *);
362*0Sstevel@tonic-gate 
363*0Sstevel@tonic-gate int uu_avl_walk(uu_avl_t *, uu_walk_fn_t *, void *, uint32_t);
364*0Sstevel@tonic-gate 
365*0Sstevel@tonic-gate uu_avl_walk_t *uu_avl_walk_start(uu_avl_t *, uint32_t);
366*0Sstevel@tonic-gate void *uu_avl_walk_next(uu_avl_walk_t *);
367*0Sstevel@tonic-gate void uu_avl_walk_end(uu_avl_walk_t *);
368*0Sstevel@tonic-gate 
369*0Sstevel@tonic-gate void *uu_avl_find(uu_avl_t *, void *, void *, uu_avl_index_t *);
370*0Sstevel@tonic-gate void uu_avl_insert(uu_avl_t *, void *, uu_avl_index_t);
371*0Sstevel@tonic-gate 
372*0Sstevel@tonic-gate void *uu_avl_nearest_next(uu_avl_t *, uu_avl_index_t);
373*0Sstevel@tonic-gate void *uu_avl_nearest_prev(uu_avl_t *, uu_avl_index_t);
374*0Sstevel@tonic-gate 
375*0Sstevel@tonic-gate void *uu_avl_teardown(uu_avl_t *, void **);
376*0Sstevel@tonic-gate 
377*0Sstevel@tonic-gate void uu_avl_remove(uu_avl_t *, void *);
378*0Sstevel@tonic-gate 
379*0Sstevel@tonic-gate #ifdef	__cplusplus
380*0Sstevel@tonic-gate }
381*0Sstevel@tonic-gate #endif
382*0Sstevel@tonic-gate 
383*0Sstevel@tonic-gate #endif	/* _LIBUUTIL_H */
384