libzfs_dataset.c (224525) | libzfs_dataset.c (226676) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 3475 unchanged lines hidden (view full) --- 3484{ 3485 int ret; 3486 zfs_cmd_t zc = { 0 }; 3487 char *delim; 3488 prop_changelist_t *cl = NULL; 3489 zfs_handle_t *zhrp = NULL; 3490 char *parentname = NULL; 3491 char parent[ZFS_MAXNAMELEN]; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 3475 unchanged lines hidden (view full) --- 3484{ 3485 int ret; 3486 zfs_cmd_t zc = { 0 }; 3487 char *delim; 3488 prop_changelist_t *cl = NULL; 3489 zfs_handle_t *zhrp = NULL; 3490 char *parentname = NULL; 3491 char parent[ZFS_MAXNAMELEN]; |
3492 char property[ZFS_MAXPROPLEN]; |
|
3492 libzfs_handle_t *hdl = zhp->zfs_hdl; 3493 char errbuf[1024]; 3494 3495 /* if we have the same exact name, just return success */ 3496 if (strcmp(zhp->zfs_name, target) == 0) 3497 return (0); 3498 3499 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, --- 87 unchanged lines hidden (view full) --- 3587 *delim = '\0'; 3588 zhrp = zfs_open(zhp->zfs_hdl, parentname, ZFS_TYPE_DATASET); 3589 if (zhrp == NULL) { 3590 ret = -1; 3591 goto error; 3592 } 3593 3594 } else { | 3493 libzfs_handle_t *hdl = zhp->zfs_hdl; 3494 char errbuf[1024]; 3495 3496 /* if we have the same exact name, just return success */ 3497 if (strcmp(zhp->zfs_name, target) == 0) 3498 return (0); 3499 3500 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, --- 87 unchanged lines hidden (view full) --- 3588 *delim = '\0'; 3589 zhrp = zfs_open(zhp->zfs_hdl, parentname, ZFS_TYPE_DATASET); 3590 if (zhrp == NULL) { 3591 ret = -1; 3592 goto error; 3593 } 3594 3595 } else { |
3595 if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0)) == NULL) | 3596 if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 3597 CL_GATHER_KEEP_LEGACY, 0)) == NULL) { |
3596 return (-1); | 3598 return (-1); |
3599 } |
|
3597 3598 if (changelist_haszonedchild(cl)) { 3599 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 3600 "child dataset with inherited mountpoint is used " 3601 "in a non-global zone")); 3602 (void) zfs_error(hdl, EZFS_ZONED, errbuf); 3603 goto error; 3604 } --- 5 unchanged lines hidden (view full) --- 3610 if (ZFS_IS_VOLUME(zhp)) 3611 zc.zc_objset_type = DMU_OST_ZVOL; 3612 else 3613 zc.zc_objset_type = DMU_OST_ZFS; 3614 3615 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); 3616 (void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value)); 3617 | 3600 3601 if (changelist_haszonedchild(cl)) { 3602 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, 3603 "child dataset with inherited mountpoint is used " 3604 "in a non-global zone")); 3605 (void) zfs_error(hdl, EZFS_ZONED, errbuf); 3606 goto error; 3607 } --- 5 unchanged lines hidden (view full) --- 3613 if (ZFS_IS_VOLUME(zhp)) 3614 zc.zc_objset_type = DMU_OST_ZVOL; 3615 else 3616 zc.zc_objset_type = DMU_OST_ZFS; 3617 3618 (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); 3619 (void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value)); 3620 |
3618 zc.zc_cookie = recursive; | 3621 zc.zc_cookie = recursive ? 1 : 0; 3622 if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, property, sizeof (property), 3623 NULL, NULL, 0, B_FALSE) == 0 && 3624 (strcmp(property, "legacy") == 0 || 3625 strcmp(property, "none") == 0)) { 3626 zc.zc_cookie |= 2; 3627 } |
3619 3620 if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) { 3621 /* 3622 * if it was recursive, the one that actually failed will 3623 * be in zc.zc_name 3624 */ 3625 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, 3626 "cannot rename '%s'"), zc.zc_name); --- 698 unchanged lines hidden --- | 3628 3629 if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) { 3630 /* 3631 * if it was recursive, the one that actually failed will 3632 * be in zc.zc_name 3633 */ 3634 (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, 3635 "cannot rename '%s'"), zc.zc_name); --- 698 unchanged lines hidden --- |