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/*
22219089Spjd * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23168404Spjd */
24168404Spjd
25168404Spjd#ifndef	ZPOOL_UTIL_H
26168404Spjd#define	ZPOOL_UTIL_H
27168404Spjd
28168404Spjd#include <libnvpair.h>
29168404Spjd#include <libzfs.h>
30168404Spjd
31168404Spjd#ifdef	__cplusplus
32168404Spjdextern "C" {
33168404Spjd#endif
34168404Spjd
35168404Spjd/*
36168404Spjd * Basic utility functions
37168404Spjd */
38168404Spjdvoid *safe_malloc(size_t);
39168404Spjdvoid zpool_no_memory(void);
40185029Spjduint_t num_logs(nvlist_t *nv);
41168404Spjd
42168404Spjd/*
43168404Spjd * Virtual device functions
44168404Spjd */
45168404Spjd
46185029Spjdnvlist_t *make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
47219089Spjd    boolean_t replacing, boolean_t dryrun, int argc, char **argv);
48219089Spjdnvlist_t *split_mirror_vdev(zpool_handle_t *zhp, char *newname,
49219089Spjd    nvlist_t *props, splitflags_t flags, 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