Lines Matching refs:zhp
410 zpool_collect_leaves(zpool_handle_t *zhp, nvlist_t *nvroot, nvlist_t *res) in zpool_collect_leaves() argument
420 char *path = zpool_vdev_name(g_zfs, zhp, nvroot, 0); in zpool_collect_leaves()
430 zpool_collect_leaves(zhp, child[i], res); in zpool_collect_leaves()
523 print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent, in print_vdev_tree() argument
555 vname = zpool_vdev_name(g_zfs, zhp, child[c], name_flags); in print_vdev_tree()
556 print_vdev_tree(zhp, vname, child[c], indent + 2, "", in print_vdev_tree()
691 zpool_handle_t *zhp; in zpool_do_add() local
752 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_add()
755 if ((config = zpool_get_config(zhp, NULL)) == NULL) { in zpool_do_add()
758 zpool_close(zhp); in zpool_do_add()
762 if (zpool_is_bootable(zhp)) in zpool_do_add()
773 intval = zpool_get_prop_int(zhp, ZPOOL_PROP_ASHIFT, &src); in zpool_do_add()
782 boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); in zpool_do_add()
783 nvroot = make_root_vdev(zhp, props, force, !force, B_FALSE, dryrun, in zpool_do_add()
786 zpool_close(zhp); in zpool_do_add()
797 "configuration:\n"), zpool_get_name(zhp)); in zpool_do_add()
800 print_vdev_tree(zhp, poolname, poolnvroot, 0, "", in zpool_do_add()
802 print_vdev_tree(zhp, NULL, nvroot, 0, "", name_flags); in zpool_do_add()
805 print_vdev_tree(zhp, "dedup", poolnvroot, 0, in zpool_do_add()
807 print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_DEDUP, in zpool_do_add()
810 print_vdev_tree(zhp, "special", poolnvroot, 0, in zpool_do_add()
812 print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_SPECIAL, in zpool_do_add()
815 print_vdev_tree(zhp, "logs", poolnvroot, 0, VDEV_ALLOC_BIAS_LOG, in zpool_do_add()
817 print_vdev_tree(zhp, NULL, nvroot, 0, VDEV_ALLOC_BIAS_LOG, in zpool_do_add()
822 ret = (zpool_add(zhp, nvroot) != 0); in zpool_do_add()
827 zpool_close(zhp); in zpool_do_add()
842 zpool_handle_t *zhp; in zpool_do_remove() local
878 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_remove()
891 if (zpool_vdev_remove_cancel(zhp) != 0) in zpool_do_remove()
903 if (zpool_vdev_indirect_size(zhp, argv[i], in zpool_do_remove()
920 if (zpool_vdev_remove(zhp, argv[i]) != 0) in zpool_do_remove()
1488 zpool_handle_t *zhp; in zpool_do_destroy() local
1519 if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) { in zpool_do_destroy()
1530 if (zpool_disable_datasets(zhp, force) != 0) { in zpool_do_destroy()
1532 "could not unmount datasets\n"), zpool_get_name(zhp)); in zpool_do_destroy()
1539 ret = (zpool_destroy(zhp, history_str) != 0); in zpool_do_destroy()
1541 zpool_close(zhp); in zpool_do_destroy()
1561 zpool_handle_t *zhp; in zpool_do_export() local
1592 if ((zhp = zpool_open_canfail(g_zfs, argv[i])) == NULL) { in zpool_do_export()
1597 if (zpool_disable_datasets(zhp, force) != 0) { in zpool_do_export()
1599 zpool_close(zhp); in zpool_do_export()
1607 if (zpool_export_force(zhp, history_str) != 0) in zpool_do_export()
1609 } else if (zpool_export(zhp, force, history_str) != 0) { in zpool_do_export()
1613 zpool_close(zhp); in zpool_do_export()
1624 max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max, in max_width() argument
1632 name = zpool_vdev_name(g_zfs, zhp, nv, name_flags | VDEV_NAME_TYPE_ID); in max_width()
1641 if ((ret = max_width(zhp, child[c], depth + 2, in max_width()
1649 if ((ret = max_width(zhp, child[c], depth + 2, in max_width()
1657 if ((ret = max_width(zhp, child[c], depth + 2, in max_width()
1692 find_spare(zpool_handle_t *zhp, void *data) in find_spare() argument
1697 config = zpool_get_config(zhp, NULL); in find_spare()
1702 cbp->cb_zhp = zhp; in find_spare()
1706 zpool_close(zhp); in find_spare()
1833 print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name, in print_status_config() argument
1939 zpool_get_name(zhp)) == 0) in print_status_config()
1987 root = fnvlist_lookup_nvlist(zpool_get_config(zhp, NULL), in print_status_config()
2024 vname = zpool_vdev_name(g_zfs, zhp, child[c], in print_status_config()
2027 print_status_config(zhp, cb, vname, child[c], depth + 2, in print_status_config()
2153 print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv, in print_class_vdevs() argument
2160 assert(zhp != NULL || !cb->cb_verbose); in print_class_vdevs()
2193 char *name = zpool_vdev_name(g_zfs, zhp, child[c], in print_class_vdevs()
2196 print_status_config(zhp, cb, name, child[c], 2, in print_class_vdevs()
2556 zpool_handle_t *zhp; in do_import() local
2633 if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL) in do_import()
2646 if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && in do_import()
2648 zpool_enable_datasets(zhp, mntopts, 0) != 0) { in do_import()
2649 zpool_close(zhp); in do_import()
2653 zpool_close(zhp); in do_import()
2663 name_or_guid_exists(zpool_handle_t *zhp, void *data) in name_or_guid_exists() argument
2666 nvlist_t *config = zpool_get_config(zhp, NULL); in name_or_guid_exists()
2687 zpool_close(zhp); in name_or_guid_exists()
2706 zpool_handle_t *zhp; in zpool_do_checkpoint() local
2742 if ((zhp = zpool_open(g_zfs, pool)) == NULL) { in zpool_do_checkpoint()
2753 err = (zpool_discard_checkpoint(zhp) != 0); in zpool_do_checkpoint()
2755 err = (zpool_checkpoint(zhp) != 0); in zpool_do_checkpoint()
2757 zpool_close(zhp); in zpool_do_checkpoint()
3981 print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, in print_vdev_stats() argument
4117 vname = zpool_vdev_name(g_zfs, zhp, newchild[c], in print_vdev_stats()
4119 ret += print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, in print_vdev_stats()
4160 vname = zpool_vdev_name(g_zfs, zhp, newchild[c], in print_vdev_stats()
4162 ret += print_vdev_stats(zhp, vname, oldnv ? in print_vdev_stats()
4192 vname = zpool_vdev_name(g_zfs, zhp, newchild[c], in print_vdev_stats()
4194 ret += print_vdev_stats(zhp, vname, oldnv ? oldchild[c] in print_vdev_stats()
4204 refresh_iostat(zpool_handle_t *zhp, void *data) in refresh_iostat() argument
4212 if (zpool_refresh_stats(zhp, &missing) != 0) in refresh_iostat()
4216 pool_list_remove(cb->cb_list, zhp); in refresh_iostat()
4225 print_iostat(zpool_handle_t *zhp, void *data) in print_iostat() argument
4232 newconfig = zpool_get_config(zhp, &oldconfig); in print_iostat()
4246 ret = print_vdev_stats(zhp, zpool_get_name(zhp), oldnvroot, newnvroot, in print_iostat()
4280 get_namewidth(zpool_handle_t *zhp, int min_width, int flags, boolean_t verbose) in get_namewidth() argument
4285 if ((config = zpool_get_config(zhp, NULL)) != NULL) { in get_namewidth()
4288 unsigned int poolname_len = strlen(zpool_get_name(zhp)); in get_namewidth()
4293 max_width(zhp, nvroot, 0, min_width, flags)); in get_namewidth()
4390 get_stat_flags_cb(zpool_handle_t *zhp, void *data) in get_stat_flags_cb() argument
4397 config = zpool_get_config(zhp, NULL); in get_stat_flags_cb()
4456 is_vdev_cb(zpool_handle_t *zhp, nvlist_t *nv, void *cb_data) in is_vdev_cb() argument
4461 name = zpool_vdev_name(g_zfs, zhp, nv, cb->cb_name_flags); in is_vdev_cb()
4473 is_vdev(zpool_handle_t *zhp, void *cb_data) in is_vdev() argument
4475 return (for_each_vdev(zhp, is_vdev_cb, cb_data)); in is_vdev()
4521 is_pool_cb(zpool_handle_t *zhp, void *data) in is_pool_cb() argument
4524 if (strcmp(name, zpool_get_name(zhp)) == 0) in is_pool_cb()
4636 get_namewidth_iostat(zpool_handle_t *zhp, void *data) in get_namewidth_iostat() argument
4641 width = get_namewidth(zhp, cb->cb_namewidth, cb->cb_name_flags, in get_namewidth_iostat()
5086 print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) in print_pool() argument
5117 if (zpool_get_prop(zhp, pl->pl_prop, property, in print_pool()
5126 zpool_prop_get_feature(zhp, pl->pl_user_prop, property, in print_pool()
5210 print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, in print_list_stats() argument
5304 vname = zpool_vdev_name(g_zfs, zhp, child[c], in print_list_stats()
5306 print_list_stats(zhp, vname, child[c], cb, depth + 1, B_FALSE); in print_list_stats()
5337 vname = zpool_vdev_name(g_zfs, zhp, child[c], in print_list_stats()
5339 print_list_stats(zhp, vname, child[c], cb, depth + 2, in print_list_stats()
5349 vname = zpool_vdev_name(g_zfs, zhp, child[c], in print_list_stats()
5351 print_list_stats(zhp, vname, child[c], cb, depth + 2, in print_list_stats()
5361 vname = zpool_vdev_name(g_zfs, zhp, child[c], in print_list_stats()
5363 print_list_stats(zhp, vname, child[c], cb, depth + 2, in print_list_stats()
5374 list_callback(zpool_handle_t *zhp, void *data) in list_callback() argument
5378 print_pool(zhp, cbp); in list_callback()
5383 config = zpool_get_config(zhp, NULL); in list_callback()
5386 print_list_stats(zhp, NULL, nvroot, cbp, 0, B_FALSE); in list_callback()
5397 get_namewidth_list(zpool_handle_t *zhp, void *data) in get_namewidth_list() argument
5402 width = get_namewidth(zhp, cb->cb_namewidth, cb->cb_name_flags, in get_namewidth_list()
5540 zpool_handle_t *zhp; in zpool_do_attach_or_replace() local
5612 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_attach_or_replace()
5615 if (zpool_get_config(zhp, NULL) == NULL) { in zpool_do_attach_or_replace()
5618 zpool_close(zhp); in zpool_do_attach_or_replace()
5622 if (zpool_is_bootable(zhp)) in zpool_do_attach_or_replace()
5627 boot_size = zpool_get_prop_int(zhp, ZPOOL_PROP_BOOTSIZE, NULL); in zpool_do_attach_or_replace()
5635 intval = zpool_get_prop_int(zhp, ZPOOL_PROP_ASHIFT, &src); in zpool_do_attach_or_replace()
5643 nvroot = make_root_vdev(zhp, props, force, B_FALSE, replacing, B_FALSE, in zpool_do_attach_or_replace()
5646 zpool_close(zhp); in zpool_do_attach_or_replace()
5650 ret = zpool_vdev_attach(zhp, old_disk, new_disk, nvroot, replacing); in zpool_do_attach_or_replace()
5653 zpool_close(zhp); in zpool_do_attach_or_replace()
5705 zpool_handle_t *zhp; in zpool_do_detach() local
5737 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_detach()
5740 ret = zpool_vdev_detach(zhp, path); in zpool_do_detach()
5742 zpool_close(zhp); in zpool_do_detach()
5778 zpool_handle_t *zhp; in zpool_do_split() local
5868 if ((zhp = zpool_open(g_zfs, srcpool)) == NULL) in zpool_do_split()
5871 config = split_mirror_vdev(zhp, newpool, props, flags, argc, argv); in zpool_do_split()
5884 zpool_close(zhp); in zpool_do_split()
5893 if ((zhp = zpool_open_canfail(g_zfs, newpool)) == NULL) in zpool_do_split()
5902 if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && in zpool_do_split()
5903 zpool_enable_datasets(zhp, mntopts, 0) != 0) { in zpool_do_split()
5910 zpool_close(zhp); in zpool_do_split()
5925 zpool_handle_t *zhp; in zpool_do_online() local
5959 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_online()
5963 if (zpool_vdev_online(zhp, argv[i], flags, &newstate) == 0) { in zpool_do_online()
5982 zpool_close(zhp); in zpool_do_online()
6003 zpool_handle_t *zhp; in zpool_do_offline() local
6036 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_offline()
6040 if (zpool_vdev_offline(zhp, argv[i], istmp) != 0) in zpool_do_offline()
6044 zpool_close(zhp); in zpool_do_offline()
6064 zpool_handle_t *zhp; in zpool_do_clear() local
6121 if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) { in zpool_do_clear()
6126 if (zpool_clear(zhp, device, policy) != 0) in zpool_do_clear()
6129 zpool_close(zhp); in zpool_do_clear()
6144 zpool_handle_t *zhp; in zpool_do_reguid() local
6172 if ((zhp = zpool_open(g_zfs, poolname)) == NULL) in zpool_do_reguid()
6175 ret = zpool_reguid(zhp); in zpool_do_reguid()
6177 zpool_close(zhp); in zpool_do_reguid()
6192 zpool_handle_t *zhp; in zpool_do_reopen() local
6219 if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) in zpool_do_reopen()
6222 ret = zpool_reopen(zhp); in zpool_do_reopen()
6223 zpool_close(zhp); in zpool_do_reopen()
6235 zpool_has_checkpoint(zpool_handle_t *zhp) in zpool_has_checkpoint() argument
6239 config = zpool_get_config(zhp, NULL); in zpool_has_checkpoint()
6261 scrub_callback(zpool_handle_t *zhp, void *data) in scrub_callback() argument
6269 if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { in scrub_callback()
6271 "currently unavailable\n"), zpool_get_name(zhp)); in scrub_callback()
6275 err = zpool_scan(zhp, cb->cb_type, cb->cb_scrub_cmd); in scrub_callback()
6277 if (err == 0 && zpool_has_checkpoint(zhp) && in scrub_callback()
6281 zpool_get_name(zhp)); in scrub_callback()
6465 zpool_handle_t *zhp = zpool_open(g_zfs, poolname); in zpool_do_trim() local
6466 if (zhp == NULL) in zpool_do_trim()
6477 nvlist_t *config = zpool_get_config(zhp, NULL); in zpool_do_trim()
6480 zpool_collect_leaves(zhp, nvroot, vdevs); in zpool_do_trim()
6489 int error = zpool_trim(zhp, cmd_type, vdevs, &trim_flags); in zpool_do_trim()
6492 zpool_close(zhp); in zpool_do_trim()
6510 zpool_handle_t *zhp; in zpool_do_initialize() local
6564 zhp = zpool_open(g_zfs, poolname); in zpool_do_initialize()
6565 if (zhp == NULL) in zpool_do_initialize()
6571 nvlist_t *config = zpool_get_config(zhp, NULL); in zpool_do_initialize()
6574 zpool_collect_leaves(zhp, nvroot, vdevs); in zpool_do_initialize()
6581 err = zpool_initialize(zhp, cmd_type, vdevs); in zpool_do_initialize()
6584 zpool_close(zhp); in zpool_do_initialize()
6780 print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) in print_removal_status() argument
6795 config = zpool_get_config(zhp, NULL); in print_removal_status()
6801 vdev_name = zpool_vdev_name(g_zfs, zhp, in print_removal_status()
6915 print_error_log(zpool_handle_t *zhp) in print_error_log() argument
6922 if (zpool_get_errlog(zhp, &nverrlist) != 0) { in print_error_log()
6942 zpool_obj_to_path(zhp, dsobj, obj, pathname, len); in print_error_log()
6950 print_spares(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t **spares, in print_spares() argument
6962 name = zpool_vdev_name(g_zfs, zhp, spares[i], in print_spares()
6964 print_status_config(zhp, cb, name, spares[i], 2, B_TRUE); in print_spares()
6970 print_l2cache(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t **l2cache, in print_l2cache() argument
6982 name = zpool_vdev_name(g_zfs, zhp, l2cache[i], in print_l2cache()
6984 print_status_config(zhp, cb, name, l2cache[i], 2, B_FALSE); in print_l2cache()
7044 status_callback(zpool_handle_t *zhp, void *data) in status_callback() argument
7055 config = zpool_get_config(zhp, NULL); in status_callback()
7056 reason = zpool_get_status(zhp, &msgid, &errata); in status_callback()
7070 zpool_get_name(zhp)); in status_callback()
7087 (void) printf(gettext(" pool: %s\n"), zpool_get_name(zhp)); in status_callback()
7121 zpool_explain_recover(zpool_get_handle(zhp), in status_callback()
7122 zpool_get_name(zhp), reason, config); in status_callback()
7176 zpool_explain_recover(zpool_get_handle(zhp), in status_callback()
7177 zpool_get_name(zhp), reason, config); in status_callback()
7356 print_removal_status(zhp, prs); in status_callback()
7359 cbp->cb_namewidth = max_width(zhp, nvroot, 0, 0, in status_callback()
7372 print_status_config(zhp, cbp, zpool_get_name(zhp), nvroot, 0, in status_callback()
7375 print_class_vdevs(zhp, cbp, nvroot, VDEV_ALLOC_BIAS_DEDUP); in status_callback()
7376 print_class_vdevs(zhp, cbp, nvroot, VDEV_ALLOC_BIAS_SPECIAL); in status_callback()
7377 print_class_vdevs(zhp, cbp, nvroot, VDEV_ALLOC_CLASS_LOGS); in status_callback()
7381 print_l2cache(zhp, cbp, l2cache, nl2cache); in status_callback()
7385 print_spares(zhp, cbp, spares, nspares); in status_callback()
7397 zpool_get_errlog(zhp, &nverrlist) == 0) { in status_callback()
7419 print_error_log(zhp); in status_callback()
7547 upgrade_version(zpool_handle_t *zhp, uint64_t version) in upgrade_version() argument
7553 config = zpool_get_config(zhp, NULL); in upgrade_version()
7560 ret = zpool_upgrade(zhp, version); in upgrade_version()
7567 zpool_get_name(zhp), oldversion); in upgrade_version()
7571 zpool_get_name(zhp), oldversion, version); in upgrade_version()
7578 upgrade_enable_all(zpool_handle_t *zhp, int *countp) in upgrade_enable_all() argument
7582 nvlist_t *enabled = zpool_get_features(zhp); in upgrade_enable_all()
7591 ret = zpool_set_prop(zhp, propname, in upgrade_enable_all()
7602 zpool_get_name(zhp)); in upgrade_enable_all()
7616 upgrade_cb(zpool_handle_t *zhp, void *arg) in upgrade_cb() argument
7624 config = zpool_get_config(zhp, NULL); in upgrade_cb()
7632 ret = upgrade_version(zhp, cbp->cb_version); in upgrade_cb()
7649 ret = upgrade_enable_all(zhp, &count); in upgrade_cb()
7667 upgrade_list_older_cb(zpool_handle_t *zhp, void *arg) in upgrade_list_older_cb() argument
7673 config = zpool_get_config(zhp, NULL); in upgrade_list_older_cb()
7693 zpool_get_name(zhp)); in upgrade_list_older_cb()
7700 upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) in upgrade_list_disabled_cb() argument
7706 config = zpool_get_config(zhp, NULL); in upgrade_list_disabled_cb()
7713 nvlist_t *enabled = zpool_get_features(zhp); in upgrade_list_disabled_cb()
7738 zpool_get_name(zhp)); in upgrade_list_disabled_cb()
7752 upgrade_one(zpool_handle_t *zhp, void *data) in upgrade_one() argument
7759 if (strcmp("log", zpool_get_name(zhp)) == 0) { in upgrade_one()
7766 cur_version = zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL); in upgrade_one()
7770 zpool_get_name(zhp), cur_version); in upgrade_one()
7776 "using version %llu.\n\n"), zpool_get_name(zhp), in upgrade_one()
7783 ret = upgrade_version(zhp, cbp->cb_version); in upgrade_one()
7790 ret = upgrade_enable_all(zhp, &count); in upgrade_one()
7799 zpool_get_name(zhp)); in upgrade_one()
8116 get_history_one(zpool_handle_t *zhp, void *data) in get_history_one() argument
8126 (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); in get_history_one()
8129 if ((ret = zpool_get_history(zhp, &nvhis, &off, &eof)) != 0) in get_history_one()
8183 get_callback(zpool_handle_t *zhp, void *data) in get_callback() argument
8205 if (zpool_prop_get_feature(zhp, pl->pl_user_prop, in get_callback()
8207 zprop_print_one_property(zpool_get_name(zhp), in get_callback()
8212 if (zpool_get_prop(zhp, pl->pl_prop, value, in get_callback()
8216 zprop_print_one_property(zpool_get_name(zhp), cbp, in get_callback()
8365 set_callback(zpool_handle_t *zhp, void *data) in set_callback() argument
8370 error = zpool_set_prop(zhp, cb->cb_propname, cb->cb_value); in set_callback()