xref: /titanic_44/usr/src/cmd/zpool/zpool_util.h (revision 5ad820458efd0fdb914baff9c1447c22b819fa23)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
599653d4eSeschrock  * Common Development and Distribution License (the "License").
699653d4eSeschrock  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
22c67d9675Seschrock  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens #ifndef	ZPOOL_UTIL_H
27fa9e4066Sahrens #define	ZPOOL_UTIL_H
28fa9e4066Sahrens 
29fa9e4066Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
30fa9e4066Sahrens 
31fa9e4066Sahrens #include <libnvpair.h>
32fa9e4066Sahrens #include <libzfs.h>
33fa9e4066Sahrens 
34fa9e4066Sahrens #ifdef	__cplusplus
35fa9e4066Sahrens extern "C" {
36fa9e4066Sahrens #endif
37fa9e4066Sahrens 
38fa9e4066Sahrens /*
39fa9e4066Sahrens  * Basic utility functions
40fa9e4066Sahrens  */
41fa9e4066Sahrens void *safe_malloc(size_t);
42fa9e4066Sahrens char *safe_strdup(const char *);
43*5ad82045Snd150628 void zpool_no_memory(void);
44fa9e4066Sahrens 
45fa9e4066Sahrens /*
46fa9e4066Sahrens  * Virtual device functions
47fa9e4066Sahrens  */
48fa9e4066Sahrens nvlist_t *make_root_vdev(nvlist_t *poolconfig, int force, int check_rep,
4999653d4eSeschrock     boolean_t isreplace, int argc, char **argv);
50fa9e4066Sahrens 
51fa9e4066Sahrens /*
52fa9e4066Sahrens  * Pool list functions
53fa9e4066Sahrens  */
5499653d4eSeschrock int for_each_pool(int, char **, boolean_t unavail, zpool_iter_f, void *);
55fa9e4066Sahrens 
56fa9e4066Sahrens typedef struct zpool_list zpool_list_t;
57fa9e4066Sahrens 
58fa9e4066Sahrens zpool_list_t *pool_list_get(int, char **, int *);
59fa9e4066Sahrens void pool_list_update(zpool_list_t *);
60fa9e4066Sahrens int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *);
61fa9e4066Sahrens void pool_list_free(zpool_list_t *);
62fa9e4066Sahrens int pool_list_count(zpool_list_t *);
63fa9e4066Sahrens void pool_list_remove(zpool_list_t *, zpool_handle_t *);
64fa9e4066Sahrens 
6599653d4eSeschrock libzfs_handle_t *g_zfs;
6699653d4eSeschrock 
67fa9e4066Sahrens #ifdef	__cplusplus
68fa9e4066Sahrens }
69fa9e4066Sahrens #endif
70fa9e4066Sahrens 
71fa9e4066Sahrens #endif	/* ZPOOL_UTIL_H */
72