xref: /titanic_50/usr/src/cmd/zpool/zpool_util.h (revision f47a9c508408507a404eaf38dd597e6ac41f92e6)
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 2005 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 const char *vdev_get_name(nvlist_t *nv);
47 
48 /*
49  * Virtual device functions
50  */
51 nvlist_t *make_root_vdev(nvlist_t *poolconfig, int force, int check_rep,
52     int argc, char **argv);
53 
54 /*
55  * Pool list functions
56  */
57 int for_each_pool(int, char **, int unavail, zpool_iter_f, void *);
58 
59 typedef struct zpool_list zpool_list_t;
60 
61 zpool_list_t *pool_list_get(int, char **, int *);
62 void pool_list_update(zpool_list_t *);
63 int pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *);
64 void pool_list_free(zpool_list_t *);
65 int pool_list_count(zpool_list_t *);
66 void pool_list_remove(zpool_list_t *, zpool_handle_t *);
67 
68 /*
69  * Dataset functions
70  */
71 int unmount_datasets(zpool_handle_t *, int);
72 int mount_share_datasets(zpool_handle_t *, const char *);
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif	/* ZPOOL_UTIL_H */
79