1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Eliminate an #ifdef illumos for zfs_ioc_rename().

Since allow_mounted is a FreeBSD-specific change, default to B_TRUE, then
locally check for the magic bit.  Unconditionally check allow_mounted below.
Convert the setting of allow_mounted to an explicit boolean.

MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	672578 (in part) on 2013/07/19
This commit is contained in:
Will Andrews 2015-01-21 19:20:36 +00:00
parent 88a6aee146
commit 2a2c1d424a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277501

View File

@ -3751,10 +3751,12 @@ static int
zfs_ioc_rename(zfs_cmd_t *zc)
{
boolean_t recursive = zc->zc_cookie & 1;
#ifdef __FreeBSD__
boolean_t allow_mounted = zc->zc_cookie & 2;
#endif
char *at;
boolean_t allow_mounted = B_TRUE;
#ifdef __FreeBSD__
allow_mounted = (zc->zc_cookie & 2) != 0;
#endif
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
@ -3769,11 +3771,7 @@ zfs_ioc_rename(zfs_cmd_t *zc)
if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1))
return (SET_ERROR(EXDEV));
*at = '\0';
#ifdef illumos
if (zc->zc_objset_type == DMU_OST_ZFS) {
#else
if (zc->zc_objset_type == DMU_OST_ZFS && allow_mounted) {
#endif
error = dmu_objset_find(zc->zc_name,
recursive_unmount, at + 1,
recursive ? DS_FIND_CHILDREN : 0);