xref: /onnv-gate/usr/src/lib/libzfs_jni/common/libzfs_jni_diskmgt.h (revision 1499:126a10cdde15)
1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
5*1499Stalley  * Common Development and Distribution License (the "License").
6*1499Stalley  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
21*1499Stalley 
22789Sahrens /*
23*1499Stalley  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24789Sahrens  * Use is subject to license terms.
25789Sahrens  */
26789Sahrens 
27789Sahrens #ifndef _LIBZFS_JNI_DISKMGT_H
28789Sahrens #define	_LIBZFS_JNI_DISKMGT_H
29789Sahrens 
30789Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
31789Sahrens 
32*1499Stalley #include <libdiskmgt.h>
33*1499Stalley #include <sys/varargs.h>
34*1499Stalley 
35789Sahrens #ifdef __cplusplus
36789Sahrens extern "C" {
37789Sahrens #endif
38789Sahrens 
39789Sahrens /*
40789Sahrens  * Types
41789Sahrens  */
42789Sahrens 
43789Sahrens typedef struct dmgt_slice {
44789Sahrens 	char *name;
45789Sahrens 	uint64_t start;
46789Sahrens 	uint64_t size;
47789Sahrens 	char *used_name;
48789Sahrens 	char *used_by;
49789Sahrens } dmgt_slice_t;
50789Sahrens 
51789Sahrens typedef struct dmgt_disk {
52789Sahrens 	char *name;
53789Sahrens 	uint64_t size;
54789Sahrens 	uint32_t blocksize;
55789Sahrens 	int in_use;
56789Sahrens 
57789Sahrens 	/* NULL-terminated array */
58789Sahrens 	char **aliases;
59789Sahrens 
60789Sahrens 	/* NULL-terminated array */
61789Sahrens 	dmgt_slice_t **slices;
62789Sahrens } dmgt_disk_t;
63789Sahrens 
64789Sahrens /* Callback function for available disk iteration */
65789Sahrens typedef int (*dmgt_disk_iter_f)(dmgt_disk_t *, void *);
66789Sahrens 
67789Sahrens /*
68789Sahrens  * Function prototypes
69789Sahrens  */
70789Sahrens 
71789Sahrens extern int dmgt_avail_disk_iter(dmgt_disk_iter_f func, void *data);
72789Sahrens extern void dmgt_free_disk(dmgt_disk_t *);
73789Sahrens extern void dmgt_free_slice(dmgt_slice_t *);
74789Sahrens extern void dmgt_set_error_handler(void (*)(const char *, va_list));
75789Sahrens 
76789Sahrens #ifdef __cplusplus
77789Sahrens }
78789Sahrens #endif
79789Sahrens 
80789Sahrens #endif /* _LIBZFS_JNI_DISKMGT_H */
81