3398 }
3399 for (nvpair_t *pair = nvlist_next_nvpair(errlist, NULL);
3400 pair != NULL; pair = nvlist_next_nvpair(errlist, pair)) {
3401 char errbuf[1024];
3402 (void) snprintf(errbuf, sizeof (errbuf),
3403 dgettext(TEXT_DOMAIN, "cannot destroy snapshot %s"),
3404 nvpair_name(pair));
3405
3406 switch (fnvpair_value_int32(pair)) {
3407 case EEXIST:
3408 zfs_error_aux(hdl,
3409 dgettext(TEXT_DOMAIN, "snapshot is cloned"));
3410 ret = zfs_error(hdl, EZFS_EXISTS, errbuf);
3411 break;
3412 default:
3413 ret = zfs_standard_error(hdl, errno, errbuf);
3414 break;
3415 }
3416 }
3417
3418 return (ret);
3419 }
3420
3421 /*
3422 * Clones the given dataset. The target must be of the same type as the source.
3423 */
3424 int
3425 zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
3426 {
3427 char parent[ZFS_MAXNAMELEN];
3428 int ret;
3429 char errbuf[1024];
3430 libzfs_handle_t *hdl = zhp->zfs_hdl;
3431 uint64_t zoned;
3432
3433 assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
3434
3435 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
3436 "cannot create '%s'"), target);
3437
|
3398 }
3399 for (nvpair_t *pair = nvlist_next_nvpair(errlist, NULL);
3400 pair != NULL; pair = nvlist_next_nvpair(errlist, pair)) {
3401 char errbuf[1024];
3402 (void) snprintf(errbuf, sizeof (errbuf),
3403 dgettext(TEXT_DOMAIN, "cannot destroy snapshot %s"),
3404 nvpair_name(pair));
3405
3406 switch (fnvpair_value_int32(pair)) {
3407 case EEXIST:
3408 zfs_error_aux(hdl,
3409 dgettext(TEXT_DOMAIN, "snapshot is cloned"));
3410 ret = zfs_error(hdl, EZFS_EXISTS, errbuf);
3411 break;
3412 default:
3413 ret = zfs_standard_error(hdl, errno, errbuf);
3414 break;
3415 }
3416 }
3417
3418 nvlist_free(errlist);
3419 return (ret);
3420 }
3421
3422 /*
3423 * Clones the given dataset. The target must be of the same type as the source.
3424 */
3425 int
3426 zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
3427 {
3428 char parent[ZFS_MAXNAMELEN];
3429 int ret;
3430 char errbuf[1024];
3431 libzfs_handle_t *hdl = zhp->zfs_hdl;
3432 uint64_t zoned;
3433
3434 assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT);
3435
3436 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
3437 "cannot create '%s'"), target);
3438
|