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