xref: /titanic_51/usr/src/lib/mergeq/mergeq.h (revision 21b926adb26b0bf23fe75045ed308af582303bd0)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2015 Joyent, Inc.
14  */
15 
16 #ifndef _MERGEQ_H
17 #define	_MERGEQ_H
18 
19 /*
20  * mergeq library routines
21  */
22 
23 #include <sys/types.h>
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 typedef struct mergeq mergeq_t;
31 typedef int (mergeq_proc_f)(void *, void *, void **, void *);
32 
33 extern int mergeq_init(mergeq_t **, uint_t);
34 extern void mergeq_fini(mergeq_t *);
35 
36 extern int mergeq_add(mergeq_t *, void *);
37 
38 #define	MERGEQ_ERROR	-1
39 #define	MERGEQ_UERROR	-2
40 extern int mergeq_merge(mergeq_t *, mergeq_proc_f *, void *, void **, int *);
41 
42 /*
43  * Routines consumers need to implement
44  */
45 extern void *mergeq_alloc(size_t);
46 extern void mergeq_free(void *, size_t);
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52 #endif /* _MERGEQ_H */
53