VirtualBox

Changeset 91955 in vbox for trunk/src


Ignore:
Timestamp:
Oct 21, 2021 2:26:20 PM (3 years ago)
Author:
vboxsync
Message:

VMM,Devices: Eliminate direct calls to PDMR3AsyncCompletion* and PDMR3BlkCache* and use the device helper callbacks, bugref:10074 [build fix]

Location:
trunk/src/VBox
Files:
2 edited

Legend:

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

    r91937 r91955  
    128128typedef struct DRVVDSTORAGEBACKEND
    129129{
     130    /** The virtual disk driver instance. */
     131    PVBOXDISK                   pVD;
    130132    /** PDM async completion end point. */
    131133    PPDMASYNCCOMPLETIONENDPOINT pEndpoint;
     
    647649    if (pStorageBackend)
    648650    {
     651        pStorageBackend->pVD            = pThis;
    649652        pStorageBackend->fSyncIoPending = false;
    650653        pStorageBackend->rcReqLast      = VINF_SUCCESS;
     
    670673                    fFlags |= PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED;
    671674
    672                 rc = PDMR3AsyncCompletionEpCreateForFile(&pStorageBackend->pEndpoint,
    673                                                          pszLocation, fFlags,
    674                                                          pStorageBackend->pTemplate);
     675                rc = PDMDrvHlpAsyncCompletionEpCreateForFile(pThis->pDrvIns,
     676                                                             &pStorageBackend->pEndpoint,
     677                                                             pszLocation, fFlags,
     678                                                             pStorageBackend->pTemplate);
    675679
    676680                if (RT_SUCCESS(rc))
    677681                {
    678682                    if (pThis->pszBwGroup)
    679                         rc = PDMR3AsyncCompletionEpSetBwMgr(pStorageBackend->pEndpoint, pThis->pszBwGroup);
     683                        rc = PDMDrvHlpAsyncCompletionEpSetBwMgr(pThis->pDrvIns, pStorageBackend->pEndpoint, pThis->pszBwGroup);
    680684
    681685                    if (RT_SUCCESS(rc))
     
    687691                    }
    688692
    689                     PDMR3AsyncCompletionEpClose(pStorageBackend->pEndpoint);
     693                    PDMDrvHlpAsyncCompletionEpClose(pThis->pDrvIns, pStorageBackend->pEndpoint);
    690694                }
    691695
    692                 PDMR3AsyncCompletionTemplateDestroy(pStorageBackend->pTemplate);
     696                PDMDrvHlpAsyncCompletionTemplateDestroy(pThis->pDrvIns, pStorageBackend->pTemplate);
    693697            }
    694698            RTSemEventDestroy(pStorageBackend->EventSem);
     
    706710    RT_NOREF(pvUser);
    707711    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
     712    PVBOXDISK pThis = pStorageBackend->pVD;
    708713
    709714    /*
     
    714719     */
    715720
    716     PDMR3AsyncCompletionEpClose(pStorageBackend->pEndpoint);
    717     PDMR3AsyncCompletionTemplateDestroy(pStorageBackend->pTemplate);
     721    PDMDrvHlpAsyncCompletionEpClose(pThis->pDrvIns, pStorageBackend->pEndpoint);
     722    PDMDrvHlpAsyncCompletionTemplateDestroy(pThis->pDrvIns, pStorageBackend->pTemplate);
    718723    RTSemEventDestroy(pStorageBackend->EventSem);
    719724    RTMemFree(pStorageBackend);
     
    726731    RT_NOREF(pvUser);
    727732    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
     733    PVBOXDISK pThis = pStorageBackend->pVD;
    728734    RTSGSEG DataSeg;
    729735    PPDMASYNCCOMPLETIONTASK pTask;
     
    734740    DataSeg.pvSeg = pvBuf;
    735741
    736     int rc = PDMR3AsyncCompletionEpRead(pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbRead, NULL, &pTask);
     742    int rc = PDMDrvHlpAsyncCompletionEpRead(pThis->pDrvIns, pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbRead, NULL, &pTask);
    737743    if (RT_FAILURE(rc))
    738744        return rc;
     
    758764    RT_NOREF(pvUser);
    759765    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
     766    PVBOXDISK pThis = pStorageBackend->pVD;
    760767    RTSGSEG DataSeg;
    761768    PPDMASYNCCOMPLETIONTASK pTask;
     
    766773    DataSeg.pvSeg = (void *)pvBuf;
    767774
    768     int rc = PDMR3AsyncCompletionEpWrite(pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbWrite, NULL, &pTask);
     775    int rc = PDMDrvHlpAsyncCompletionEpWrite(pThis->pDrvIns, pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbWrite, NULL, &pTask);
    769776    if (RT_FAILURE(rc))
    770777        return rc;
     
    789796    RT_NOREF(pvUser);
    790797    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
     798    PVBOXDISK pThis = pStorageBackend->pVD;
    791799    PPDMASYNCCOMPLETIONTASK pTask;
    792800
     
    796804    Assert(!fOld); NOREF(fOld);
    797805
    798     int rc = PDMR3AsyncCompletionEpFlush(pStorageBackend->pEndpoint, NULL, &pTask);
     806    int rc = PDMDrvHlpAsyncCompletionEpFlush(pThis->pDrvIns, pStorageBackend->pEndpoint, NULL, &pTask);
    799807    if (RT_FAILURE(rc))
    800808        return rc;
     
    820828    RT_NOREF(pvUser);
    821829    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
    822 
    823     int rc = PDMR3AsyncCompletionEpRead(pStorageBackend->pEndpoint, uOffset, paSegments, (unsigned)cSegments, cbRead,
    824                                         pvCompletion, (PPPDMASYNCCOMPLETIONTASK)ppTask);
     830    PVBOXDISK pThis = pStorageBackend->pVD;
     831
     832    int rc = PDMDrvHlpAsyncCompletionEpRead(pThis->pDrvIns, pStorageBackend->pEndpoint,
     833                                            uOffset, paSegments, (unsigned)cSegments, cbRead,
     834                                            pvCompletion, (PPPDMASYNCCOMPLETIONTASK)ppTask);
    825835    if (rc == VINF_AIO_TASK_PENDING)
    826836        rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
     
    836846    RT_NOREF(pvUser);
    837847    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
    838 
    839     int rc = PDMR3AsyncCompletionEpWrite(pStorageBackend->pEndpoint, uOffset, paSegments, (unsigned)cSegments, cbWrite,
    840                                          pvCompletion, (PPPDMASYNCCOMPLETIONTASK)ppTask);
     848    PVBOXDISK pThis = pStorageBackend->pVD;
     849
     850    int rc = PDMDrvHlpAsyncCompletionEpWrite(pThis->pDrvIns, pStorageBackend->pEndpoint,
     851                                             uOffset, paSegments, (unsigned)cSegments, cbWrite,
     852                                             pvCompletion, (PPPDMASYNCCOMPLETIONTASK)ppTask);
    841853    if (rc == VINF_AIO_TASK_PENDING)
    842854        rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
     
    850862    RT_NOREF(pvUser);
    851863    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
    852 
    853     int rc = PDMR3AsyncCompletionEpFlush(pStorageBackend->pEndpoint, pvCompletion,
    854                                          (PPPDMASYNCCOMPLETIONTASK)ppTask);
     864    PVBOXDISK pThis = pStorageBackend->pVD;
     865
     866    int rc = PDMDrvHlpAsyncCompletionEpFlush(pThis->pDrvIns, pStorageBackend->pEndpoint, pvCompletion,
     867                                             (PPPDMASYNCCOMPLETIONTASK)ppTask);
    855868    if (rc == VINF_AIO_TASK_PENDING)
    856869        rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
     
    863876    RT_NOREF(pvUser);
    864877    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
    865 
    866     return PDMR3AsyncCompletionEpGetSize(pStorageBackend->pEndpoint, pcbSize);
     878    PVBOXDISK pThis = pStorageBackend->pVD;
     879
     880    return PDMDrvHlpAsyncCompletionEpGetSize(pThis->pDrvIns, pStorageBackend->pEndpoint, pcbSize);
    867881}
    868882
     
    871885    RT_NOREF(pvUser);
    872886    PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage;
    873 
    874     return PDMR3AsyncCompletionEpSetSize(pStorageBackend->pEndpoint, cbSize);
     887    PVBOXDISK pThis = pStorageBackend->pVD;
     888
     889    return PDMDrvHlpAsyncCompletionEpSetSize(pThis->pDrvIns, pStorageBackend->pEndpoint, cbSize);
    875890}
    876891
     
    21812196
    21822197    AssertPtr(pThis->pBlkCache);
    2183     PDMR3BlkCacheIoXferComplete(pThis->pBlkCache, (PPDMBLKCACHEIOXFER)pvUser2, rcReq);
     2198    PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, (PPDMBLKCACHEIOXFER)pvUser2, rcReq);
    21842199}
    21852200
     
    22232238
    22242239    if (rc == VINF_VD_ASYNC_IO_FINISHED)
    2225         PDMR3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, VINF_SUCCESS);
     2240        PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, VINF_SUCCESS);
    22262241    else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
    2227         PDMR3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, rc);
     2242        PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, rc);
    22282243
    22292244    return VINF_SUCCESS;
     
    22412256
    22422257    if (rc == VINF_VD_ASYNC_IO_FINISHED)
    2243         PDMR3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, VINF_SUCCESS);
     2258        PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, VINF_SUCCESS);
    22442259    else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
    2245         PDMR3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, rc);
     2260        PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, rc);
    22462261
    22472262    return VINF_SUCCESS;
     
    27352750        if (pThis->pBlkCache)
    27362751        {
    2737             rc = PDMR3BlkCacheRead(pThis->pBlkCache, pIoReq->ReadWrite.offStart,
    2738                                    pIoReq->ReadWrite.pSgBuf, cbReqIo, pIoReq);
     2752            rc = PDMDrvHlpBlkCacheRead(pThis->pDrvIns, pThis->pBlkCache, pIoReq->ReadWrite.offStart,
     2753                                       pIoReq->ReadWrite.pSgBuf, cbReqIo, pIoReq);
    27392754            if (rc == VINF_SUCCESS)
    27402755                rc = VINF_VD_ASYNC_IO_FINISHED;
     
    27842799        if (pThis->pBlkCache)
    27852800        {
    2786             rc = PDMR3BlkCacheWrite(pThis->pBlkCache, pIoReq->ReadWrite.offStart,
    2787                                     pIoReq->ReadWrite.pSgBuf, cbReqIo, pIoReq);
     2801            rc = PDMDrvHlpBlkCacheWrite(pThis->pDrvIns, pThis->pBlkCache, pIoReq->ReadWrite.offStart,
     2802                                        pIoReq->ReadWrite.pSgBuf, cbReqIo, pIoReq);
    27882803            if (rc == VINF_SUCCESS)
    27892804                rc = VINF_VD_ASYNC_IO_FINISHED;
     
    28472862            if (pThis->pBlkCache)
    28482863            {
    2849                 rc = PDMR3BlkCacheFlush(pThis->pBlkCache, pIoReq);
     2864                rc = PDMDrvHlpBlkCacheFlush(pThis->pDrvIns, pThis->pBlkCache, pIoReq);
    28502865                if (rc == VINF_SUCCESS)
    28512866                    rc = VINF_VD_ASYNC_IO_FINISHED;
     
    28932908        if (pThis->pBlkCache)
    28942909        {
    2895             rc = PDMR3BlkCacheDiscard(pThis->pBlkCache, pIoReq->Discard.paRanges, pIoReq->Discard.cRanges, pIoReq);
     2910            rc = PDMDrvHlpBlkCacheDiscard(pThis->pDrvIns, pThis->pBlkCache,
     2911                                          pIoReq->Discard.paRanges, pIoReq->Discard.cRanges,
     2912                                          pIoReq);
    28962913            if (rc == VINF_SUCCESS)
    28972914                rc = VINF_VD_ASYNC_IO_FINISHED;
     
    42674284    if (RT_VALID_PTR(pThis->pBlkCache))
    42684285    {
    4269         PDMR3BlkCacheRelease(pThis->pBlkCache);
     4286        PDMDrvHlpBlkCacheRelease(pThis->pDrvIns, pThis->pBlkCache);
    42704287        pThis->pBlkCache = NULL;
    42714288    }
     
    43174334    if (pThis->pBlkCache)
    43184335    {
    4319         int rc = PDMR3BlkCacheResume(pThis->pBlkCache);
     4336        int rc = PDMDrvHlpBlkCacheResume(pThis->pDrvIns, pThis->pBlkCache);
    43204337        AssertRC(rc);
    43214338    }
     
    44244441    if (pThis->pBlkCache)
    44254442    {
    4426         int rc = PDMR3BlkCacheSuspend(pThis->pBlkCache);
     4443        int rc = PDMDrvHlpBlkCacheSuspend(pThis->pDrvIns, pThis->pBlkCache);
    44274444        AssertRC(rc);
    44284445    }
     
    44524469    if (pThis->pBlkCache)
    44534470    {
    4454         int rc = PDMR3BlkCacheClear(pThis->pBlkCache);
     4471        int rc = PDMDrvHlpBlkCacheClear(pThis->pDrvIns, pThis->pBlkCache);
    44554472        AssertRC(rc);
    44564473    }
  • trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp

    r91945 r91955  
    22382238    PDMR3ThreadResume,
    22392239    pdmR3DrvHlp_AsyncCompletionTemplateCreate,
     2240    PDMR3AsyncCompletionTemplateDestroy,
     2241    PDMR3AsyncCompletionEpCreateForFile,
     2242    PDMR3AsyncCompletionEpClose,
     2243    PDMR3AsyncCompletionEpGetSize,
     2244    PDMR3AsyncCompletionEpSetSize,
     2245    PDMR3AsyncCompletionEpSetBwMgr,
     2246    PDMR3AsyncCompletionEpFlush,
     2247    PDMR3AsyncCompletionEpRead,
     2248    PDMR3AsyncCompletionEpWrite,
    22402249    pdmR3DrvHlp_NetShaperAttach,
    22412250    pdmR3DrvHlp_NetShaperDetach,
     
    22582267    pdmR3DrvHlp_CallR0,
    22592268    pdmR3DrvHlp_BlkCacheRetain,
     2269    PDMR3BlkCacheRelease,
     2270    PDMR3BlkCacheClear,
     2271    PDMR3BlkCacheSuspend,
     2272    PDMR3BlkCacheResume,
     2273    PDMR3BlkCacheIoXferComplete,
     2274    PDMR3BlkCacheRead,
     2275    PDMR3BlkCacheWrite,
     2276    PDMR3BlkCacheFlush,
     2277    PDMR3BlkCacheDiscard,
    22602278    pdmR3DrvHlp_VMGetSuspendReason,
    22612279    pdmR3DrvHlp_VMGetResumeReason,
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