Lines Matching full:hdl
75 libpc_error_description(libpc_handle_t *hdl) in libpc_error_description() argument
77 if (hdl->lpc_desc[0] != '\0') in libpc_error_description()
78 return (hdl->lpc_desc); in libpc_error_description()
80 switch (hdl->lpc_error) { in libpc_error_description()
93 assert(hdl->lpc_error == 0); in libpc_error_description()
99 zutil_error_aux(libpc_handle_t *hdl, const char *fmt, ...) in zutil_error_aux() argument
105 (void) vsnprintf(hdl->lpc_desc, sizeof (hdl->lpc_desc), fmt, ap); in zutil_error_aux()
106 hdl->lpc_desc_active = B_TRUE; in zutil_error_aux()
112 zutil_verror(libpc_handle_t *hdl, lpc_error_t error, const char *fmt, in zutil_verror() argument
118 hdl->lpc_error = error; in zutil_verror()
120 if (hdl->lpc_desc_active) in zutil_verror()
121 hdl->lpc_desc_active = B_FALSE; in zutil_verror()
123 hdl->lpc_desc[0] = '\0'; in zutil_verror()
125 if (hdl->lpc_printerr) in zutil_verror()
127 libpc_error_description(hdl)); in zutil_verror()
131 zutil_error_fmt(libpc_handle_t *hdl, lpc_error_t error, in zutil_error_fmt() argument
138 zutil_verror(hdl, error, fmt, ap); in zutil_error_fmt()
146 zutil_error(libpc_handle_t *hdl, lpc_error_t error, const char *msg) in zutil_error() argument
148 return (zutil_error_fmt(hdl, error, "%s", msg)); in zutil_error()
152 zutil_no_memory(libpc_handle_t *hdl) in zutil_no_memory() argument
154 zutil_error(hdl, LPC_NOMEM, "internal error"); in zutil_no_memory()
159 zutil_alloc(libpc_handle_t *hdl, size_t size) in zutil_alloc() argument
164 (void) zutil_no_memory(hdl); in zutil_alloc()
170 zutil_strdup(libpc_handle_t *hdl, const char *str) in zutil_strdup() argument
175 (void) zutil_no_memory(hdl); in zutil_strdup()
181 zutil_strndup(libpc_handle_t *hdl, const char *str, size_t n) in zutil_strndup() argument
186 (void) zutil_no_memory(hdl); in zutil_strndup()
230 fix_paths(libpc_handle_t *hdl, nvlist_t *nv, name_entry_t *names) in fix_paths() argument
241 if (fix_paths(hdl, child[c], names) != 0) in fix_paths()
311 add_config(libpc_handle_t *hdl, pool_list_t *pl, const char *path, in add_config() argument
329 if ((ne = zutil_alloc(hdl, sizeof (name_entry_t))) == NULL) in add_config()
332 if ((ne->ne_name = zutil_strdup(hdl, path)) == NULL) { in add_config()
374 if ((pe = zutil_alloc(hdl, sizeof (pool_entry_t))) == NULL) { in add_config()
392 if ((ve = zutil_alloc(hdl, sizeof (vdev_entry_t))) == NULL) { in add_config()
411 if ((ce = zutil_alloc(hdl, sizeof (config_entry_t))) == NULL) { in add_config()
426 if ((ne = zutil_alloc(hdl, sizeof (name_entry_t))) == NULL) in add_config()
429 if ((ne->ne_name = zutil_strdup(hdl, path)) == NULL) { in add_config()
444 zutil_pool_active(libpc_handle_t *hdl, const char *name, uint64_t guid, in zutil_pool_active() argument
447 ASSERT(hdl->lpc_ops->pco_pool_active != NULL); in zutil_pool_active()
449 int error = hdl->lpc_ops->pco_pool_active(hdl->lpc_lib_handle, name, in zutil_pool_active()
456 zutil_refresh_config(libpc_handle_t *hdl, nvlist_t *tryconfig) in zutil_refresh_config() argument
458 ASSERT(hdl->lpc_ops->pco_refresh_config != NULL); in zutil_refresh_config()
460 return (hdl->lpc_ops->pco_refresh_config(hdl->lpc_lib_handle, in zutil_refresh_config()
489 get_configs(libpc_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, in get_configs() argument
652 newchild = zutil_alloc(hdl, (id + 1) * in get_configs()
684 newchild = zutil_alloc(hdl, (max_id) * in get_configs()
791 if (fix_paths(hdl, nvroot, pl->names) != 0) { in get_configs()
822 if (zutil_pool_active(hdl, name, guid, &isactive) != 0) in get_configs()
837 if ((nvl = zutil_refresh_config(hdl, config)) == NULL) { in get_configs()
855 if (fix_paths(hdl, spares[i], pl->names) != 0) in get_configs()
866 if (fix_paths(hdl, l2cache[i], pl->names) != 0) in get_configs()
902 (void) zutil_no_memory(hdl); in get_configs()
1175 label_paths_impl(libpc_handle_t *hdl, nvlist_t *nvroot, uint64_t pool_guid, in label_paths_impl() argument
1187 error = label_paths_impl(hdl, child[c], in label_paths_impl()
1219 label_paths(libpc_handle_t *hdl, nvlist_t *label, const char **path, in label_paths() argument
1247 return (label_paths_impl(hdl, nvroot, pool_guid, vdev_guid, path, in label_paths()
1252 zpool_find_import_scan_add_slice(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_add_slice() argument
1258 slice = zutil_alloc(hdl, sizeof (rdsk_node_t)); in zpool_find_import_scan_add_slice()
1266 slice->rn_hdl = hdl; in zpool_find_import_scan_add_slice()
1281 zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_dir() argument
1294 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_dir()
1295 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_dir()
1303 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_dir()
1304 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_dir()
1327 zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, in zpool_find_import_scan_dir()
1336 zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_path() argument
1356 dpath = d = zutil_strndup(hdl, dir, dl); in zpool_find_import_scan_path()
1365 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_path()
1366 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_path()
1371 zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, order); in zpool_find_import_scan_path()
1382 zpool_find_import_scan(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan() argument
1391 cache = zutil_alloc(hdl, sizeof (avl_tree_t)); in zpool_find_import_scan()
1403 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan()
1404 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext( in zpool_find_import_scan()
1415 if ((error = zpool_find_import_scan_dir(hdl, lock, in zpool_find_import_scan()
1419 if ((error = zpool_find_import_scan_path(hdl, lock, in zpool_find_import_scan()
1447 zpool_find_import_impl(libpc_handle_t *hdl, importargs_t *iarg, in zpool_find_import_impl() argument
1544 add_config(hdl, &pools, in zpool_find_import_impl()
1557 ret = get_configs(hdl, &pools, iarg->can_be_active, iarg->policy); in zpool_find_import_impl()
1587 discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, in discover_cached_paths() argument
1598 discover_cached_paths(hdl, child[c], cache, lock); in discover_cached_paths()
1616 ret = zpool_find_import_scan_dir(hdl, lock, cache, in discover_cached_paths()
1632 zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg) in zpool_find_import_cached() argument
1647 zutil_error_aux(hdl, "%s", zfs_strerror(errno)); in zpool_find_import_cached()
1648 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1654 zutil_error_aux(hdl, "%s", zfs_strerror(errno)); in zpool_find_import_cached()
1656 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1661 if ((buf = zutil_alloc(hdl, statbuf.st_size)) == NULL) { in zpool_find_import_cached()
1669 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1678 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1690 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1707 if (zutil_pool_active(hdl, name, this_guid, &active) != 0) { in zpool_find_import_cached()
1727 avl_tree_t *cache = zutil_alloc(hdl, in zpool_find_import_cached()
1751 discover_cached_paths(hdl, nvroot, cache, &lock); in zpool_find_import_cached()
1752 nvlist_t *nv = zpool_find_import_impl(hdl, iarg, in zpool_find_import_cached()
1780 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1788 if ((dst = zutil_refresh_config(hdl, src)) == NULL) { in zpool_find_import_cached()
1795 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1808 zpool_find_import(libpc_handle_t *hdl, importargs_t *iarg) in zpool_find_import() argument
1830 if (zpool_find_import_scan(hdl, &lock, &cache, in zpool_find_import()
1836 if (zpool_find_import_blkid(hdl, &lock, &cache) != 0) { in zpool_find_import()
1842 pools = zpool_find_import_impl(hdl, iarg, &lock, cache); in zpool_find_import()
1849 zpool_search_import(libpc_handle_t *hdl, importargs_t *import) in zpool_search_import() argument
1856 pools = zpool_find_import_cached(hdl, import); in zpool_search_import()
1858 pools = zpool_find_import(hdl, import); in zpool_search_import()
1861 hdl->lpc_open_access_error && geteuid() != 0) { in zpool_search_import()
1862 (void) zutil_error(hdl, LPC_EACCESS, dgettext(TEXT_DOMAIN, in zpool_search_import()
1886 zpool_find_config(libpc_handle_t *hdl, const char *target, nvlist_t **configp, in zpool_find_config() argument
1904 pools = zpool_search_import(hdl, args); in zpool_find_config()