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