Lines Matching full:hdl
76 libpc_error_description(libpc_handle_t *hdl) in libpc_error_description() argument
78 if (hdl->lpc_desc[0] != '\0') in libpc_error_description()
79 return (hdl->lpc_desc); in libpc_error_description()
81 switch (hdl->lpc_error) { in libpc_error_description()
94 assert(hdl->lpc_error == 0); in libpc_error_description()
100 zutil_error_aux(libpc_handle_t *hdl, const char *fmt, ...) in zutil_error_aux() argument
106 (void) vsnprintf(hdl->lpc_desc, sizeof (hdl->lpc_desc), fmt, ap); in zutil_error_aux()
107 hdl->lpc_desc_active = B_TRUE; in zutil_error_aux()
113 zutil_verror(libpc_handle_t *hdl, lpc_error_t error, const char *fmt, in zutil_verror() argument
119 hdl->lpc_error = error; in zutil_verror()
121 if (hdl->lpc_desc_active) in zutil_verror()
122 hdl->lpc_desc_active = B_FALSE; in zutil_verror()
124 hdl->lpc_desc[0] = '\0'; in zutil_verror()
126 if (hdl->lpc_printerr) in zutil_verror()
128 libpc_error_description(hdl)); in zutil_verror()
132 zutil_error_fmt(libpc_handle_t *hdl, lpc_error_t error, in zutil_error_fmt() argument
139 zutil_verror(hdl, error, fmt, ap); in zutil_error_fmt()
147 zutil_error(libpc_handle_t *hdl, lpc_error_t error, const char *msg) in zutil_error() argument
149 return (zutil_error_fmt(hdl, error, "%s", msg)); in zutil_error()
153 zutil_no_memory(libpc_handle_t *hdl) in zutil_no_memory() argument
155 zutil_error(hdl, LPC_NOMEM, "internal error"); in zutil_no_memory()
160 zutil_alloc(libpc_handle_t *hdl, size_t size) in zutil_alloc() argument
165 (void) zutil_no_memory(hdl); in zutil_alloc()
171 zutil_strdup(libpc_handle_t *hdl, const char *str) in zutil_strdup() argument
176 (void) zutil_no_memory(hdl); in zutil_strdup()
182 zutil_strndup(libpc_handle_t *hdl, const char *str, size_t n) in zutil_strndup() argument
187 (void) zutil_no_memory(hdl); in zutil_strndup()
231 fix_paths(libpc_handle_t *hdl, nvlist_t *nv, name_entry_t *names) in fix_paths() argument
242 if (fix_paths(hdl, child[c], names) != 0) in fix_paths()
312 add_config(libpc_handle_t *hdl, pool_list_t *pl, const char *path, in add_config() argument
330 if ((ne = zutil_alloc(hdl, sizeof (name_entry_t))) == NULL) in add_config()
333 if ((ne->ne_name = zutil_strdup(hdl, path)) == NULL) { in add_config()
375 if ((pe = zutil_alloc(hdl, sizeof (pool_entry_t))) == NULL) { in add_config()
393 if ((ve = zutil_alloc(hdl, sizeof (vdev_entry_t))) == NULL) { in add_config()
412 if ((ce = zutil_alloc(hdl, sizeof (config_entry_t))) == NULL) { in add_config()
427 if ((ne = zutil_alloc(hdl, sizeof (name_entry_t))) == NULL) in add_config()
430 if ((ne->ne_name = zutil_strdup(hdl, path)) == NULL) { in add_config()
445 zutil_pool_active(libpc_handle_t *hdl, const char *name, uint64_t guid, in zutil_pool_active() argument
448 ASSERT(hdl->lpc_ops->pco_pool_active != NULL); in zutil_pool_active()
450 int error = hdl->lpc_ops->pco_pool_active(hdl->lpc_lib_handle, name, in zutil_pool_active()
457 zutil_refresh_config(libpc_handle_t *hdl, nvlist_t *tryconfig) in zutil_refresh_config() argument
459 ASSERT(hdl->lpc_ops->pco_refresh_config != NULL); in zutil_refresh_config()
461 return (hdl->lpc_ops->pco_refresh_config(hdl->lpc_lib_handle, in zutil_refresh_config()
490 get_configs(libpc_handle_t *hdl, pool_list_t *pl, boolean_t active_ok, in get_configs() argument
653 newchild = zutil_alloc(hdl, (id + 1) * in get_configs()
685 newchild = zutil_alloc(hdl, (max_id) * in get_configs()
792 if (fix_paths(hdl, nvroot, pl->names) != 0) { in get_configs()
823 if (zutil_pool_active(hdl, name, guid, &isactive) != 0) in get_configs()
838 if ((nvl = zutil_refresh_config(hdl, config)) == NULL) { in get_configs()
856 if (fix_paths(hdl, spares[i], pl->names) != 0) in get_configs()
867 if (fix_paths(hdl, l2cache[i], pl->names) != 0) in get_configs()
903 (void) zutil_no_memory(hdl); in get_configs()
1176 label_paths_impl(libpc_handle_t *hdl, nvlist_t *nvroot, uint64_t pool_guid, in label_paths_impl() argument
1188 error = label_paths_impl(hdl, child[c], in label_paths_impl()
1220 label_paths(libpc_handle_t *hdl, nvlist_t *label, const char **path, in label_paths() argument
1248 return (label_paths_impl(hdl, nvroot, pool_guid, vdev_guid, path, in label_paths()
1253 zpool_find_import_scan_add_slice(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_add_slice() argument
1259 slice = zutil_alloc(hdl, sizeof (rdsk_node_t)); in zpool_find_import_scan_add_slice()
1267 slice->rn_hdl = hdl; in zpool_find_import_scan_add_slice()
1282 zpool_find_import_scan_dir(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_dir() argument
1295 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_dir()
1296 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_dir()
1304 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_dir()
1305 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_dir()
1328 zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, in zpool_find_import_scan_dir()
1337 zpool_find_import_scan_path(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan_path() argument
1357 dpath = d = zutil_strndup(hdl, dir, dl); in zpool_find_import_scan_path()
1366 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan_path()
1367 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext(TEXT_DOMAIN, in zpool_find_import_scan_path()
1372 zpool_find_import_scan_add_slice(hdl, lock, cache, path, name, order); in zpool_find_import_scan_path()
1383 zpool_find_import_scan(libpc_handle_t *hdl, pthread_mutex_t *lock, in zpool_find_import_scan() argument
1392 cache = zutil_alloc(hdl, sizeof (avl_tree_t)); in zpool_find_import_scan()
1404 zutil_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_find_import_scan()
1405 (void) zutil_error_fmt(hdl, LPC_BADPATH, dgettext( in zpool_find_import_scan()
1416 if ((error = zpool_find_import_scan_dir(hdl, lock, in zpool_find_import_scan()
1420 if ((error = zpool_find_import_scan_path(hdl, lock, in zpool_find_import_scan()
1448 zpool_find_import_impl(libpc_handle_t *hdl, importargs_t *iarg, in zpool_find_import_impl() argument
1545 add_config(hdl, &pools, in zpool_find_import_impl()
1558 ret = get_configs(hdl, &pools, iarg->can_be_active, iarg->policy); in zpool_find_import_impl()
1588 discover_cached_paths(libpc_handle_t *hdl, nvlist_t *nv, in discover_cached_paths() argument
1599 discover_cached_paths(hdl, child[c], cache, lock); in discover_cached_paths()
1617 ret = zpool_find_import_scan_dir(hdl, lock, cache, in discover_cached_paths()
1633 zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg) in zpool_find_import_cached() argument
1648 zutil_error_aux(hdl, "%s", zfs_strerror(errno)); in zpool_find_import_cached()
1649 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1655 zutil_error_aux(hdl, "%s", zfs_strerror(errno)); in zpool_find_import_cached()
1657 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1662 if ((buf = zutil_alloc(hdl, statbuf.st_size)) == NULL) { in zpool_find_import_cached()
1670 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1679 (void) zutil_error(hdl, LPC_BADCACHE, dgettext(TEXT_DOMAIN, in zpool_find_import_cached()
1691 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1708 if (zutil_pool_active(hdl, name, this_guid, &active) != 0) { in zpool_find_import_cached()
1728 avl_tree_t *cache = zutil_alloc(hdl, in zpool_find_import_cached()
1752 discover_cached_paths(hdl, nvroot, cache, &lock); in zpool_find_import_cached()
1753 nvlist_t *nv = zpool_find_import_impl(hdl, iarg, in zpool_find_import_cached()
1781 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1789 if ((dst = zutil_refresh_config(hdl, src)) == NULL) { in zpool_find_import_cached()
1796 (void) zutil_no_memory(hdl); in zpool_find_import_cached()
1809 zpool_find_import(libpc_handle_t *hdl, importargs_t *iarg) in zpool_find_import() argument
1831 if (zpool_find_import_scan(hdl, &lock, &cache, in zpool_find_import()
1837 if (zpool_find_import_blkid(hdl, &lock, &cache) != 0) { in zpool_find_import()
1843 pools = zpool_find_import_impl(hdl, iarg, &lock, cache); in zpool_find_import()
1850 zpool_search_import(libpc_handle_t *hdl, importargs_t *import) in zpool_search_import() argument
1857 pools = zpool_find_import_cached(hdl, import); in zpool_search_import()
1859 pools = zpool_find_import(hdl, import); in zpool_search_import()
1862 hdl->lpc_open_access_error && geteuid() != 0) { in zpool_search_import()
1863 (void) zutil_error(hdl, LPC_EACCESS, dgettext(TEXT_DOMAIN, in zpool_search_import()
1887 zpool_find_config(libpc_handle_t *hdl, const char *target, nvlist_t **configp, in zpool_find_config() argument
1905 pools = zpool_search_import(hdl, args); in zpool_find_config()