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