1462 break;
1463 }
1464 error = dmu_write_uio_dbuf(zv->zv_dbuf, uio, bytes, tx);
1465 if (error == 0)
1466 zvol_log_write(zv, tx, off, bytes, sync);
1467 dmu_tx_commit(tx);
1468
1469 if (error)
1470 break;
1471 }
1472 zfs_range_unlock(rl);
1473 if (sync)
1474 zil_commit(zv->zv_zilog, ZVOL_OBJ);
1475 return (error);
1476 }
1477
1478 int
1479 zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t bs)
1480 {
1481 struct uuid uuid = EFI_RESERVED;
1482 efi_gpe_t gpe = { 0 };
1483 uint32_t crc;
1484 dk_efi_t efi;
1485 int length;
1486 char *ptr;
1487
1488 if (ddi_copyin(arg, &efi, sizeof (dk_efi_t), flag))
1489 return (SET_ERROR(EFAULT));
1490 ptr = (char *)(uintptr_t)efi.dki_data_64;
1491 length = efi.dki_length;
1492 /*
1493 * Some clients may attempt to request a PMBR for the
1494 * zvol. Currently this interface will return EINVAL to
1495 * such requests. These requests could be supported by
1496 * adding a check for lba == 0 and consing up an appropriate
1497 * PMBR.
1498 */
1499 if (efi.dki_lba < 1 || efi.dki_lba > 2 || length <= 0)
1500 return (SET_ERROR(EINVAL));
1501
1502 gpe.efi_gpe_StartingLBA = LE_64(34ULL);
|
1462 break;
1463 }
1464 error = dmu_write_uio_dbuf(zv->zv_dbuf, uio, bytes, tx);
1465 if (error == 0)
1466 zvol_log_write(zv, tx, off, bytes, sync);
1467 dmu_tx_commit(tx);
1468
1469 if (error)
1470 break;
1471 }
1472 zfs_range_unlock(rl);
1473 if (sync)
1474 zil_commit(zv->zv_zilog, ZVOL_OBJ);
1475 return (error);
1476 }
1477
1478 int
1479 zvol_getefi(void *arg, int flag, uint64_t vs, uint8_t bs)
1480 {
1481 struct uuid uuid = EFI_RESERVED;
1482 efi_gpe_t gpe = { {0} };
1483 uint32_t crc;
1484 dk_efi_t efi;
1485 int length;
1486 char *ptr;
1487
1488 if (ddi_copyin(arg, &efi, sizeof (dk_efi_t), flag))
1489 return (SET_ERROR(EFAULT));
1490 ptr = (char *)(uintptr_t)efi.dki_data_64;
1491 length = efi.dki_length;
1492 /*
1493 * Some clients may attempt to request a PMBR for the
1494 * zvol. Currently this interface will return EINVAL to
1495 * such requests. These requests could be supported by
1496 * adding a check for lba == 0 and consing up an appropriate
1497 * PMBR.
1498 */
1499 if (efi.dki_lba < 1 || efi.dki_lba > 2 || length <= 0)
1500 return (SET_ERROR(EINVAL));
1501
1502 gpe.efi_gpe_StartingLBA = LE_64(34ULL);
|