zpool_util.h revision 185029
1168404Spjd/*
2168404Spjd * CDDL HEADER START
3168404Spjd *
4168404Spjd * The contents of this file are subject to the terms of the
5168404Spjd * Common Development and Distribution License (the "License").
6168404Spjd * You may not use this file except in compliance with the License.
7168404Spjd *
8168404Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9168404Spjd * or http://www.opensolaris.org/os/licensing.
10168404Spjd * See the License for the specific language governing permissions
11168404Spjd * and limitations under the License.
12168404Spjd *
13168404Spjd * When distributing Covered Code, include this CDDL HEADER in each
14168404Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15168404Spjd * If applicable, add the following below this CDDL HEADER, with the
16168404Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17168404Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18168404Spjd *
19168404Spjd * CDDL HEADER END
20168404Spjd */
21168404Spjd/*
22185029Spjd * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23168404Spjd * Use is subject to license terms.
24168404Spjd */
25168404Spjd
26168404Spjd#ifndef	ZPOOL_UTIL_H
27168404Spjd#define	ZPOOL_UTIL_H
28168404Spjd
29168404Spjd#include <libnvpair.h>
30168404Spjd#include <libzfs.h>
31168404Spjd
32168404Spjd#ifdef	__cplusplus
33168404Spjdextern "C" {
34168404Spjd#endif
35168404Spjd
36168404Spjd/*
37168404Spjd * Basic utility functions
38168404Spjd */
39168404Spjdvoid *safe_malloc(size_t);
40168404Spjdchar *safe_strdup(const char *);
41168404Spjdvoid zpool_no_memory(void);
42185029Spjduint_t num_logs(nvlist_t *nv);
43168404Spjd
44168404Spjd/*
45168404Spjd * Virtual device functions
46168404Spjd */
47168404Spjd
48185029Spjdnvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
49185029Spjd    boolean_t isreplace, boolean_t dryrun, int argc, char **argv);
50185029Spjd
51168404Spjd/*
52168404Spjd * Pool list functions
53168404Spjd */
54185029Spjdint for_each_pool(int, char **, boolean_t unavail, zprop_list_t **,
55168404Spjd    zpool_iter_f, void *);
56168404Spjd
57168404Spjdtypedef struct zpool_list zpool_list_t;
58168404Spjd
59185029Spjdzpool_list_t *pool_list_get(int, char **, zprop_list_t **, int *);
60168404Spjdvoid pool_list_update(zpool_list_t *);
61168404Spjdint pool_list_iter(zpool_list_t *, int unavail, zpool_iter_f, void *);
62168404Spjdvoid pool_list_free(zpool_list_t *);
63168404Spjdint pool_list_count(zpool_list_t *);
64168404Spjdvoid pool_list_remove(zpool_list_t *, zpool_handle_t *);
65168404Spjd
66168404Spjdlibzfs_handle_t *g_zfs;
67168404Spjd
68168404Spjd#ifdef	__cplusplus
69168404Spjd}
70168404Spjd#endif
71168404Spjd
72168404Spjd#endif	/* ZPOOL_UTIL_H */
73