1248 != 0) {
1249 goto error;
1250 }
1251 } else if (datatype == DATA_TYPE_UINT64) {
1252 (void) nvpair_value_uint64(elem, ivalp);
1253 } else {
1254 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1255 "'%s' must be a number"), nvpair_name(elem));
1256 goto error;
1257 }
1258
1259 /*
1260 * Quota special: force 'none' and don't allow 0.
1261 */
1262 if ((type & ZFS_TYPE_DATASET) && *ivalp == 0 && !isnone &&
1263 (prop == ZFS_PROP_QUOTA || prop == ZFS_PROP_REFQUOTA)) {
1264 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1265 "use 'none' to disable quota/refquota"));
1266 goto error;
1267 }
1268 break;
1269
1270 case PROP_TYPE_INDEX:
1271 if (datatype != DATA_TYPE_STRING) {
1272 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1273 "'%s' must be a string"), nvpair_name(elem));
1274 goto error;
1275 }
1276
1277 (void) nvpair_value_string(elem, &value);
1278
1279 if (zprop_string_to_index(prop, value, ivalp, type) != 0) {
1280 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1281 "'%s' must be one of '%s'"), propname,
1282 zprop_values(prop, type));
1283 goto error;
1284 }
1285 break;
1286
1287 default:
|
1248 != 0) {
1249 goto error;
1250 }
1251 } else if (datatype == DATA_TYPE_UINT64) {
1252 (void) nvpair_value_uint64(elem, ivalp);
1253 } else {
1254 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1255 "'%s' must be a number"), nvpair_name(elem));
1256 goto error;
1257 }
1258
1259 /*
1260 * Quota special: force 'none' and don't allow 0.
1261 */
1262 if ((type & ZFS_TYPE_DATASET) && *ivalp == 0 && !isnone &&
1263 (prop == ZFS_PROP_QUOTA || prop == ZFS_PROP_REFQUOTA)) {
1264 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1265 "use 'none' to disable quota/refquota"));
1266 goto error;
1267 }
1268
1269 /*
1270 * Special handling for "*_limit=none". In this case it's not
1271 * 0 but UINT64_MAX.
1272 */
1273 if ((type & ZFS_TYPE_DATASET) && isnone &&
1274 (prop == ZFS_PROP_FILESYSTEM_LIMIT ||
1275 prop == ZFS_PROP_SNAPSHOT_LIMIT)) {
1276 *ivalp = UINT64_MAX;
1277 }
1278 break;
1279
1280 case PROP_TYPE_INDEX:
1281 if (datatype != DATA_TYPE_STRING) {
1282 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1283 "'%s' must be a string"), nvpair_name(elem));
1284 goto error;
1285 }
1286
1287 (void) nvpair_value_string(elem, &value);
1288
1289 if (zprop_string_to_index(prop, value, ivalp, type) != 0) {
1290 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1291 "'%s' must be one of '%s'"), propname,
1292 zprop_values(prop, type));
1293 goto error;
1294 }
1295 break;
1296
1297 default:
|