Changeset 67841 in vbox
- Timestamp:
- Jul 6, 2017 4:57:59 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116778
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r66193 r67841 343 343 static DECLCALLBACK(uint32_t) drvHostBaseGetRegionCount(PPDMIMEDIA pInterface) 344 344 { 345 RT_NOREF1(pInterface);345 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia); 346 346 347 347 LogFlowFunc(("\n")); 348 uint32_t cRegions = 1;348 uint32_t cRegions = pThis->fMediaPresent ? 1 : 0; 349 349 350 350 /* For now just return one region for all devices. */ … … 364 364 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia); 365 365 366 if (uRegion < 1 )366 if (uRegion < 1 && pThis->fMediaPresent) 367 367 { 368 368 uint64_t cbMedia; … … 414 414 && u64LbaStart < cbMedia / cbBlock) 415 415 { 416 rc = VERR_NOT_FOUND;417 418 416 if (puRegion) 419 417 *puRegion = 0; -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp
r66955 r67841 165 165 int rc = vscsiLunMediumQueryRegionProperties(pVScsiLun, iTrack - 1, &uLbaStart, 166 166 NULL, NULL, &enmDataForm); 167 AssertRC(rc); 167 if (rc == VERR_NOT_FOUND || rc == VERR_MEDIA_NOT_PRESENT) 168 return vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_NOT_READY, 169 SCSI_ASC_MEDIUM_NOT_PRESENT, 0x00); 170 else 171 AssertRC(rc); 168 172 169 173 *q++ = 0; /* reserved */ … … 201 205 int rc = vscsiLunMediumQueryRegionProperties(pVScsiLun, cTracks - 1, &uLbaStart, 202 206 &cBlocks, NULL, NULL); 203 AssertRC(rc); 207 if (rc == VERR_NOT_FOUND || rc == VERR_MEDIA_NOT_PRESENT) 208 return vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_NOT_READY, 209 SCSI_ASC_MEDIUM_NOT_PRESENT, 0x00); 210 else 211 AssertRC(rc); 204 212 205 213 uLbaStart += cBlocks; … … 241 249 int rc = vscsiLunMediumQueryRegionProperties(pVScsiLun, 0, NULL, 242 250 NULL, NULL, &enmDataForm); 243 AssertRC(rc); 251 if (rc == VERR_NOT_FOUND || rc == VERR_MEDIA_NOT_PRESENT) 252 return vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_NOT_READY, 253 SCSI_ASC_MEDIUM_NOT_PRESENT, 0x00); 254 else 255 AssertRC(rc); 244 256 245 257 if (enmDataForm == VDREGIONDATAFORM_CDDA) … … 995 1007 996 1008 uint32_t cTracks = vscsiLunMediumGetRegionCount(pVScsiLun); 997 for (uint32_t i = 0; i < cTracks; i++) 998 { 999 uint64_t cBlocks = 0; 1000 rc = vscsiLunMediumQueryRegionProperties(pVScsiLun, i, NULL, &cBlocks, 1001 NULL, NULL); 1002 AssertRC(rc); 1003 1004 pVScsiLunMmc->cSectors += cBlocks; 1009 if (cTracks) 1010 { 1011 for (uint32_t i = 0; i < cTracks; i++) 1012 { 1013 uint64_t cBlocks = 0; 1014 rc = vscsiLunMediumQueryRegionProperties(pVScsiLun, i, NULL, &cBlocks, 1015 NULL, NULL); 1016 AssertRC(rc); 1017 1018 pVScsiLunMmc->cSectors += cBlocks; 1019 } 1020 1021 pVScsiLunMmc->Core.fMediaPresent = true; 1022 pVScsiLunMmc->Core.fReady = false; 1023 } 1024 else 1025 { 1026 pVScsiLunMmc->Core.fMediaPresent = false; 1027 pVScsiLunMmc->Core.fReady = false; 1005 1028 } 1006 1029 … … 1604 1627 rc = vscsiLunMediumQueryRegionPropertiesForLba(pVScsiLun, uLbaStart, 1605 1628 NULL, NULL, NULL, &enmDataForm); 1606 AssertRC(rc); 1607 if ( enmDataForm != VDREGIONDATAFORM_MODE1_2048 1608 && enmDataForm != VDREGIONDATAFORM_MODE1_2352 1609 && enmDataForm != VDREGIONDATAFORM_MODE2_2336 1610 && enmDataForm != VDREGIONDATAFORM_MODE2_2352 1611 && enmDataForm != VDREGIONDATAFORM_RAW 1612 && cbSector == _2K) 1629 if (RT_FAILURE(rc)) 1630 { 1631 rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_LOGICAL_BLOCK_OOR, 0x00); 1632 vscsiDeviceReqComplete(pVScsiLun->pVScsiDevice, pVScsiReq, rcReq, false, VINF_SUCCESS); 1633 } 1634 else if ( enmDataForm != VDREGIONDATAFORM_MODE1_2048 1635 && enmDataForm != VDREGIONDATAFORM_MODE1_2352 1636 && enmDataForm != VDREGIONDATAFORM_MODE2_2336 1637 && enmDataForm != VDREGIONDATAFORM_MODE2_2352 1638 && enmDataForm != VDREGIONDATAFORM_RAW 1639 && cbSector == _2K) 1613 1640 { 1614 1641 rcReq = vscsiLunReqSenseErrorInfoSet(pVScsiLun, pVScsiReq, … … 1691 1718 ASMAtomicWriteU32((volatile uint32_t *)&pVScsiLunMmc->MediaEventStatus, MMCEVENTSTATUSTYPE_MEDIA_REMOVED); 1692 1719 ASMAtomicXchgU32(&pVScsiLunMmc->u32MediaTrackType, MMC_MEDIA_TYPE_NO_DISC); 1720 pVScsiLunMmc->cSectors = 0; 1693 1721 return VINF_SUCCESS; 1694 1722 }
Note:
See TracChangeset
for help on using the changeset viewer.