Lines Matching full:hdl

75 libzfs_errno(libzfs_handle_t *hdl)  in libzfs_errno()  argument
77 return (hdl->libzfs_error); in libzfs_errno()
81 libzfs_error_action(libzfs_handle_t *hdl) in libzfs_error_action() argument
83 return (hdl->libzfs_action); in libzfs_error_action()
87 libzfs_error_description(libzfs_handle_t *hdl) in libzfs_error_description() argument
89 if (hdl->libzfs_desc[0] != '\0') in libzfs_error_description()
90 return (hdl->libzfs_desc); in libzfs_error_description()
92 switch (hdl->libzfs_error) { in libzfs_error_description()
330 assert(hdl->libzfs_error == 0); in libzfs_error_description()
336 zfs_error_aux(libzfs_handle_t *hdl, const char *fmt, ...) in zfs_error_aux() argument
342 (void) vsnprintf(hdl->libzfs_desc, sizeof (hdl->libzfs_desc), in zfs_error_aux()
344 hdl->libzfs_desc_active = 1; in zfs_error_aux()
350 zfs_verror(libzfs_handle_t *hdl, int error, const char *fmt, va_list ap) in zfs_verror() argument
352 (void) vsnprintf(hdl->libzfs_action, sizeof (hdl->libzfs_action), in zfs_verror()
354 hdl->libzfs_error = error; in zfs_verror()
356 if (hdl->libzfs_desc_active) in zfs_verror()
357 hdl->libzfs_desc_active = 0; in zfs_verror()
359 hdl->libzfs_desc[0] = '\0'; in zfs_verror()
361 if (hdl->libzfs_printerr) { in zfs_verror()
364 "error: %s: %s\n"), hdl->libzfs_action, in zfs_verror()
365 libzfs_error_description(hdl)); in zfs_verror()
369 (void) fprintf(stderr, "%s: %s\n", hdl->libzfs_action, in zfs_verror()
370 libzfs_error_description(hdl)); in zfs_verror()
377 zfs_error(libzfs_handle_t *hdl, int error, const char *msg) in zfs_error() argument
379 return (zfs_error_fmt(hdl, error, "%s", msg)); in zfs_error()
383 zfs_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...) in zfs_error_fmt() argument
389 zfs_verror(hdl, error, fmt, ap); in zfs_error_fmt()
397 zfs_common_error(libzfs_handle_t *hdl, int error, const char *fmt, in zfs_common_error() argument
403 zfs_verror(hdl, EZFS_PERM, fmt, ap); in zfs_common_error()
407 zfs_verror(hdl, EZFS_NODELEGATION, fmt, ap); in zfs_common_error()
411 zfs_verror(hdl, EZFS_IO, fmt, ap); in zfs_common_error()
415 zfs_verror(hdl, EZFS_FAULT, fmt, ap); in zfs_common_error()
419 zfs_verror(hdl, EZFS_INTR, fmt, ap); in zfs_common_error()
423 zfs_verror(hdl, EZFS_CKSUM, fmt, ap); in zfs_common_error()
431 zfs_standard_error(libzfs_handle_t *hdl, int error, const char *msg) in zfs_standard_error() argument
433 return (zfs_standard_error_fmt(hdl, error, "%s", msg)); in zfs_standard_error()
437 zfs_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...) in zfs_standard_error_fmt() argument
443 if (zfs_common_error(hdl, error, fmt, ap) != 0) { in zfs_standard_error_fmt()
452 zfs_verror(hdl, EZFS_IO, fmt, ap); in zfs_standard_error_fmt()
456 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_standard_error_fmt()
458 zfs_verror(hdl, EZFS_NOENT, fmt, ap); in zfs_standard_error_fmt()
463 zfs_verror(hdl, EZFS_NOSPC, fmt, ap); in zfs_standard_error_fmt()
467 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_standard_error_fmt()
469 zfs_verror(hdl, EZFS_EXISTS, fmt, ap); in zfs_standard_error_fmt()
473 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_standard_error_fmt()
475 zfs_verror(hdl, EZFS_BUSY, fmt, ap); in zfs_standard_error_fmt()
478 zfs_verror(hdl, EZFS_POOLREADONLY, fmt, ap); in zfs_standard_error_fmt()
481 zfs_verror(hdl, EZFS_NAMETOOLONG, fmt, ap); in zfs_standard_error_fmt()
484 zfs_verror(hdl, EZFS_BADVERSION, fmt, ap); in zfs_standard_error_fmt()
487 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_standard_error_fmt()
489 zfs_verror(hdl, EZFS_POOLUNAVAIL, fmt, ap); in zfs_standard_error_fmt()
492 zfs_verror(hdl, EZFS_ACTIVE_POOL, fmt, ap); in zfs_standard_error_fmt()
496 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "the loaded zfs " in zfs_standard_error_fmt()
499 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zfs_standard_error_fmt()
502 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "the loaded zfs " in zfs_standard_error_fmt()
505 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zfs_standard_error_fmt()
509 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zfs_standard_error_fmt()
512 zfs_verror(hdl, EZFS_WRONG_PARENT, fmt, ap); in zfs_standard_error_fmt()
515 zfs_verror(hdl, EZFS_BADPROP, fmt, ap); in zfs_standard_error_fmt()
518 zfs_verror(hdl, EZFS_NOT_USER_NAMESPACE, fmt, ap); in zfs_standard_error_fmt()
521 zfs_error_aux(hdl, "%s", zfs_strerror(error)); in zfs_standard_error_fmt()
522 zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap); in zfs_standard_error_fmt()
531 zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err, in zfs_setprop_error() argument
545 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
548 (void) zfs_error(hdl, EZFS_PROPSPACE, errbuf); in zfs_setprop_error()
553 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
555 (void) zfs_error(hdl, EZFS_PROPSPACE, errbuf); in zfs_setprop_error()
559 (void) zfs_standard_error(hdl, err, errbuf); in zfs_setprop_error()
565 (void) zfs_standard_error(hdl, EBUSY, errbuf); in zfs_setprop_error()
569 (void) zfs_error(hdl, EZFS_DSREADONLY, errbuf); in zfs_setprop_error()
573 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
575 (void) zfs_error(hdl, EZFS_BADPROP, errbuf); in zfs_setprop_error()
579 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
582 (void) zfs_error(hdl, EZFS_BADVERSION, errbuf); in zfs_setprop_error()
589 (void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
592 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf); in zfs_setprop_error()
595 (void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
598 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf); in zfs_setprop_error()
600 (void) zfs_standard_error(hdl, err, errbuf); in zfs_setprop_error()
606 (void) zfs_error(hdl, EZFS_BADPROP, errbuf); in zfs_setprop_error()
608 (void) zfs_standard_error(hdl, err, errbuf); in zfs_setprop_error()
613 (void) zfs_error(hdl, EZFS_BADPROP, errbuf); in zfs_setprop_error()
618 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_setprop_error()
620 (void) zfs_error(hdl, EZFS_BADPROP, errbuf); in zfs_setprop_error()
622 (void) zfs_standard_error(hdl, err, errbuf); in zfs_setprop_error()
632 (void) zfs_error(hdl, EZFS_VOLTOOBIG, errbuf); in zfs_setprop_error()
638 (void) zfs_standard_error(hdl, err, errbuf); in zfs_setprop_error()
643 zpool_standard_error(libzfs_handle_t *hdl, int error, const char *msg) in zpool_standard_error() argument
645 return (zpool_standard_error_fmt(hdl, error, "%s", msg)); in zpool_standard_error()
649 zpool_standard_error_fmt(libzfs_handle_t *hdl, int error, const char *fmt, ...) in zpool_standard_error_fmt() argument
655 if (zfs_common_error(hdl, error, fmt, ap) != 0) { in zpool_standard_error_fmt()
662 zfs_verror(hdl, EZFS_NODEVICE, fmt, ap); in zpool_standard_error_fmt()
666 zfs_error_aux(hdl, in zpool_standard_error_fmt()
668 zfs_verror(hdl, EZFS_NOENT, fmt, ap); in zpool_standard_error_fmt()
672 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zpool_standard_error_fmt()
674 zfs_verror(hdl, EZFS_EXISTS, fmt, ap); in zpool_standard_error_fmt()
678 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "pool is busy")); in zpool_standard_error_fmt()
679 zfs_verror(hdl, EZFS_BUSY, fmt, ap); in zpool_standard_error_fmt()
684 zfs_verror(hdl, EZFS_NO_PENDING, fmt, ap); in zpool_standard_error_fmt()
688 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zpool_standard_error_fmt()
690 zfs_verror(hdl, EZFS_BADDEV, fmt, ap); in zpool_standard_error_fmt()
694 zfs_verror(hdl, EZFS_DEVOVERFLOW, fmt, ap); in zpool_standard_error_fmt()
698 zfs_verror(hdl, EZFS_POOL_NOTSUP, fmt, ap); in zpool_standard_error_fmt()
702 zfs_verror(hdl, EZFS_POOL_INVALARG, fmt, ap); in zpool_standard_error_fmt()
707 zfs_verror(hdl, EZFS_NOSPC, fmt, ap); in zpool_standard_error_fmt()
711 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zpool_standard_error_fmt()
713 zfs_verror(hdl, EZFS_POOLUNAVAIL, fmt, ap); in zpool_standard_error_fmt()
717 zfs_verror(hdl, EZFS_POOLREADONLY, fmt, ap); in zpool_standard_error_fmt()
720 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zpool_standard_error_fmt()
722 zfs_verror(hdl, EZFS_BADPROP, fmt, ap); in zpool_standard_error_fmt()
725 zfs_verror(hdl, EZFS_ACTIVE_POOL, fmt, ap); in zpool_standard_error_fmt()
728 zfs_verror(hdl, EZFS_CHECKPOINT_EXISTS, fmt, ap); in zpool_standard_error_fmt()
731 zfs_verror(hdl, EZFS_DISCARDING_CHECKPOINT, fmt, ap); in zpool_standard_error_fmt()
734 zfs_verror(hdl, EZFS_NO_CHECKPOINT, fmt, ap); in zpool_standard_error_fmt()
737 zfs_verror(hdl, EZFS_DEVRM_IN_PROGRESS, fmt, ap); in zpool_standard_error_fmt()
740 zfs_verror(hdl, EZFS_VDEV_TOO_BIG, fmt, ap); in zpool_standard_error_fmt()
743 zfs_verror(hdl, EZFS_EXPORT_IN_PROGRESS, fmt, ap); in zpool_standard_error_fmt()
746 zfs_verror(hdl, EZFS_RESILVERING, fmt, ap); in zpool_standard_error_fmt()
749 zfs_verror(hdl, EZFS_REBUILDING, fmt, ap); in zpool_standard_error_fmt()
752 zfs_verror(hdl, EZFS_BADPROP, fmt, ap); in zpool_standard_error_fmt()
755 zfs_verror(hdl, EZFS_VDEV_NOTSUP, fmt, ap); in zpool_standard_error_fmt()
758 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "the loaded zfs " in zpool_standard_error_fmt()
761 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zpool_standard_error_fmt()
764 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "the loaded zfs " in zpool_standard_error_fmt()
767 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zpool_standard_error_fmt()
771 zfs_verror(hdl, EZFS_IOC_NOTSUPPORTED, fmt, ap); in zpool_standard_error_fmt()
774 zfs_verror(hdl, EZFS_RAIDZ_EXPAND_IN_PROGRESS, fmt, ap); in zpool_standard_error_fmt()
777 zfs_verror(hdl, EZFS_ASHIFT_MISMATCH, fmt, ap); in zpool_standard_error_fmt()
780 zfs_error_aux(hdl, "%s", zfs_strerror(error)); in zpool_standard_error_fmt()
781 zfs_verror(hdl, EZFS_UNKNOWN, fmt, ap); in zpool_standard_error_fmt()
792 no_memory(libzfs_handle_t *hdl) in no_memory() argument
794 return (zfs_error(hdl, EZFS_NOMEM, "internal error")); in no_memory()
801 zfs_alloc(libzfs_handle_t *hdl, size_t size) in zfs_alloc() argument
806 (void) no_memory(hdl); in zfs_alloc()
815 zfs_asprintf(libzfs_handle_t *hdl, const char *fmt, ...) in zfs_asprintf() argument
828 (void) no_memory(hdl); in zfs_asprintf()
839 zfs_realloc(libzfs_handle_t *hdl, void *ptr, size_t oldsize, size_t newsize) in zfs_realloc() argument
844 (void) no_memory(hdl); in zfs_realloc()
856 zfs_strdup(libzfs_handle_t *hdl, const char *str) in zfs_strdup() argument
861 (void) no_memory(hdl); in zfs_strdup()
867 libzfs_print_on_error(libzfs_handle_t *hdl, boolean_t printerr) in libzfs_print_on_error() argument
869 hdl->libzfs_printerr = printerr; in libzfs_print_on_error()
1047 libzfs_handle_t *hdl; in libzfs_init() local
1056 if ((hdl = calloc(1, sizeof (libzfs_handle_t))) == NULL) { in libzfs_init()
1060 if (regcomp(&hdl->libzfs_urire, URI_REGEX, 0) != 0) { in libzfs_init()
1061 free(hdl); in libzfs_init()
1065 if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR|O_EXCL|O_CLOEXEC)) < 0) { in libzfs_init()
1066 free(hdl); in libzfs_init()
1071 (void) close(hdl->libzfs_fd); in libzfs_init()
1072 free(hdl); in libzfs_init()
1080 libzfs_mnttab_init(hdl); in libzfs_init()
1084 hdl->libzfs_prop_debug = B_TRUE; in libzfs_init()
1087 if ((error = zfs_nicestrtonum(hdl, env, in libzfs_init()
1088 &hdl->libzfs_max_nvlist))) { in libzfs_init()
1090 (void) close(hdl->libzfs_fd); in libzfs_init()
1091 free(hdl); in libzfs_init()
1095 hdl->libzfs_max_nvlist = (SPA_MAXBLOCKSIZE * 4); in libzfs_init()
1114 return (hdl); in libzfs_init()
1118 libzfs_fini(libzfs_handle_t *hdl) in libzfs_fini() argument
1120 (void) close(hdl->libzfs_fd); in libzfs_fini()
1121 zpool_free_handles(hdl); in libzfs_fini()
1122 namespace_clear(hdl); in libzfs_fini()
1123 libzfs_mnttab_fini(hdl); in libzfs_fini()
1125 regfree(&hdl->libzfs_urire); in libzfs_fini()
1128 if (hdl->libfetch != (void *)-1 && hdl->libfetch != NULL) in libzfs_fini()
1129 (void) dlclose(hdl->libfetch); in libzfs_fini()
1130 free(hdl->libfetch_load_error); in libzfs_fini()
1132 free(hdl); in libzfs_fini()
1160 zfs_path_to_zhandle(libzfs_handle_t *hdl, const char *path, zfs_type_t argtype) in zfs_path_to_zhandle() argument
1169 return (zfs_open(hdl, path, argtype)); in zfs_path_to_zhandle()
1181 return (zfs_open(hdl, entry.mnt_special, ZFS_TYPE_FILESYSTEM)); in zfs_path_to_zhandle()
1189 zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len) in zcmd_alloc_dst_nvlist() argument
1195 (uint64_t)(uintptr_t)zfs_alloc(hdl, zc->zc_nvlist_dst_size); in zcmd_alloc_dst_nvlist()
1204 zcmd_expand_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc) in zcmd_expand_dst_nvlist() argument
1208 (uint64_t)(uintptr_t)zfs_alloc(hdl, zc->zc_nvlist_dst_size); in zcmd_expand_dst_nvlist()
1226 zcmd_write_nvlist_com(libzfs_handle_t *hdl, uint64_t *outnv, uint64_t *outlen, in zcmd_write_nvlist_com() argument
1232 packed = zfs_alloc(hdl, len); in zcmd_write_nvlist_com()
1241 zcmd_write_conf_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl) in zcmd_write_conf_nvlist() argument
1243 zcmd_write_nvlist_com(hdl, &zc->zc_nvlist_conf, in zcmd_write_conf_nvlist()
1248 zcmd_write_src_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t *nvl) in zcmd_write_src_nvlist() argument
1250 zcmd_write_nvlist_com(hdl, &zc->zc_nvlist_src, in zcmd_write_src_nvlist()
1258 zcmd_read_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, nvlist_t **nvlp) in zcmd_read_dst_nvlist() argument
1262 return (no_memory(hdl)); in zcmd_read_dst_nvlist()
1620 str2shift(libzfs_handle_t *hdl, const char *buf) in str2shift() argument
1634 if (hdl) in str2shift()
1635 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in str2shift()
1651 if (hdl) in str2shift()
1652 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in str2shift()
1663 zfs_nicestrtonum(libzfs_handle_t *hdl, const char *value, uint64_t *num) in zfs_nicestrtonum() argument
1672 if (hdl) in zfs_nicestrtonum()
1673 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_nicestrtonum()
1687 if (hdl) in zfs_nicestrtonum()
1688 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_nicestrtonum()
1700 if ((shift = str2shift(hdl, end)) == -1) in zfs_nicestrtonum()
1711 if (hdl) in zfs_nicestrtonum()
1712 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_nicestrtonum()
1719 if ((shift = str2shift(hdl, end)) == -1) in zfs_nicestrtonum()
1724 if (hdl) in zfs_nicestrtonum()
1725 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zfs_nicestrtonum()
1748 zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop, in zprop_parse_value() argument
1780 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1786 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1791 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1804 } else if (zfs_nicestrtonum(hdl, value, ivalp) != 0) { in zprop_parse_value()
1810 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1820 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1830 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1868 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1880 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1891 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1899 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_parse_value()
1915 (void) no_memory(hdl); in zprop_parse_value()
1920 (void) no_memory(hdl); in zprop_parse_value()
1927 (void) zfs_error(hdl, EZFS_BADPROP, errbuf); in zprop_parse_value()
1932 addlist(libzfs_handle_t *hdl, const char *propname, zprop_list_t **listp, in addlist() argument
1950 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in addlist()
1952 return (zfs_error(hdl, EZFS_BADPROP, in addlist()
1956 zprop_list_t *entry = zfs_alloc(hdl, sizeof (*entry)); in addlist()
1960 entry->pl_user_prop = zfs_strdup(hdl, propname); in addlist()
1979 zprop_get_list(libzfs_handle_t *hdl, char *props, zprop_list_t **listp, in zprop_get_list() argument
1994 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, in zprop_get_list()
1996 return (zfs_error(hdl, EZFS_BADPROP, dgettext(TEXT_DOMAIN, in zprop_get_list()
2009 if (addlist(hdl, spaceprops[i], listp, type)) in zprop_get_list()
2014 if (addlist(hdl, p, listp, type)) in zprop_get_list()
2037 libzfs_handle_t *hdl; member
2047 entry = zfs_alloc(edp->hdl, sizeof (zprop_list_t)); in zprop_expand_list_cb()
2060 zprop_expand_list(libzfs_handle_t *hdl, zprop_list_t **plp, zfs_type_t type) in zprop_expand_list() argument
2075 exp.hdl = hdl; in zprop_expand_list()
2086 entry = zfs_alloc(hdl, sizeof (zprop_list_t)); in zprop_expand_list()
2435 zpool_prepare_and_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, in zpool_prepare_and_label_disk() argument
2449 rc = zpool_label_disk(hdl, zhp, name); in zpool_prepare_and_label_disk()