4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
25 * Copyright 2015 RackTop Systems.
26 * Copyright (c) 2016, Intel Corporation.
28 #ifndef _LIBZUTIL_ZUTIL_IMPORT_H_
29 #define _LIBZUTIL_ZUTIL_IMPORT_H_
31 #define EZFS_BADCACHE "invalid or missing cache file"
32 #define EZFS_BADPATH "must be an absolute path"
33 #define EZFS_NOMEM "out of memory"
34 #define EZFS_EACESS "some devices require root privileges"
36 #define IMPORT_ORDER_PREFERRED_1 1
37 #define IMPORT_ORDER_PREFERRED_2 2
38 #define IMPORT_ORDER_SCAN_OFFSET 10
39 #define IMPORT_ORDER_DEFAULT 100
41 typedef struct libpc_handle {
42 boolean_t lpc_printerr;
43 boolean_t lpc_open_access_error;
44 boolean_t lpc_desc_active;
46 const pool_config_ops_t *lpc_ops;
51 int label_paths(libpc_handle_t *hdl, nvlist_t *label, char **path,
53 int zpool_find_import_blkid(libpc_handle_t *hdl, pthread_mutex_t *lock,
54 avl_tree_t **slice_cache);
56 void * zutil_alloc(libpc_handle_t *hdl, size_t size);
57 char *zutil_strdup(libpc_handle_t *hdl, const char *str);
59 typedef struct rdsk_node {
60 char *rn_name; /* Full path to device */
61 int rn_order; /* Preferred order (low to high) */
62 int rn_num_labels; /* Number of valid labels */
63 uint64_t rn_vdev_guid; /* Expected vdev guid when set */
64 libpc_handle_t *rn_hdl;
65 nvlist_t *rn_config; /* Label config */
68 pthread_mutex_t *rn_lock;
69 boolean_t rn_labelpaths;
72 int slice_cache_compare(const void *, const void *);
74 void zpool_open_func(void *);
76 #endif /* _LIBZUTIL_ZUTIL_IMPORT_H_ */