zfs_ioctl.c (224855) | zfs_ioctl.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 --- 3247 unchanged lines hidden (view full) --- 3256 * zc_value new name of dataset 3257 * zc_cookie recursive flag (only valid for snapshots) 3258 * 3259 * outputs: none 3260 */ 3261static int 3262zfs_ioc_rename(zfs_cmd_t *zc) 3263{ | 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 --- 3247 unchanged lines hidden (view full) --- 3256 * zc_value new name of dataset 3257 * zc_cookie recursive flag (only valid for snapshots) 3258 * 3259 * outputs: none 3260 */ 3261static int 3262zfs_ioc_rename(zfs_cmd_t *zc) 3263{ |
3264 boolean_t recursive = zc->zc_cookie & 1; | 3264 int flags = 0; |
3265 | 3265 |
3266 if (zc->zc_cookie & 1) 3267 flags |= ZFS_RENAME_RECURSIVE; 3268 if (zc->zc_cookie & 2) 3269 flags |= ZFS_RENAME_IS_LEGACY; 3270 |
|
3266 zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; 3267 if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || 3268 strchr(zc->zc_value, '%')) 3269 return (EINVAL); 3270 3271 /* 3272 * Unmount snapshot unless we're doing a recursive rename, 3273 * in which case the dataset code figures out which snapshots 3274 * to unmount. 3275 */ | 3271 zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; 3272 if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || 3273 strchr(zc->zc_value, '%')) 3274 return (EINVAL); 3275 3276 /* 3277 * Unmount snapshot unless we're doing a recursive rename, 3278 * in which case the dataset code figures out which snapshots 3279 * to unmount. 3280 */ |
3276 if (!recursive && strchr(zc->zc_name, '@') != NULL && | 3281 if (!(flags & ZFS_RENAME_RECURSIVE) && 3282 strchr(zc->zc_name, '@') != NULL && |
3277 zc->zc_objset_type == DMU_OST_ZFS) { 3278 int err = zfs_unmount_snap(zc->zc_name, NULL); 3279 if (err) 3280 return (err); 3281 } | 3283 zc->zc_objset_type == DMU_OST_ZFS) { 3284 int err = zfs_unmount_snap(zc->zc_name, NULL); 3285 if (err) 3286 return (err); 3287 } |
3282 return (dmu_objset_rename(zc->zc_name, zc->zc_value, recursive)); | 3288 return (dmu_objset_rename(zc->zc_name, zc->zc_value, flags)); |
3283} 3284 3285static int 3286zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr) 3287{ 3288 const char *propname = nvpair_name(pair); 3289 boolean_t issnap = (strchr(dsname, '@') != NULL); 3290 zfs_prop_t prop = zfs_name_to_prop(propname); --- 1975 unchanged lines hidden --- | 3289} 3290 3291static int 3292zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr) 3293{ 3294 const char *propname = nvpair_name(pair); 3295 boolean_t issnap = (strchr(dsname, '@') != NULL); 3296 zfs_prop_t prop = zfs_name_to_prop(propname); --- 1975 unchanged lines hidden --- |