xref: /illumos-gate/usr/src/lib/libzfs_jni/common/libzfs_jni_diskmgt.h (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _LIBZFS_JNI_DISKMGT_H
28 #define	_LIBZFS_JNI_DISKMGT_H
29 
30 #include <libdiskmgt.h>
31 #include <sys/varargs.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Types
39  */
40 
41 typedef struct dmgt_slice {
42 	char *name;
43 	uint64_t start;
44 	uint64_t size;
45 	char *used_name;
46 	char *used_by;
47 } dmgt_slice_t;
48 
49 typedef struct dmgt_disk {
50 	char *name;
51 	uint64_t size;
52 	uint32_t blocksize;
53 	int in_use;
54 
55 	/* NULL-terminated array */
56 	char **aliases;
57 
58 	/* NULL-terminated array */
59 	dmgt_slice_t **slices;
60 } dmgt_disk_t;
61 
62 /* Callback function for available disk iteration */
63 typedef int (*dmgt_disk_iter_f)(dmgt_disk_t *, void *);
64 
65 /*
66  * Function prototypes
67  */
68 
69 extern int dmgt_avail_disk_iter(dmgt_disk_iter_f func, void *data);
70 extern void dmgt_free_disk(dmgt_disk_t *);
71 extern void dmgt_free_slice(dmgt_slice_t *);
72 extern void dmgt_set_error_handler(void (*)(const char *, va_list));
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* _LIBZFS_JNI_DISKMGT_H */
79