Changeset 11269 in vbox for trunk/src/VBox/Devices/Storage/DrvVD.cpp
- Timestamp:
- Aug 8, 2008 4:24:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r11267 r11269 276 276 LogFlow(("%s: off=%#llx pvBuf=%p cbRead=%d\n", __FUNCTION__, 277 277 off, pvBuf, cbRead)); 278 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);279 int rc = VDRead(p Data->pDisk, off, pvBuf, cbRead);278 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 279 int rc = VDRead(pThis->pDisk, off, pvBuf, cbRead); 280 280 if (RT_SUCCESS(rc)) 281 281 Log2(("%s: off=%#llx pvBuf=%p cbRead=%d %.*Vhxd\n", __FUNCTION__, … … 292 292 LogFlow(("%s: off=%#llx pvBuf=%p cbWrite=%d\n", __FUNCTION__, 293 293 off, pvBuf, cbWrite)); 294 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);294 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 295 295 Log2(("%s: off=%#llx pvBuf=%p cbWrite=%d %.*Vhxd\n", __FUNCTION__, 296 296 off, pvBuf, cbWrite, cbWrite, pvBuf)); 297 int rc = VDWrite(p Data->pDisk, off, pvBuf, cbWrite);297 int rc = VDWrite(pThis->pDisk, off, pvBuf, cbWrite); 298 298 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 299 299 return rc; … … 304 304 { 305 305 LogFlow(("%s:\n", __FUNCTION__)); 306 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);307 int rc = VDFlush(p Data->pDisk);306 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 307 int rc = VDFlush(pThis->pDisk); 308 308 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 309 309 return rc; … … 314 314 { 315 315 LogFlow(("%s:\n", __FUNCTION__)); 316 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);317 uint64_t cb = VDGetSize(p Data->pDisk, VD_LAST_IMAGE);316 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 317 uint64_t cb = VDGetSize(pThis->pDisk, VD_LAST_IMAGE); 318 318 LogFlow(("%s: returns %#llx (%llu)\n", __FUNCTION__, cb, cb)); 319 319 return cb; … … 324 324 { 325 325 LogFlow(("%s:\n", __FUNCTION__)); 326 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);327 bool f = VDIsReadOnly(p Data->pDisk);326 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 327 bool f = VDIsReadOnly(pThis->pDisk); 328 328 LogFlow(("%s: returns %d\n", __FUNCTION__, f)); 329 329 return f; … … 335 335 { 336 336 LogFlow(("%s:\n", __FUNCTION__)); 337 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);338 int rc = VDGetPCHSGeometry(p Data->pDisk, VD_LAST_IMAGE, pPCHSGeometry);337 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 338 int rc = VDGetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry); 339 339 if (RT_FAILURE(rc)) 340 340 { … … 353 353 LogFlow(("%s: CHS=%d/%d/%d\n", __FUNCTION__, 354 354 pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors)); 355 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);356 int rc = VDSetPCHSGeometry(p Data->pDisk, VD_LAST_IMAGE, pPCHSGeometry);355 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 356 int rc = VDSetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry); 357 357 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 358 358 return rc; … … 364 364 { 365 365 LogFlow(("%s:\n", __FUNCTION__)); 366 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);367 int rc = VDGetLCHSGeometry(p Data->pDisk, VD_LAST_IMAGE, pLCHSGeometry);366 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 367 int rc = VDGetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry); 368 368 if (RT_FAILURE(rc)) 369 369 { … … 382 382 LogFlow(("%s: CHS=%d/%d/%d\n", __FUNCTION__, 383 383 pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors)); 384 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);385 int rc = VDSetLCHSGeometry(p Data->pDisk, VD_LAST_IMAGE, pLCHSGeometry);384 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 385 int rc = VDSetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry); 386 386 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 387 387 return rc; … … 392 392 { 393 393 LogFlow(("%s:\n", __FUNCTION__)); 394 PVBOXDISK p Data= PDMIMEDIA_2_VBOXDISK(pInterface);395 int rc = VDGetUuid(p Data->pDisk, 0, pUuid);394 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 395 int rc = VDGetUuid(pThis->pDisk, 0, pUuid); 396 396 LogFlow(("%s: returns %Vrc ({%Vuuid})\n", __FUNCTION__, rc, pUuid)); 397 397 return rc; … … 408 408 LogFlow(("%s: uOffset=%#llx paSeg=%#p cSeg=%u cbRead=%d\n pvUser=%#p", __FUNCTION__, 409 409 uOffset, paSeg, cSeg, cbRead, pvUser)); 410 PVBOXDISK p Data= PDMIMEDIAASYNC_2_VBOXDISK(pInterface);411 int rc = VDAsyncRead(p Data->pDisk, uOffset, cbRead, paSeg, cSeg, pvUser);410 PVBOXDISK pThis = PDMIMEDIAASYNC_2_VBOXDISK(pInterface); 411 int rc = VDAsyncRead(pThis->pDisk, uOffset, cbRead, paSeg, cSeg, pvUser); 412 412 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 413 413 return rc; … … 420 420 LogFlow(("%s: uOffset=%#llx paSeg=%#p cSeg=%u cbWrite=%d\n pvUser=%#p", __FUNCTION__, 421 421 uOffset, paSeg, cSeg, cbWrite, pvUser)); 422 PVBOXDISK p Data= PDMIMEDIAASYNC_2_VBOXDISK(pInterface);423 int rc = VDAsyncWrite(p Data->pDisk, uOffset, cbWrite, paSeg, cSeg, pvUser);422 PVBOXDISK pThis = PDMIMEDIAASYNC_2_VBOXDISK(pInterface); 423 int rc = VDAsyncWrite(pThis->pDisk, uOffset, cbWrite, paSeg, cSeg, pvUser); 424 424 LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc)); 425 425 return rc; … … 432 432 static DECLCALLBACK(int) drvvdTasksCompleteNotify(PPDMITRANSPORTASYNCPORT pInterface, void *pvUser) 433 433 { 434 PVBOXDISK p Data= PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface);434 PVBOXDISK pThis = PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface); 435 435 PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser; 436 436 int rc = VINF_VDI_ASYNC_IO_FINISHED; … … 443 443 if (rc == VINF_VDI_ASYNC_IO_FINISHED) 444 444 { 445 rc = p Data->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pData->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller);445 rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller); 446 446 } 447 447 else if (rc == VERR_VDI_ASYNC_IO_IN_PROGRESS) 448 448 rc = VINF_SUCCESS; 449 449 450 rc = RTCacheInsert(p Data->pCache, pDrvVDAsyncTask);450 rc = RTCacheInsert(pThis->pCache, pDrvVDAsyncTask); 451 451 AssertRC(rc); 452 452 … … 464 464 { 465 465 PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface); 466 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);466 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 467 467 switch (enmInterface) 468 468 { … … 470 470 return &pDrvIns->IBase; 471 471 case PDMINTERFACE_MEDIA: 472 return &p Data->IMedia;472 return &pThis->IMedia; 473 473 case PDMINTERFACE_MEDIA_ASYNC: 474 return p Data->fAsyncIOSupported ? &pData->IMediaAsync : NULL;474 return pThis->fAsyncIOSupported ? &pThis->IMediaAsync : NULL; 475 475 case PDMINTERFACE_TRANSPORT_ASYNC_PORT: 476 return &p Data->ITransportAsyncPort;476 return &pThis->ITransportAsyncPort; 477 477 default: 478 478 return NULL; … … 500 500 { 501 501 LogFlow(("%s:\n", __FUNCTION__)); 502 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);502 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 503 503 int rc = VINF_SUCCESS; 504 504 char *pszName = NULL; /**< The path of the disk image file. */ … … 511 511 */ 512 512 pDrvIns->IBase.pfnQueryInterface = drvvdQueryInterface; 513 p Data->pDrvIns = pDrvIns;514 p Data->fTempReadOnly = false;515 p Data->pDisk = NULL;513 pThis->pDrvIns = pDrvIns; 514 pThis->fTempReadOnly = false; 515 pThis->pDisk = NULL; 516 516 517 517 /* IMedia */ 518 p Data->IMedia.pfnRead = drvvdRead;519 p Data->IMedia.pfnWrite = drvvdWrite;520 p Data->IMedia.pfnFlush = drvvdFlush;521 p Data->IMedia.pfnGetSize = drvvdGetSize;522 p Data->IMedia.pfnIsReadOnly = drvvdIsReadOnly;523 p Data->IMedia.pfnBiosGetPCHSGeometry = drvvdBiosGetPCHSGeometry;524 p Data->IMedia.pfnBiosSetPCHSGeometry = drvvdBiosSetPCHSGeometry;525 p Data->IMedia.pfnBiosGetLCHSGeometry = drvvdBiosGetLCHSGeometry;526 p Data->IMedia.pfnBiosSetLCHSGeometry = drvvdBiosSetLCHSGeometry;527 p Data->IMedia.pfnGetUuid = drvvdGetUuid;518 pThis->IMedia.pfnRead = drvvdRead; 519 pThis->IMedia.pfnWrite = drvvdWrite; 520 pThis->IMedia.pfnFlush = drvvdFlush; 521 pThis->IMedia.pfnGetSize = drvvdGetSize; 522 pThis->IMedia.pfnIsReadOnly = drvvdIsReadOnly; 523 pThis->IMedia.pfnBiosGetPCHSGeometry = drvvdBiosGetPCHSGeometry; 524 pThis->IMedia.pfnBiosSetPCHSGeometry = drvvdBiosSetPCHSGeometry; 525 pThis->IMedia.pfnBiosGetLCHSGeometry = drvvdBiosGetLCHSGeometry; 526 pThis->IMedia.pfnBiosSetLCHSGeometry = drvvdBiosSetLCHSGeometry; 527 pThis->IMedia.pfnGetUuid = drvvdGetUuid; 528 528 529 529 /* IMediaAsync */ 530 p Data->IMediaAsync.pfnStartRead = drvvdStartRead;531 p Data->IMediaAsync.pfnStartWrite = drvvdStartWrite;530 pThis->IMediaAsync.pfnStartRead = drvvdStartRead; 531 pThis->IMediaAsync.pfnStartWrite = drvvdStartWrite; 532 532 533 533 /* ITransportAsyncPort */ 534 p Data->ITransportAsyncPort.pfnTaskCompleteNotify = drvvdTasksCompleteNotify;534 pThis->ITransportAsyncPort.pfnTaskCompleteNotify = drvvdTasksCompleteNotify; 535 535 536 536 /* Initialize supported VD interfaces. */ 537 p Data->VDIErrorCallbacks.cbSize = sizeof(VDINTERFACEERROR);538 p Data->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;539 p Data->VDIErrorCallbacks.pfnError = drvvdErrorCallback;540 541 rc = VDInterfaceCreate(&p Data->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR,542 &p Data->VDIErrorCallbacks, pDrvIns, NULL);537 pThis->VDIErrorCallbacks.cbSize = sizeof(VDINTERFACEERROR); 538 pThis->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 539 pThis->VDIErrorCallbacks.pfnError = drvvdErrorCallback; 540 541 rc = VDInterfaceCreate(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR, 542 &pThis->VDIErrorCallbacks, pDrvIns, NULL); 543 543 AssertRC(rc); 544 544 545 p Data->VDIAsyncIOCallbacks.cbSize = sizeof(VDINTERFACEASYNCIO);546 p Data->VDIAsyncIOCallbacks.enmInterface = VDINTERFACETYPE_ASYNCIO;547 p Data->VDIAsyncIOCallbacks.pfnOpen = drvvdAsyncIOOpen;548 p Data->VDIAsyncIOCallbacks.pfnClose = drvvdAsyncIOClose;549 p Data->VDIAsyncIOCallbacks.pfnRead = drvvdAsyncIORead;550 p Data->VDIAsyncIOCallbacks.pfnWrite = drvvdAsyncIOWrite;551 p Data->VDIAsyncIOCallbacks.pfnFlush = drvvdAsyncIOFlush;552 p Data->VDIAsyncIOCallbacks.pfnPrepareRead = drvvdAsyncIOPrepareRead;553 p Data->VDIAsyncIOCallbacks.pfnPrepareWrite = drvvdAsyncIOPrepareWrite;554 p Data->VDIAsyncIOCallbacks.pfnTasksSubmit = drvvdAsyncIOTasksSubmit;555 556 rc = VDInterfaceCreate(&p Data->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO,557 &p Data->VDIAsyncIOCallbacks, pData, &pData->VDIError);545 pThis->VDIAsyncIOCallbacks.cbSize = sizeof(VDINTERFACEASYNCIO); 546 pThis->VDIAsyncIOCallbacks.enmInterface = VDINTERFACETYPE_ASYNCIO; 547 pThis->VDIAsyncIOCallbacks.pfnOpen = drvvdAsyncIOOpen; 548 pThis->VDIAsyncIOCallbacks.pfnClose = drvvdAsyncIOClose; 549 pThis->VDIAsyncIOCallbacks.pfnRead = drvvdAsyncIORead; 550 pThis->VDIAsyncIOCallbacks.pfnWrite = drvvdAsyncIOWrite; 551 pThis->VDIAsyncIOCallbacks.pfnFlush = drvvdAsyncIOFlush; 552 pThis->VDIAsyncIOCallbacks.pfnPrepareRead = drvvdAsyncIOPrepareRead; 553 pThis->VDIAsyncIOCallbacks.pfnPrepareWrite = drvvdAsyncIOPrepareWrite; 554 pThis->VDIAsyncIOCallbacks.pfnTasksSubmit = drvvdAsyncIOTasksSubmit; 555 556 rc = VDInterfaceCreate(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO, 557 &pThis->VDIAsyncIOCallbacks, pThis, &pThis->VDIError); 558 558 AssertRC(rc); 559 559 560 p Data->VDIConfigCallbacks.cbSize = sizeof(VDINTERFACECONFIG);561 p Data->VDIConfigCallbacks.enmInterface = VDINTERFACETYPE_CONFIG;562 p Data->VDIConfigCallbacks.pfnAreValuesValid = drvvdCfgAreValuesValid;563 p Data->VDIConfigCallbacks.pfnQueryType = drvvdCfgQueryType;564 p Data->VDIConfigCallbacks.pfnQuerySize = drvvdCfgQuerySize;565 p Data->VDIConfigCallbacks.pfnQueryInteger = drvvdCfgQueryInteger;566 p Data->VDIConfigCallbacks.pfnQueryIntegerDef = drvvdCfgQueryIntegerDef;567 p Data->VDIConfigCallbacks.pfnQueryString = drvvdCfgQueryString;568 p Data->VDIConfigCallbacks.pfnQueryStringDef = drvvdCfgQueryStringDef;569 p Data->VDIConfigCallbacks.pfnQueryBytes = drvvdCfgQueryBytes;560 pThis->VDIConfigCallbacks.cbSize = sizeof(VDINTERFACECONFIG); 561 pThis->VDIConfigCallbacks.enmInterface = VDINTERFACETYPE_CONFIG; 562 pThis->VDIConfigCallbacks.pfnAreValuesValid = drvvdCfgAreValuesValid; 563 pThis->VDIConfigCallbacks.pfnQueryType = drvvdCfgQueryType; 564 pThis->VDIConfigCallbacks.pfnQuerySize = drvvdCfgQuerySize; 565 pThis->VDIConfigCallbacks.pfnQueryInteger = drvvdCfgQueryInteger; 566 pThis->VDIConfigCallbacks.pfnQueryIntegerDef = drvvdCfgQueryIntegerDef; 567 pThis->VDIConfigCallbacks.pfnQueryString = drvvdCfgQueryString; 568 pThis->VDIConfigCallbacks.pfnQueryStringDef = drvvdCfgQueryStringDef; 569 pThis->VDIConfigCallbacks.pfnQueryBytes = drvvdCfgQueryBytes; 570 570 571 571 /** @todo TEMP! this isn't really correct - this needs to be made per image, … … 573 573 * At the moment this is harmless, as iSCSI can only be used as a base 574 574 * image, and no other backend uses the private data for these callbacks. */ 575 rc = VDInterfaceCreate(&p Data->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,576 &p Data->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pData->VDIAsyncIO);575 rc = VDInterfaceCreate(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG, 576 &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->VDIAsyncIO); 577 577 AssertRC(rc); 578 578 579 579 /* Try to attach async media port interface above.*/ 580 p Data->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT);580 pThis->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT); 581 581 582 582 /* … … 584 584 * async interface. 585 585 */ 586 if (p Data->pDrvMediaAsyncPort)586 if (pThis->pDrvMediaAsyncPort) 587 587 { 588 588 /* Try to attach the driver. */ … … 596 596 * Revert to non async I/O. 597 597 */ 598 p Data->pDrvMediaAsyncPort = NULL;598 pThis->pDrvMediaAsyncPort = NULL; 599 599 } 600 600 else if (RT_FAILURE(rc)) … … 605 605 { 606 606 /* Success query the async transport interface. */ 607 p Data->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC);608 if (!p Data->pDrvTransportAsync)607 pThis->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC); 608 if (!pThis->pDrvTransportAsync) 609 609 { 610 610 /* Whoops. */ … … 659 659 { 660 660 /** @todo TEMP! later the iSCSI config callbacks won't be included here */ 661 rc = VDCreate(&p Data->VDIConfig, &pData->pDisk);661 rc = VDCreate(&pThis->VDIConfig, &pThis->pDisk); 662 662 /* Error message is already set correctly. */ 663 663 } … … 717 717 { 718 718 PCFGMNODE pCfg = CFGMR3GetChild(pCurNode, "VDConfig"); 719 p Data->VDIConfig.pvUser = pCfg; /**< @todo TEMP! */719 pThis->VDIConfig.pvUser = pCfg; /**< @todo TEMP! */ 720 720 } 721 721 … … 730 730 if (fHonorZeroWrites) 731 731 uOpenFlags |= VD_OPEN_FLAGS_HONOR_ZEROES; 732 if (p Data->pDrvMediaAsyncPort)732 if (pThis->pDrvMediaAsyncPort) 733 733 uOpenFlags |= VD_OPEN_FLAGS_ASYNC_IO; 734 734 735 735 /** Try to open backend in asyc I/O mode first. */ 736 rc = VDOpen(p Data->pDisk, pszFormat, pszName, uOpenFlags);736 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags); 737 737 if (rc == VERR_NOT_SUPPORTED) 738 738 { 739 739 /* Seems async I/O is not supported by the backend, open in normal mode. */ 740 740 uOpenFlags &= ~VD_OPEN_FLAGS_ASYNC_IO; 741 rc = VDOpen(p Data->pDisk, pszFormat, pszName, uOpenFlags);741 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags); 742 742 } 743 743 … … 745 745 Log(("%s: %d - Opened '%s' in %s mode\n", __FUNCTION__, 746 746 iLevel, pszName, 747 VDIsReadOnly(p Data->pDisk) ? "read-only" : "read-write"));747 VDIsReadOnly(pThis->pDisk) ? "read-only" : "read-write")); 748 748 else 749 749 { … … 765 765 if (RT_FAILURE(rc)) 766 766 { 767 if (VALID_PTR(p Data->pDisk))768 { 769 VDDestroy(p Data->pDisk);770 p Data->pDisk = NULL;767 if (VALID_PTR(pThis->pDisk)) 768 { 769 VDDestroy(pThis->pDisk); 770 pThis->pDisk = NULL; 771 771 } 772 772 if (VALID_PTR(pszName)) … … 780 780 * it. 781 781 */ 782 p Data->fAsyncIOSupported = true;783 for (unsigned i = 0; i < VDGetCount(p Data->pDisk); i++)782 pThis->fAsyncIOSupported = true; 783 for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++) 784 784 { 785 785 VDBACKENDINFO vdBackendInfo; 786 786 787 rc = VDBackendInfoSingle(p Data->pDisk, i, &vdBackendInfo);787 rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo); 788 788 AssertRC(rc); 789 789 … … 794 794 * Check if current file is supported with async I/O) 795 795 */ 796 rc = VDImageIsAsyncIOSupported(p Data->pDisk, i, &pData->fAsyncIOSupported);796 rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported); 797 797 AssertRC(rc); 798 798 … … 802 802 * at least one does not support it. 803 803 */ 804 if (!p Data->fAsyncIOSupported)804 if (!pThis->fAsyncIOSupported) 805 805 break; 806 806 } 807 807 else 808 808 { 809 p Data->fAsyncIOSupported = false;809 pThis->fAsyncIOSupported = false; 810 810 break; 811 811 } … … 813 813 814 814 /* Create cache if async I/O is supported. */ 815 if (p Data->fAsyncIOSupported)816 { 817 rc = RTCacheCreate(&p Data->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT);815 if (pThis->fAsyncIOSupported) 816 { 817 rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT); 818 818 AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Vrc\n", rc)); 819 819 } … … 834 834 { 835 835 int rc; 836 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);837 LogFlow(("%s:\n", __FUNCTION__)); 838 839 if (p Data->pCache)840 { 841 rc = RTCacheDestroy(p Data->pCache);836 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 837 LogFlow(("%s:\n", __FUNCTION__)); 838 839 if (pThis->pCache) 840 { 841 rc = RTCacheDestroy(pThis->pCache); 842 842 AssertRC(rc); 843 843 } … … 855 855 { 856 856 LogFlow(("%s:\n", __FUNCTION__)); 857 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);858 if (!VDIsReadOnly(p Data->pDisk))857 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 858 if (!VDIsReadOnly(pThis->pDisk)) 859 859 { 860 860 unsigned uOpenFlags; 861 int rc = VDGetOpenFlags(p Data->pDisk, VD_LAST_IMAGE, &uOpenFlags);861 int rc = VDGetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, &uOpenFlags); 862 862 AssertRC(rc); 863 863 uOpenFlags |= VD_OPEN_FLAGS_READONLY; 864 rc = VDSetOpenFlags(p Data->pDisk, VD_LAST_IMAGE, uOpenFlags);864 rc = VDSetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, uOpenFlags); 865 865 AssertRC(rc); 866 p Data->fTempReadOnly = true;866 pThis->fTempReadOnly = true; 867 867 } 868 868 } … … 877 877 { 878 878 LogFlow(("%s:\n", __FUNCTION__)); 879 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);880 if (p Data->fTempReadOnly)879 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 880 if (pThis->fTempReadOnly) 881 881 { 882 882 unsigned uOpenFlags; 883 int rc = VDGetOpenFlags(p Data->pDisk, VD_LAST_IMAGE, &uOpenFlags);883 int rc = VDGetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, &uOpenFlags); 884 884 AssertRC(rc); 885 885 uOpenFlags &= ~VD_OPEN_FLAGS_READONLY; 886 rc = VDSetOpenFlags(p Data->pDisk, VD_LAST_IMAGE, uOpenFlags);886 rc = VDSetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, uOpenFlags); 887 887 AssertRC(rc); 888 p Data->fTempReadOnly = false;888 pThis->fTempReadOnly = false; 889 889 } 890 890 } … … 893 893 { 894 894 LogFlow(("%s:\n", __FUNCTION__)); 895 PVBOXDISK p Data= PDMINS_2_DATA(pDrvIns, PVBOXDISK);895 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 896 896 897 897 /* … … 900 900 * async transport driver is destructed. 901 901 */ 902 int rc = VDCloseAll(p Data->pDisk);902 int rc = VDCloseAll(pThis->pDisk); 903 903 AssertRC(rc); 904 904 }
Note:
See TracChangeset
for help on using the changeset viewer.