text stringlengths 0 14.1k |
|---|
{ |
nvpair_t *elem; |
nvlist_t *retprops; |
zpool_prop_t prop; |
char *strval; |
uint64_t intval; |
char *slash; |
struct stat64 statbuf; |
zpool_handle_t *zhp; |
nvlist_t *nvroot; |
if (nvlist_alloc(&retprops, NV_UNIQUE_NAME, 0) != 0) { |
(void) no_memory(hdl); |
return (NULL); |
} |
elem = NULL; |
while ((elem = nvlist_next_nvpair(props, elem)) != NULL) { |
const char *propname = nvpair_name(elem); |
/* |
* Make sure this property is valid and applies to this type. |
*/ |
if ((prop = zpool_name_to_prop(propname)) == ZPROP_INVAL) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""invalid property '%s'""), propname); |
(void) zfs_error(hdl, EZFS_BADPROP, errbuf); |
goto error; |
} |
if (zpool_prop_readonly(prop)) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""'%s' "" |
""is readonly""), propname); |
(void) zfs_error(hdl, EZFS_PROPREADONLY, errbuf); |
goto error; |
} |
if (zprop_parse_value(hdl, elem, prop, ZFS_TYPE_POOL, retprops, |
&strval, &intval, errbuf) != 0) |
goto error; |
/* |
* Perform additional checking for specific properties. |
*/ |
switch (prop) { |
case ZPOOL_PROP_VERSION: |
if (intval < version || intval > SPA_VERSION) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""property '%s' number %d is invalid.""), |
propname, intval); |
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf); |
goto error; |
} |
break; |
case ZPOOL_PROP_BOOTFS: |
if (create_or_import) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""property '%s' cannot be set at creation "" |
""or import time""), propname); |
(void) zfs_error(hdl, EZFS_BADPROP, errbuf); |
goto error; |
} |
if (version < SPA_VERSION_BOOTFS) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""pool must be upgraded to support "" |
""'%s' property""), propname); |
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf); |
goto error; |
} |
/* |
* bootfs property value has to be a dataset name and |
* the dataset has to be in the same pool as it sets to. |
*/ |
if (strval[0] != '\0' && !bootfs_name_valid(poolname, |
strval)) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, ""'%s' "" |
""is an invalid name""), strval); |
(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf); |
goto error; |
} |
if ((zhp = zpool_open_canfail(hdl, poolname)) == NULL) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
""could not open pool '%s'""), poolname); |
(void) zfs_error(hdl, EZFS_OPENFAILED, errbuf); |
goto error; |
} |
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL), |
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); |
/* |
* bootfs property cannot be set on a disk which has |
* been EFI labeled. |
*/ |
/* ZFSFUSE: disabled */ |
/*if (pool_uses_efi(nvroot)) { |
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.