Lines Matching defs:zhp

68 zpool_get_all_props(zpool_handle_t *zhp)
71 libzfs_handle_t *hdl = zhp->zpool_hdl;
73 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
90 if (zcmd_read_dst_nvlist(hdl, &zc, &zhp->zpool_props) != 0) {
101 zpool_props_refresh(zpool_handle_t *zhp)
105 old_props = zhp->zpool_props;
107 if (zpool_get_all_props(zhp) != 0)
115 zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop,
123 nvl = zhp->zpool_props;
141 zpool_get_prop_int(zpool_handle_t *zhp, zpool_prop_t prop, zprop_source_t *src)
147 if (zhp->zpool_props == NULL && zpool_get_all_props(zhp)) {
151 * vdev's guid then get it from the zhp config nvlist.
154 (nvlist_lookup_nvlist(zhp->zpool_config,
163 nvl = zhp->zpool_props;
214 zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
224 if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) {
227 (void) strlcpy(buf, zpool_get_name(zhp), len);
235 intval = zpool_get_prop_int(zhp, prop, &src);
242 if (zhp->zpool_props != NULL ||
243 zpool_get_all_props(zhp) == 0) {
245 zpool_get_prop_string(zhp, prop, &src),
260 if (zhp->zpool_props == NULL && zpool_get_all_props(zhp) &&
266 (void) strlcpy(buf, zpool_get_prop_string(zhp, prop, &src),
271 intval = zpool_get_prop_int(zhp, prop, &src);
319 verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
340 intval = zpool_get_prop_int(zhp, prop, &src);
377 zpool_is_bootable(zpool_handle_t *zhp)
381 return (zpool_get_prop(zhp, ZPOOL_PROP_BOOTFS, bootfs,
403 zpool_handle_t *zhp;
516 if ((zhp = zpool_open_canfail(hdl, poolname)) == NULL) {
522 zpool_close(zhp);
624 zpool_set_prop(zpool_handle_t *zhp, const char *propname, const char *propval)
636 zhp->zpool_name);
639 return (no_memory(zhp->zpool_hdl));
643 return (no_memory(zhp->zpool_hdl));
646 version = zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL);
647 if ((realprops = zpool_valid_proplist(zhp->zpool_hdl,
648 zhp->zpool_name, nvl, version, flags, errbuf)) == NULL) {
659 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
661 if (zcmd_write_src_nvlist(zhp->zpool_hdl, &zc, nvl) != 0) {
666 ret = zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_POOL_SET_PROPS, &zc);
672 (void) zpool_standard_error(zhp->zpool_hdl, errno, errbuf);
674 (void) zpool_props_refresh(zhp);
680 zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp)
682 libzfs_handle_t *hdl = zhp->zpool_hdl;
697 features = zpool_get_features(zhp);
762 zpool_get_prop(zhp, entry->pl_prop, buf, sizeof (buf),
776 zpool_prop_get_feature(zpool_handle_t *zhp, const char *propname, char *buf,
781 nvlist_t *features = zpool_get_features(zhp);
935 zpool_handle_t *zhp;
948 if ((zhp = zfs_alloc(hdl, sizeof (zpool_handle_t))) == NULL)
951 zhp->zpool_hdl = hdl;
952 (void) strlcpy(zhp->zpool_name, pool, sizeof (zhp->zpool_name));
954 if (zpool_refresh_stats(zhp, &missing) != 0) {
955 zpool_close(zhp);
963 zpool_close(zhp);
967 return (zhp);
977 zpool_handle_t *zhp;
980 if ((zhp = zfs_alloc(hdl, sizeof (zpool_handle_t))) == NULL)
983 zhp->zpool_hdl = hdl;
984 (void) strlcpy(zhp->zpool_name, pool, sizeof (zhp->zpool_name));
986 if (zpool_refresh_stats(zhp, &missing) != 0) {
987 zpool_close(zhp);
992 zpool_close(zhp);
997 *ret = zhp;
1008 zpool_handle_t *zhp;
1010 if ((zhp = zpool_open_canfail(hdl, pool)) == NULL)
1013 if (zhp->zpool_state == POOL_STATE_UNAVAIL) {
1015 dgettext(TEXT_DOMAIN, "cannot open '%s'"), zhp->zpool_name);
1016 zpool_close(zhp);
1020 return (zhp);
1027 zpool_close(zpool_handle_t *zhp)
1029 nvlist_free(zhp->zpool_config);
1030 nvlist_free(zhp->zpool_old_config);
1031 nvlist_free(zhp->zpool_props);
1032 free(zhp);
1039 zpool_get_name(zpool_handle_t *zhp)
1041 return (zhp->zpool_name);
1049 zpool_get_state(zpool_handle_t *zhp)
1051 return (zhp->zpool_state);
1192 zpool_destroy(zpool_handle_t *zhp, const char *log_str)
1196 libzfs_handle_t *hdl = zhp->zpool_hdl;
1199 if (zhp->zpool_state == POOL_STATE_ACTIVE &&
1200 (zfp = zfs_open(hdl, zhp->zpool_name, ZFS_TYPE_FILESYSTEM)) == NULL)
1203 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
1208 "cannot destroy '%s'"), zhp->zpool_name);
1236 zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
1240 libzfs_handle_t *hdl = zhp->zpool_hdl;
1246 "cannot add to '%s'"), zhp->zpool_name);
1248 if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) <
1257 if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) <
1268 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
1341 zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce,
1348 "cannot export '%s'"), zhp->zpool_name);
1350 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
1355 if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_POOL_EXPORT, &zc) != 0) {
1358 zfs_error_aux(zhp->zpool_hdl, dgettext(TEXT_DOMAIN,
1362 zhp->zpool_name, zhp->zpool_name);
1363 return (zfs_error(zhp->zpool_hdl, EZFS_ACTIVE_SPARE,
1366 return (zpool_standard_error_fmt(zhp->zpool_hdl, errno,
1375 zpool_export(zpool_handle_t *zhp, boolean_t force, const char *log_str)
1377 return (zpool_export_common(zhp, force, B_FALSE, log_str));
1381 zpool_export_force(zpool_handle_t *zhp, const char *log_str)
1383 return (zpool_export_common(zhp, B_TRUE, B_TRUE, log_str));
1774 zpool_handle_t *zhp;
1779 if (zpool_open_silent(hdl, thename, &zhp) != 0)
1781 else if (zhp != NULL)
1782 zpool_close(zhp);
1799 zpool_scan(zpool_handle_t *zhp, pool_scan_func_t func)
1803 libzfs_handle_t *hdl = zhp->zpool_hdl;
1805 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
1828 verify(nvlist_lookup_nvlist(zhp->zpool_config,
2081 zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath,
2089 verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
2115 zpool_find_vdev(zpool_handle_t *zhp, const char *path, boolean_t *avail_spare,
2137 verify(nvlist_lookup_nvlist(zhp->zpool_config, ZPOOL_CONFIG_VDEV_TREE,
2292 zpool_get_physpath(zpool_handle_t *zhp, char *physpath, size_t phypath_size)
2294 return (zpool_get_config_physpath(zhp->zpool_config, physpath,
2342 zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
2349 libzfs_handle_t *hdl = zhp->zpool_hdl;
2359 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2360 if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache,
2370 zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) {
2415 zpool_vdev_offline(zpool_handle_t *zhp, const char *path, boolean_t istmp)
2421 libzfs_handle_t *hdl = zhp->zpool_hdl;
2426 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2427 if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache,
2465 zpool_vdev_fault(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
2469 libzfs_handle_t *hdl = zhp->zpool_hdl;
2474 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2500 zpool_vdev_degrade(zpool_handle_t *zhp, uint64_t guid, vdev_aux_t aux)
2504 libzfs_handle_t *hdl = zhp->zpool_hdl;
2509 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2553 zpool_vdev_attach(zpool_handle_t *zhp,
2566 libzfs_handle_t *hdl = zhp->zpool_hdl;
2567 boolean_t rootpool = zpool_is_bootable(zhp);
2576 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2577 if ((tgt = zpool_find_vdev(zhp, old_disk, &avail_spare, &l2cache,
2597 verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
2609 (zpool_find_vdev(zhp, newname, &avail_spare, &l2cache,
2646 uint64_t version = zpool_get_prop_int(zhp,
2718 zpool_vdev_detach(zpool_handle_t *zhp, const char *path)
2724 libzfs_handle_t *hdl = zhp->zpool_hdl;
2729 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
2730 if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache,
2782 find_vdev_entry(zpool_handle_t *zhp, nvlist_t **mchild, uint_t mchildren,
2789 char *mpath = zpool_vdev_name(zhp->zpool_hdl, zhp,
2793 char *spath = zpool_vdev_name(zhp->zpool_hdl, zhp,
2815 zpool_vdev_split(zpool_handle_t *zhp, char *newname, nvlist_t **newroot,
2823 libzfs_handle_t *hdl = zhp->zpool_hdl;
2829 dgettext(TEXT_DOMAIN, "Unable to split %s"), zhp->zpool_name);
2834 if ((config = zpool_get_config(zhp, NULL)) == NULL) {
2846 if ((zc_props = zpool_valid_proplist(hdl, zhp->zpool_name,
2914 (entry = find_vdev_entry(zhp, mchild, mchildren,
2979 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3024 zpool_vdev_remove(zpool_handle_t *zhp, const char *path)
3030 libzfs_handle_t *hdl = zhp->zpool_hdl;
3036 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3037 if ((tgt = zpool_find_vdev(zhp, path, &avail_spare, &l2cache,
3050 version = zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL);
3069 zpool_clear(zpool_handle_t *zhp, const char *path, nvlist_t *rewindnvl)
3076 libzfs_handle_t *hdl = zhp->zpool_hdl;
3087 zhp->zpool_name);
3089 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3091 if ((tgt = zpool_find_vdev(zhp, path, &avail_spare,
3109 if (zcmd_alloc_dst_nvlist(hdl, &zc, zhp->zpool_config_size * 2) != 0)
3145 zpool_vdev_clear(zpool_handle_t *zhp, uint64_t guid)
3149 libzfs_handle_t *hdl = zhp->zpool_hdl;
3155 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3169 zpool_reguid(zpool_handle_t *zhp)
3172 libzfs_handle_t *hdl = zhp->zpool_hdl;
3176 dgettext(TEXT_DOMAIN, "cannot reguid '%s'"), zhp->zpool_name);
3178 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3189 zpool_reopen(zpool_handle_t *zhp)
3193 libzfs_handle_t *hdl = zhp->zpool_hdl;
3197 zhp->zpool_name);
3199 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3271 set_path(zpool_handle_t *zhp, nvlist_t *nv, const char *path)
3275 (void) strncpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3280 (void) ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_VDEV_SETPATH, &zc);
3295 * If 'zhp' is NULL, then this is an exported pool, and we don't need to do any
3299 zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv,
3326 zhp != NULL &&
3341 set_path(zhp, nv, newpath);
3422 zpool_get_errlog(zpool_handle_t *zhp, nvlist_t **nverrlistp)
3434 verify(nvlist_lookup_uint64(zhp->zpool_config, ZPOOL_CONFIG_ERRCOUNT,
3438 if ((zc.zc_nvlist_dst = (uintptr_t)zfs_alloc(zhp->zpool_hdl,
3442 (void) strcpy(zc.zc_name, zhp->zpool_name);
3444 if (ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_ERROR_LOG,
3451 dst = zfs_alloc(zhp->zpool_hdl, count *
3514 return (no_memory(zhp->zpool_hdl));
3521 zpool_upgrade(zpool_handle_t *zhp, uint64_t new_version)
3524 libzfs_handle_t *hdl = zhp->zpool_hdl;
3526 (void) strcpy(zc.zc_name, zhp->zpool_name);
3532 zhp->zpool_name));
3573 get_history(zpool_handle_t *zhp, char *buf, uint64_t *off, uint64_t *len)
3576 libzfs_handle_t *hdl = zhp->zpool_hdl;
3578 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3590 zhp->zpool_name));
3594 "'%s'"), zhp->zpool_name));
3598 "'%s', pool must be upgraded"), zhp->zpool_name));
3602 "cannot get history for '%s'"), zhp->zpool_name));
3657 zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp)
3673 if ((err = get_history(zhp, buf, &off, &bytes_read)) != 0)
3714 zpool_obj_to_path(zpool_handle_t *zhp, uint64_t dsobj, uint64_t obj,
3729 (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
3731 if (ioctl(zhp->zpool_hdl->libzfs_fd,
3741 mounted = is_mounted(zhp->zpool_hdl, dsname, &mntpnt);
3746 if (ioctl(zhp->zpool_hdl->libzfs_fd, ZFS_IOC_OBJ_TO_PATH,
3831 zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name)
3845 if (zhp) {
3848 verify(nvlist_lookup_nvlist(zhp->zpool_config,
3851 if (zhp->zpool_start_block == 0)
3854 start_block = zhp->zpool_start_block;
3855 zhp->zpool_start_block = start_block;
3970 zpool_handle_t *zhp = NULL;
4010 if ((zhp = zpool_open(hdl, poolname)) == NULL) {
4016 config = zpool_get_config(zhp, NULL);
4034 if (zhp)
4035 zpool_close(zhp);