VirtualBox

Ignore:
Timestamp:
Aug 8, 2008 4:24:48 PM (16 years ago)
Author:
vboxsync
Message:

Devices: pData -> pThis.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r11267 r11269  
    276276    LogFlow(("%s: off=%#llx pvBuf=%p cbRead=%d\n", __FUNCTION__,
    277277             off, pvBuf, cbRead));
    278     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    279     int rc = VDRead(pData->pDisk, off, pvBuf, cbRead);
     278    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     279    int rc = VDRead(pThis->pDisk, off, pvBuf, cbRead);
    280280    if (RT_SUCCESS(rc))
    281281        Log2(("%s: off=%#llx pvBuf=%p cbRead=%d %.*Vhxd\n", __FUNCTION__,
     
    292292    LogFlow(("%s: off=%#llx pvBuf=%p cbWrite=%d\n", __FUNCTION__,
    293293             off, pvBuf, cbWrite));
    294     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
     294    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
    295295    Log2(("%s: off=%#llx pvBuf=%p cbWrite=%d %.*Vhxd\n", __FUNCTION__,
    296296          off, pvBuf, cbWrite, cbWrite, pvBuf));
    297     int rc = VDWrite(pData->pDisk, off, pvBuf, cbWrite);
     297    int rc = VDWrite(pThis->pDisk, off, pvBuf, cbWrite);
    298298    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    299299    return rc;
     
    304304{
    305305    LogFlow(("%s:\n", __FUNCTION__));
    306     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    307     int rc = VDFlush(pData->pDisk);
     306    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     307    int rc = VDFlush(pThis->pDisk);
    308308    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    309309    return rc;
     
    314314{
    315315    LogFlow(("%s:\n", __FUNCTION__));
    316     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    317     uint64_t cb = VDGetSize(pData->pDisk, VD_LAST_IMAGE);
     316    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     317    uint64_t cb = VDGetSize(pThis->pDisk, VD_LAST_IMAGE);
    318318    LogFlow(("%s: returns %#llx (%llu)\n", __FUNCTION__, cb, cb));
    319319    return cb;
     
    324324{
    325325    LogFlow(("%s:\n", __FUNCTION__));
    326     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    327     bool f = VDIsReadOnly(pData->pDisk);
     326    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     327    bool f = VDIsReadOnly(pThis->pDisk);
    328328    LogFlow(("%s: returns %d\n", __FUNCTION__, f));
    329329    return f;
     
    335335{
    336336    LogFlow(("%s:\n", __FUNCTION__));
    337     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    338     int rc = VDGetPCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
     337    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     338    int rc = VDGetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
    339339    if (RT_FAILURE(rc))
    340340    {
     
    353353    LogFlow(("%s: CHS=%d/%d/%d\n", __FUNCTION__,
    354354             pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
    355     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    356     int rc = VDSetPCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
     355    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     356    int rc = VDSetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
    357357    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    358358    return rc;
     
    364364{
    365365    LogFlow(("%s:\n", __FUNCTION__));
    366     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    367     int rc = VDGetLCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
     366    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     367    int rc = VDGetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
    368368    if (RT_FAILURE(rc))
    369369    {
     
    382382    LogFlow(("%s: CHS=%d/%d/%d\n", __FUNCTION__,
    383383             pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
    384     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    385     int rc = VDSetLCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
     384    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     385    int rc = VDSetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
    386386    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    387387    return rc;
     
    392392{
    393393    LogFlow(("%s:\n", __FUNCTION__));
    394     PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    395     int rc = VDGetUuid(pData->pDisk, 0, pUuid);
     394    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
     395    int rc = VDGetUuid(pThis->pDisk, 0, pUuid);
    396396    LogFlow(("%s: returns %Vrc ({%Vuuid})\n", __FUNCTION__, rc, pUuid));
    397397    return rc;
     
    408408     LogFlow(("%s: uOffset=%#llx paSeg=%#p cSeg=%u cbRead=%d\n pvUser=%#p", __FUNCTION__,
    409409             uOffset, paSeg, cSeg, cbRead, pvUser));
    410     PVBOXDISK pData = PDMIMEDIAASYNC_2_VBOXDISK(pInterface);
    411     int rc = VDAsyncRead(pData->pDisk, uOffset, cbRead, paSeg, cSeg, pvUser);
     410    PVBOXDISK pThis = PDMIMEDIAASYNC_2_VBOXDISK(pInterface);
     411    int rc = VDAsyncRead(pThis->pDisk, uOffset, cbRead, paSeg, cSeg, pvUser);
    412412    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    413413    return rc;
     
    420420     LogFlow(("%s: uOffset=%#llx paSeg=%#p cSeg=%u cbWrite=%d\n pvUser=%#p", __FUNCTION__,
    421421             uOffset, paSeg, cSeg, cbWrite, pvUser));
    422     PVBOXDISK pData = PDMIMEDIAASYNC_2_VBOXDISK(pInterface);
    423     int rc = VDAsyncWrite(pData->pDisk, uOffset, cbWrite, paSeg, cSeg, pvUser);
     422    PVBOXDISK pThis = PDMIMEDIAASYNC_2_VBOXDISK(pInterface);
     423    int rc = VDAsyncWrite(pThis->pDisk, uOffset, cbWrite, paSeg, cSeg, pvUser);
    424424    LogFlow(("%s: returns %Vrc\n", __FUNCTION__, rc));
    425425    return rc;
     
    432432static DECLCALLBACK(int) drvvdTasksCompleteNotify(PPDMITRANSPORTASYNCPORT pInterface, void *pvUser)
    433433{
    434     PVBOXDISK pData = PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface);
     434    PVBOXDISK pThis = PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface);
    435435    PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser;
    436436    int rc = VINF_VDI_ASYNC_IO_FINISHED;
     
    443443    if (rc == VINF_VDI_ASYNC_IO_FINISHED)
    444444    {
    445         rc = pData->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pData->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller);
     445        rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller);
    446446    }
    447447    else if (rc == VERR_VDI_ASYNC_IO_IN_PROGRESS)
    448448        rc = VINF_SUCCESS;
    449449
    450     rc = RTCacheInsert(pData->pCache, pDrvVDAsyncTask);
     450    rc = RTCacheInsert(pThis->pCache, pDrvVDAsyncTask);
    451451    AssertRC(rc);
    452452
     
    464464{
    465465    PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    466     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     466    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    467467    switch (enmInterface)
    468468    {
     
    470470            return &pDrvIns->IBase;
    471471        case PDMINTERFACE_MEDIA:
    472             return &pData->IMedia;
     472            return &pThis->IMedia;
    473473        case PDMINTERFACE_MEDIA_ASYNC:
    474             return pData->fAsyncIOSupported ? &pData->IMediaAsync : NULL;
     474            return pThis->fAsyncIOSupported ? &pThis->IMediaAsync : NULL;
    475475        case PDMINTERFACE_TRANSPORT_ASYNC_PORT:
    476             return &pData->ITransportAsyncPort;
     476            return &pThis->ITransportAsyncPort;
    477477        default:
    478478            return NULL;
     
    500500{
    501501    LogFlow(("%s:\n", __FUNCTION__));
    502     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     502    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    503503    int rc = VINF_SUCCESS;
    504504    char *pszName = NULL;   /**< The path of the disk image file. */
     
    511511     */
    512512    pDrvIns->IBase.pfnQueryInterface    = drvvdQueryInterface;
    513     pData->pDrvIns                      = pDrvIns;
    514     pData->fTempReadOnly                = false;
    515     pData->pDisk                        = NULL;
     513    pThis->pDrvIns                      = pDrvIns;
     514    pThis->fTempReadOnly                = false;
     515    pThis->pDisk                        = NULL;
    516516
    517517    /* IMedia */
    518     pData->IMedia.pfnRead               = drvvdRead;
    519     pData->IMedia.pfnWrite              = drvvdWrite;
    520     pData->IMedia.pfnFlush              = drvvdFlush;
    521     pData->IMedia.pfnGetSize            = drvvdGetSize;
    522     pData->IMedia.pfnIsReadOnly         = drvvdIsReadOnly;
    523     pData->IMedia.pfnBiosGetPCHSGeometry = drvvdBiosGetPCHSGeometry;
    524     pData->IMedia.pfnBiosSetPCHSGeometry = drvvdBiosSetPCHSGeometry;
    525     pData->IMedia.pfnBiosGetLCHSGeometry = drvvdBiosGetLCHSGeometry;
    526     pData->IMedia.pfnBiosSetLCHSGeometry = drvvdBiosSetLCHSGeometry;
    527     pData->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;
    528528
    529529    /* IMediaAsync */
    530     pData->IMediaAsync.pfnStartRead       = drvvdStartRead;
    531     pData->IMediaAsync.pfnStartWrite      = drvvdStartWrite;
     530    pThis->IMediaAsync.pfnStartRead       = drvvdStartRead;
     531    pThis->IMediaAsync.pfnStartWrite      = drvvdStartWrite;
    532532
    533533    /* ITransportAsyncPort */
    534     pData->ITransportAsyncPort.pfnTaskCompleteNotify  = drvvdTasksCompleteNotify;
     534    pThis->ITransportAsyncPort.pfnTaskCompleteNotify  = drvvdTasksCompleteNotify;
    535535
    536536    /* Initialize supported VD interfaces. */
    537     pData->VDIErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    538     pData->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    539     pData->VDIErrorCallbacks.pfnError     = drvvdErrorCallback;
    540 
    541     rc = VDInterfaceCreate(&pData->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR,
    542                            &pData->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);
    543543    AssertRC(rc);
    544544
    545     pData->VDIAsyncIOCallbacks.cbSize                  = sizeof(VDINTERFACEASYNCIO);
    546     pData->VDIAsyncIOCallbacks.enmInterface            = VDINTERFACETYPE_ASYNCIO;
    547     pData->VDIAsyncIOCallbacks.pfnOpen                 = drvvdAsyncIOOpen;
    548     pData->VDIAsyncIOCallbacks.pfnClose                = drvvdAsyncIOClose;
    549     pData->VDIAsyncIOCallbacks.pfnRead                 = drvvdAsyncIORead;
    550     pData->VDIAsyncIOCallbacks.pfnWrite                = drvvdAsyncIOWrite;
    551     pData->VDIAsyncIOCallbacks.pfnFlush                = drvvdAsyncIOFlush;
    552     pData->VDIAsyncIOCallbacks.pfnPrepareRead          = drvvdAsyncIOPrepareRead;
    553     pData->VDIAsyncIOCallbacks.pfnPrepareWrite         = drvvdAsyncIOPrepareWrite;
    554     pData->VDIAsyncIOCallbacks.pfnTasksSubmit          = drvvdAsyncIOTasksSubmit;
    555 
    556     rc = VDInterfaceCreate(&pData->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO,
    557                            &pData->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);
    558558    AssertRC(rc);
    559559
    560     pData->VDIConfigCallbacks.cbSize                = sizeof(VDINTERFACECONFIG);
    561     pData->VDIConfigCallbacks.enmInterface          = VDINTERFACETYPE_CONFIG;
    562     pData->VDIConfigCallbacks.pfnAreValuesValid     = drvvdCfgAreValuesValid;
    563     pData->VDIConfigCallbacks.pfnQueryType          = drvvdCfgQueryType;
    564     pData->VDIConfigCallbacks.pfnQuerySize          = drvvdCfgQuerySize;
    565     pData->VDIConfigCallbacks.pfnQueryInteger       = drvvdCfgQueryInteger;
    566     pData->VDIConfigCallbacks.pfnQueryIntegerDef    = drvvdCfgQueryIntegerDef;
    567     pData->VDIConfigCallbacks.pfnQueryString        = drvvdCfgQueryString;
    568     pData->VDIConfigCallbacks.pfnQueryStringDef     = drvvdCfgQueryStringDef;
    569     pData->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;
    570570
    571571    /** @todo TEMP! this isn't really correct - this needs to be made per image,
     
    573573     * At the moment this is harmless, as iSCSI can only be used as a base
    574574     * image, and no other backend uses the private data for these callbacks. */
    575     rc = VDInterfaceCreate(&pData->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
    576                            &pData->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pData->VDIAsyncIO);
     575    rc = VDInterfaceCreate(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
     576                           &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->VDIAsyncIO);
    577577    AssertRC(rc);
    578578
    579579    /* Try to attach async media port interface above.*/
    580     pData->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT);
     580    pThis->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT);
    581581
    582582    /*
     
    584584     * async interface.
    585585     */
    586     if (pData->pDrvMediaAsyncPort)
     586    if (pThis->pDrvMediaAsyncPort)
    587587    {
    588588        /* Try to attach the driver. */
     
    596596             * Revert to non async I/O.
    597597             */
    598             pData->pDrvMediaAsyncPort = NULL;
     598            pThis->pDrvMediaAsyncPort = NULL;
    599599        }
    600600        else if (RT_FAILURE(rc))
     
    605605        {
    606606            /* Success query the async transport interface. */
    607             pData->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC);
    608             if (!pData->pDrvTransportAsync)
     607            pThis->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC);
     608            if (!pThis->pDrvTransportAsync)
    609609            {
    610610                /* Whoops. */
     
    659659    {
    660660        /** @todo TEMP! later the iSCSI config callbacks won't be included here */
    661         rc = VDCreate(&pData->VDIConfig, &pData->pDisk);
     661        rc = VDCreate(&pThis->VDIConfig, &pThis->pDisk);
    662662        /* Error message is already set correctly. */
    663663    }
     
    717717        {
    718718            PCFGMNODE pCfg = CFGMR3GetChild(pCurNode, "VDConfig");
    719             pData->VDIConfig.pvUser = pCfg; /**< @todo TEMP! */
     719            pThis->VDIConfig.pvUser = pCfg; /**< @todo TEMP! */
    720720        }
    721721
     
    730730        if (fHonorZeroWrites)
    731731            uOpenFlags |= VD_OPEN_FLAGS_HONOR_ZEROES;
    732         if (pData->pDrvMediaAsyncPort)
     732        if (pThis->pDrvMediaAsyncPort)
    733733            uOpenFlags |= VD_OPEN_FLAGS_ASYNC_IO;
    734734
    735735        /** Try to open backend in asyc I/O mode first. */
    736         rc = VDOpen(pData->pDisk, pszFormat, pszName, uOpenFlags);
     736        rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags);
    737737        if (rc == VERR_NOT_SUPPORTED)
    738738        {
    739739            /* Seems async I/O is not supported by the backend, open in normal mode. */
    740740            uOpenFlags &= ~VD_OPEN_FLAGS_ASYNC_IO;
    741             rc = VDOpen(pData->pDisk, pszFormat, pszName, uOpenFlags);
     741            rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags);
    742742        }
    743743
     
    745745            Log(("%s: %d - Opened '%s' in %s mode\n", __FUNCTION__,
    746746                 iLevel, pszName,
    747                  VDIsReadOnly(pData->pDisk) ? "read-only" : "read-write"));
     747                 VDIsReadOnly(pThis->pDisk) ? "read-only" : "read-write"));
    748748        else
    749749        {
     
    765765    if (RT_FAILURE(rc))
    766766    {
    767         if (VALID_PTR(pData->pDisk))
    768         {
    769             VDDestroy(pData->pDisk);
    770             pData->pDisk = NULL;
     767        if (VALID_PTR(pThis->pDisk))
     768        {
     769            VDDestroy(pThis->pDisk);
     770            pThis->pDisk = NULL;
    771771        }
    772772        if (VALID_PTR(pszName))
     
    780780     * it.
    781781     */
    782     pData->fAsyncIOSupported = true;
    783     for (unsigned i = 0; i < VDGetCount(pData->pDisk); i++)
     782    pThis->fAsyncIOSupported = true;
     783    for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++)
    784784    {
    785785        VDBACKENDINFO vdBackendInfo;
    786786
    787         rc = VDBackendInfoSingle(pData->pDisk, i, &vdBackendInfo);
     787        rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo);
    788788        AssertRC(rc);
    789789
     
    794794             * Check if current file is supported with async I/O)
    795795             */
    796             rc = VDImageIsAsyncIOSupported(pData->pDisk, i, &pData->fAsyncIOSupported);
     796            rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported);
    797797            AssertRC(rc);
    798798
     
    802802             * at least one does not support it.
    803803             */
    804             if (!pData->fAsyncIOSupported)
     804            if (!pThis->fAsyncIOSupported)
    805805                break;
    806806        }
    807807        else
    808808        {
    809             pData->fAsyncIOSupported = false;
     809            pThis->fAsyncIOSupported = false;
    810810            break;
    811811        }
     
    813813
    814814    /* Create cache if async I/O is supported. */
    815     if (pData->fAsyncIOSupported)
    816     {
    817         rc = RTCacheCreate(&pData->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT);
     815    if (pThis->fAsyncIOSupported)
     816    {
     817        rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT);
    818818        AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Vrc\n", rc));
    819819    }
     
    834834{
    835835    int rc;
    836     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    837     LogFlow(("%s:\n", __FUNCTION__));
    838 
    839     if (pData->pCache)
    840     {
    841         rc = RTCacheDestroy(pData->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);
    842842        AssertRC(rc);
    843843    }
     
    855855{
    856856    LogFlow(("%s:\n", __FUNCTION__));
    857     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    858     if (!VDIsReadOnly(pData->pDisk))
     857    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     858    if (!VDIsReadOnly(pThis->pDisk))
    859859    {
    860860        unsigned uOpenFlags;
    861         int rc = VDGetOpenFlags(pData->pDisk, VD_LAST_IMAGE, &uOpenFlags);
     861        int rc = VDGetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, &uOpenFlags);
    862862        AssertRC(rc);
    863863        uOpenFlags |= VD_OPEN_FLAGS_READONLY;
    864         rc = VDSetOpenFlags(pData->pDisk, VD_LAST_IMAGE, uOpenFlags);
     864        rc = VDSetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, uOpenFlags);
    865865        AssertRC(rc);
    866         pData->fTempReadOnly = true;
     866        pThis->fTempReadOnly = true;
    867867    }
    868868}
     
    877877{
    878878    LogFlow(("%s:\n", __FUNCTION__));
    879     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    880     if (pData->fTempReadOnly)
     879    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     880    if (pThis->fTempReadOnly)
    881881    {
    882882        unsigned uOpenFlags;
    883         int rc = VDGetOpenFlags(pData->pDisk, VD_LAST_IMAGE, &uOpenFlags);
     883        int rc = VDGetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, &uOpenFlags);
    884884        AssertRC(rc);
    885885        uOpenFlags &= ~VD_OPEN_FLAGS_READONLY;
    886         rc = VDSetOpenFlags(pData->pDisk, VD_LAST_IMAGE, uOpenFlags);
     886        rc = VDSetOpenFlags(pThis->pDisk, VD_LAST_IMAGE, uOpenFlags);
    887887        AssertRC(rc);
    888         pData->fTempReadOnly = false;
     888        pThis->fTempReadOnly = false;
    889889    }
    890890}
     
    893893{
    894894    LogFlow(("%s:\n", __FUNCTION__));
    895     PVBOXDISK pData = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     895    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    896896
    897897    /*
     
    900900     * async transport driver is destructed.
    901901     */
    902     int rc = VDCloseAll(pData->pDisk);
     902    int rc = VDCloseAll(pThis->pDisk);
    903903    AssertRC(rc);
    904904}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette