1467 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
1468 } else if (prop == ZFS_PROP_CHECKSUM ||
1469 prop == ZFS_PROP_DEDUP) {
1470 (void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1471 "property setting is not allowed on "
1472 "root pools"));
1473 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
1474 } else {
1475 (void) zfs_standard_error(hdl, err, errbuf);
1476 }
1477 break;
1478
1479 case EINVAL:
1480 if (prop == ZPROP_INVAL) {
1481 (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
1482 } else {
1483 (void) zfs_standard_error(hdl, err, errbuf);
1484 }
1485 break;
1486
1487 case EOVERFLOW:
1488 /*
1489 * This platform can't address a volume this big.
1490 */
1491 #ifdef _ILP32
1492 if (prop == ZFS_PROP_VOLSIZE) {
1493 (void) zfs_error(hdl, EZFS_VOLTOOBIG, errbuf);
1494 break;
1495 }
1496 #endif
1497 /* FALLTHROUGH */
1498 default:
1499 (void) zfs_standard_error(hdl, err, errbuf);
1500 }
1501 }
1502
1503 /*
1504 * Given a property name and value, set the property for the given dataset.
1505 */
1506 int
2476 L_NO_CORRECTION, NULL) == -1) {
2477 m_label_free(new_sl);
2478 break;
2479 }
2480
2481 if (label_to_str(new_sl, &ascii, M_LABEL,
2482 DEF_NAMES) != 0) {
2483 if (ascii)
2484 free(ascii);
2485 m_label_free(new_sl);
2486 break;
2487 }
2488 m_label_free(new_sl);
2489
2490 (void) strlcpy(propbuf, ascii, proplen);
2491 free(ascii);
2492 }
2493 break;
2494
2495 case ZFS_PROP_GUID:
2496 /*
2497 * GUIDs are stored as numbers, but they are identifiers.
2498 * We don't want them to be pretty printed, because pretty
2499 * printing mangles the ID into a truncated and useless value.
2500 */
2501 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2502 return (-1);
2503 (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val);
2504 break;
2505
2506 default:
2507 switch (zfs_prop_get_type(prop)) {
2508 case PROP_TYPE_NUMBER:
2509 if (get_numeric_property(zhp, prop, src,
2510 &source, &val) != 0)
2511 return (-1);
2512 if (literal)
2513 (void) snprintf(propbuf, proplen, "%llu",
2514 (u_longlong_t)val);
2515 else
3261 if (ret != 0) {
3262 char parent[ZFS_MAXNAMELEN];
3263 (void) parent_name(path, parent, sizeof (parent));
3264
3265 switch (errno) {
3266 case ENOENT:
3267 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3268 "no such parent '%s'"), parent);
3269 return (zfs_error(hdl, EZFS_NOENT, errbuf));
3270
3271 case EINVAL:
3272 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3273 "parent '%s' is not a filesystem"), parent);
3274 return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
3275
3276 case ENOTSUP:
3277 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3278 "pool must be upgraded to set this "
3279 "property or value"));
3280 return (zfs_error(hdl, EZFS_BADVERSION, errbuf));
3281 #ifdef _ILP32
3282 case EOVERFLOW:
3283 /*
3284 * This platform can't address a volume this big.
3285 */
3286 if (type == ZFS_TYPE_VOLUME)
3287 return (zfs_error(hdl, EZFS_VOLTOOBIG,
3288 errbuf));
3289 #endif
3290 /* FALLTHROUGH */
3291 default:
3292 return (zfs_standard_error(hdl, errno, errbuf));
3293 }
3294 }
3295
3296 return (0);
3297 }
3298
3299 /*
3300 * Destroys the given dataset. The caller must make sure that the filesystem
|
1467 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
1468 } else if (prop == ZFS_PROP_CHECKSUM ||
1469 prop == ZFS_PROP_DEDUP) {
1470 (void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1471 "property setting is not allowed on "
1472 "root pools"));
1473 (void) zfs_error(hdl, EZFS_NOTSUP, errbuf);
1474 } else {
1475 (void) zfs_standard_error(hdl, err, errbuf);
1476 }
1477 break;
1478
1479 case EINVAL:
1480 if (prop == ZPROP_INVAL) {
1481 (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
1482 } else {
1483 (void) zfs_standard_error(hdl, err, errbuf);
1484 }
1485 break;
1486
1487 case EEXIST:
1488 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
1489 "fsid_guid is invalid or already in use"));
1490 (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
1491 break;
1492
1493 case EOVERFLOW:
1494 /*
1495 * This platform can't address a volume this big.
1496 */
1497 #ifdef _ILP32
1498 if (prop == ZFS_PROP_VOLSIZE) {
1499 (void) zfs_error(hdl, EZFS_VOLTOOBIG, errbuf);
1500 break;
1501 }
1502 #endif
1503 /* FALLTHROUGH */
1504 default:
1505 (void) zfs_standard_error(hdl, err, errbuf);
1506 }
1507 }
1508
1509 /*
1510 * Given a property name and value, set the property for the given dataset.
1511 */
1512 int
2482 L_NO_CORRECTION, NULL) == -1) {
2483 m_label_free(new_sl);
2484 break;
2485 }
2486
2487 if (label_to_str(new_sl, &ascii, M_LABEL,
2488 DEF_NAMES) != 0) {
2489 if (ascii)
2490 free(ascii);
2491 m_label_free(new_sl);
2492 break;
2493 }
2494 m_label_free(new_sl);
2495
2496 (void) strlcpy(propbuf, ascii, proplen);
2497 free(ascii);
2498 }
2499 break;
2500
2501 case ZFS_PROP_GUID:
2502 case ZFS_PROP_FSID_GUID:
2503 /*
2504 * GUIDs are stored as numbers, but they are identifiers.
2505 * We don't want them to be pretty printed, because pretty
2506 * printing mangles the ID into a truncated and useless value.
2507 */
2508 if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2509 return (-1);
2510 (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val);
2511 break;
2512
2513 default:
2514 switch (zfs_prop_get_type(prop)) {
2515 case PROP_TYPE_NUMBER:
2516 if (get_numeric_property(zhp, prop, src,
2517 &source, &val) != 0)
2518 return (-1);
2519 if (literal)
2520 (void) snprintf(propbuf, proplen, "%llu",
2521 (u_longlong_t)val);
2522 else
3268 if (ret != 0) {
3269 char parent[ZFS_MAXNAMELEN];
3270 (void) parent_name(path, parent, sizeof (parent));
3271
3272 switch (errno) {
3273 case ENOENT:
3274 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3275 "no such parent '%s'"), parent);
3276 return (zfs_error(hdl, EZFS_NOENT, errbuf));
3277
3278 case EINVAL:
3279 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3280 "parent '%s' is not a filesystem"), parent);
3281 return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
3282
3283 case ENOTSUP:
3284 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3285 "pool must be upgraded to set this "
3286 "property or value"));
3287 return (zfs_error(hdl, EZFS_BADVERSION, errbuf));
3288
3289 case EEXIST:
3290 zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
3291 "fsid_guid is invalid or already in use"));
3292 return (zfs_error(hdl, EZFS_BADPROP, errbuf));
3293 #ifdef _ILP32
3294 case EOVERFLOW:
3295 /*
3296 * This platform can't address a volume this big.
3297 */
3298 if (type == ZFS_TYPE_VOLUME)
3299 return (zfs_error(hdl, EZFS_VOLTOOBIG,
3300 errbuf));
3301 #endif
3302 /* FALLTHROUGH */
3303 default:
3304 return (zfs_standard_error(hdl, errno, errbuf));
3305 }
3306 }
3307
3308 return (0);
3309 }
3310
3311 /*
3312 * Destroys the given dataset. The caller must make sure that the filesystem
|