Changeset 66165 in vbox
- Timestamp:
- Mar 20, 2017 11:06:26 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r64839 r66165 337 337 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia); 338 338 return pThis->fBiosVisible; 339 } 340 341 342 /** @interface_method_impl{PDMIMEDIA,pfnGetRegionCount} */ 343 static DECLCALLBACK(uint32_t) drvHostBaseGetRegionCount(PPDMIMEDIA pInterface) 344 { 345 RT_NOREF1(pInterface); 346 347 LogFlowFunc(("\n")); 348 uint32_t cRegions = 1; 349 350 /* For now just return one region for all devices. */ 351 /** @todo: Handle CD/DVD passthrough properly. */ 352 353 LogFlowFunc(("returns %u\n", cRegions)); 354 return cRegions; 355 } 356 357 /** @interface_method_impl{PDMIMEDIA,pfnQueryRegionProperties} */ 358 static DECLCALLBACK(int) drvHostBaseQueryRegionProperties(PPDMIMEDIA pInterface, uint32_t uRegion, uint64_t *pu64LbaStart, 359 uint64_t *pcBlocks, uint64_t *pcbBlock, 360 PPDMMEDIAREGIONDATAFORM penmDataForm) 361 { 362 LogFlowFunc(("\n")); 363 int rc = VINF_SUCCESS; 364 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia); 365 366 if (uRegion < 1) 367 { 368 uint64_t cbMedia; 369 rc = drvHostBaseGetMediaSizeOs(pThis, &cbMedia); 370 if (RT_SUCCESS(rc)) 371 { 372 uint64_t cbBlock = 0; 373 374 if (pThis->enmType == PDMMEDIATYPE_DVD) 375 cbBlock = 2048; 376 else 377 cbBlock = 512; /* Floppy. */ 378 379 if (pu64LbaStart) 380 *pu64LbaStart = 0; 381 if (pcBlocks) 382 *pcBlocks = cbMedia / cbBlock; 383 if (pcbBlock) 384 *pcbBlock = cbBlock; 385 if (penmDataForm) 386 *penmDataForm = PDMMEDIAREGIONDATAFORM_RAW; 387 } 388 } 389 else 390 rc = VERR_NOT_FOUND; 391 392 LogFlowFunc(("returns %Rrc\n", rc)); 393 return rc; 394 } 395 396 /** @interface_method_impl{PDMIMEDIA,pfnQueryRegionPropertiesForLba} */ 397 static DECLCALLBACK(int) drvHostBaseQueryRegionPropertiesForLba(PPDMIMEDIA pInterface, uint64_t u64LbaStart, 398 uint64_t *pcBlocks, uint64_t *pcbBlock, 399 PPDMMEDIAREGIONDATAFORM penmDataForm) 400 { 401 LogFlowFunc(("\n")); 402 int rc = VINF_SUCCESS; 403 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia); 404 uint64_t cbMedia; 405 uint64_t cbBlock = 0; 406 407 if (pThis->enmType == PDMMEDIATYPE_DVD) 408 cbBlock = 2048; 409 else 410 cbBlock = 512; /* Floppy. */ 411 412 rc = drvHostBaseGetMediaSizeOs(pThis, &cbMedia); 413 if ( RT_SUCCESS(rc) 414 && u64LbaStart < cbMedia / cbBlock) 415 { 416 rc = VERR_NOT_FOUND; 417 418 if (pcBlocks) 419 *pcBlocks = cbMedia / cbBlock; 420 if (pcbBlock) 421 *pcbBlock = cbBlock; 422 if (penmDataForm) 423 *penmDataForm = PDMMEDIAREGIONDATAFORM_RAW; 424 } 425 else 426 rc = VERR_NOT_FOUND; 427 428 LogFlowFunc(("returns %Rrc\n", rc)); 429 return rc; 339 430 } 340 431 … … 1185 1276 1186 1277 /* IMedia. */ 1187 pThis->IMedia.pfnRead = drvHostBaseRead; 1188 pThis->IMedia.pfnWrite = drvHostBaseWrite; 1189 pThis->IMedia.pfnFlush = drvHostBaseFlush; 1190 pThis->IMedia.pfnIsReadOnly = drvHostBaseIsReadOnly; 1191 pThis->IMedia.pfnIsNonRotational = drvHostBaseIsNonRotational; 1192 pThis->IMedia.pfnGetSize = drvHostBaseGetSize; 1193 pThis->IMedia.pfnGetType = drvHostBaseGetType; 1194 pThis->IMedia.pfnGetUuid = drvHostBaseGetUuid; 1195 pThis->IMedia.pfnBiosGetPCHSGeometry = drvHostBaseGetPCHSGeometry; 1196 pThis->IMedia.pfnBiosSetPCHSGeometry = drvHostBaseSetPCHSGeometry; 1197 pThis->IMedia.pfnBiosGetLCHSGeometry = drvHostBaseGetLCHSGeometry; 1198 pThis->IMedia.pfnBiosSetLCHSGeometry = drvHostBaseSetLCHSGeometry; 1199 pThis->IMedia.pfnBiosIsVisible = drvHostBaseIsVisible; 1278 pThis->IMedia.pfnRead = drvHostBaseRead; 1279 pThis->IMedia.pfnWrite = drvHostBaseWrite; 1280 pThis->IMedia.pfnFlush = drvHostBaseFlush; 1281 pThis->IMedia.pfnIsReadOnly = drvHostBaseIsReadOnly; 1282 pThis->IMedia.pfnIsNonRotational = drvHostBaseIsNonRotational; 1283 pThis->IMedia.pfnGetSize = drvHostBaseGetSize; 1284 pThis->IMedia.pfnGetType = drvHostBaseGetType; 1285 pThis->IMedia.pfnGetUuid = drvHostBaseGetUuid; 1286 pThis->IMedia.pfnBiosGetPCHSGeometry = drvHostBaseGetPCHSGeometry; 1287 pThis->IMedia.pfnBiosSetPCHSGeometry = drvHostBaseSetPCHSGeometry; 1288 pThis->IMedia.pfnBiosGetLCHSGeometry = drvHostBaseGetLCHSGeometry; 1289 pThis->IMedia.pfnBiosSetLCHSGeometry = drvHostBaseSetLCHSGeometry; 1290 pThis->IMedia.pfnBiosIsVisible = drvHostBaseIsVisible; 1291 pThis->IMedia.pfnGetRegionCount = drvHostBaseGetRegionCount; 1292 pThis->IMedia.pfnQueryRegionProperties = drvHostBaseQueryRegionProperties; 1293 pThis->IMedia.pfnQueryRegionPropertiesForLba = drvHostBaseQueryRegionPropertiesForLba; 1200 1294 1201 1295 /* IMediaEx */
Note:
See TracChangeset
for help on using the changeset viewer.