- Timestamp:
- Oct 21, 2021 2:26:20 PM (3 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r91937 r91955 128 128 typedef struct DRVVDSTORAGEBACKEND 129 129 { 130 /** The virtual disk driver instance. */ 131 PVBOXDISK pVD; 130 132 /** PDM async completion end point. */ 131 133 PPDMASYNCCOMPLETIONENDPOINT pEndpoint; … … 647 649 if (pStorageBackend) 648 650 { 651 pStorageBackend->pVD = pThis; 649 652 pStorageBackend->fSyncIoPending = false; 650 653 pStorageBackend->rcReqLast = VINF_SUCCESS; … … 670 673 fFlags |= PDMACEP_FILE_FLAGS_HOST_CACHE_ENABLED; 671 674 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); 675 679 676 680 if (RT_SUCCESS(rc)) 677 681 { 678 682 if (pThis->pszBwGroup) 679 rc = PDM R3AsyncCompletionEpSetBwMgr(pStorageBackend->pEndpoint, pThis->pszBwGroup);683 rc = PDMDrvHlpAsyncCompletionEpSetBwMgr(pThis->pDrvIns, pStorageBackend->pEndpoint, pThis->pszBwGroup); 680 684 681 685 if (RT_SUCCESS(rc)) … … 687 691 } 688 692 689 PDM R3AsyncCompletionEpClose(pStorageBackend->pEndpoint);693 PDMDrvHlpAsyncCompletionEpClose(pThis->pDrvIns, pStorageBackend->pEndpoint); 690 694 } 691 695 692 PDM R3AsyncCompletionTemplateDestroy(pStorageBackend->pTemplate);696 PDMDrvHlpAsyncCompletionTemplateDestroy(pThis->pDrvIns, pStorageBackend->pTemplate); 693 697 } 694 698 RTSemEventDestroy(pStorageBackend->EventSem); … … 706 710 RT_NOREF(pvUser); 707 711 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 712 PVBOXDISK pThis = pStorageBackend->pVD; 708 713 709 714 /* … … 714 719 */ 715 720 716 PDM R3AsyncCompletionEpClose(pStorageBackend->pEndpoint);717 PDM R3AsyncCompletionTemplateDestroy(pStorageBackend->pTemplate);721 PDMDrvHlpAsyncCompletionEpClose(pThis->pDrvIns, pStorageBackend->pEndpoint); 722 PDMDrvHlpAsyncCompletionTemplateDestroy(pThis->pDrvIns, pStorageBackend->pTemplate); 718 723 RTSemEventDestroy(pStorageBackend->EventSem); 719 724 RTMemFree(pStorageBackend); … … 726 731 RT_NOREF(pvUser); 727 732 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 733 PVBOXDISK pThis = pStorageBackend->pVD; 728 734 RTSGSEG DataSeg; 729 735 PPDMASYNCCOMPLETIONTASK pTask; … … 734 740 DataSeg.pvSeg = pvBuf; 735 741 736 int rc = PDM R3AsyncCompletionEpRead(pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbRead, NULL, &pTask);742 int rc = PDMDrvHlpAsyncCompletionEpRead(pThis->pDrvIns, pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbRead, NULL, &pTask); 737 743 if (RT_FAILURE(rc)) 738 744 return rc; … … 758 764 RT_NOREF(pvUser); 759 765 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 766 PVBOXDISK pThis = pStorageBackend->pVD; 760 767 RTSGSEG DataSeg; 761 768 PPDMASYNCCOMPLETIONTASK pTask; … … 766 773 DataSeg.pvSeg = (void *)pvBuf; 767 774 768 int rc = PDM R3AsyncCompletionEpWrite(pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbWrite, NULL, &pTask);775 int rc = PDMDrvHlpAsyncCompletionEpWrite(pThis->pDrvIns, pStorageBackend->pEndpoint, uOffset, &DataSeg, 1, cbWrite, NULL, &pTask); 769 776 if (RT_FAILURE(rc)) 770 777 return rc; … … 789 796 RT_NOREF(pvUser); 790 797 PDRVVDSTORAGEBACKEND pStorageBackend = (PDRVVDSTORAGEBACKEND)pStorage; 798 PVBOXDISK pThis = pStorageBackend->pVD; 791 799 PPDMASYNCCOMPLETIONTASK pTask; 792 800 … … 796 804 Assert(!fOld); NOREF(fOld); 797 805 798 int rc = PDM R3AsyncCompletionEpFlush(pStorageBackend->pEndpoint, NULL, &pTask);806 int rc = PDMDrvHlpAsyncCompletionEpFlush(pThis->pDrvIns, pStorageBackend->pEndpoint, NULL, &pTask); 799 807 if (RT_FAILURE(rc)) 800 808 return rc; … … 820 828 RT_NOREF(pvUser); 821 829 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); 825 835 if (rc == VINF_AIO_TASK_PENDING) 826 836 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; … … 836 846 RT_NOREF(pvUser); 837 847 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); 841 853 if (rc == VINF_AIO_TASK_PENDING) 842 854 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; … … 850 862 RT_NOREF(pvUser); 851 863 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); 855 868 if (rc == VINF_AIO_TASK_PENDING) 856 869 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; … … 863 876 RT_NOREF(pvUser); 864 877 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); 867 881 } 868 882 … … 871 885 RT_NOREF(pvUser); 872 886 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); 875 890 } 876 891 … … 2181 2196 2182 2197 AssertPtr(pThis->pBlkCache); 2183 PDM R3BlkCacheIoXferComplete(pThis->pBlkCache, (PPDMBLKCACHEIOXFER)pvUser2, rcReq);2198 PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, (PPDMBLKCACHEIOXFER)pvUser2, rcReq); 2184 2199 } 2185 2200 … … 2223 2238 2224 2239 if (rc == VINF_VD_ASYNC_IO_FINISHED) 2225 PDM R3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, VINF_SUCCESS);2240 PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, VINF_SUCCESS); 2226 2241 else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) 2227 PDM R3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, rc);2242 PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, rc); 2228 2243 2229 2244 return VINF_SUCCESS; … … 2241 2256 2242 2257 if (rc == VINF_VD_ASYNC_IO_FINISHED) 2243 PDM R3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, VINF_SUCCESS);2258 PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, VINF_SUCCESS); 2244 2259 else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) 2245 PDM R3BlkCacheIoXferComplete(pThis->pBlkCache, hIoXfer, rc);2260 PDMDrvHlpBlkCacheIoXferComplete(pThis->pDrvIns, pThis->pBlkCache, hIoXfer, rc); 2246 2261 2247 2262 return VINF_SUCCESS; … … 2735 2750 if (pThis->pBlkCache) 2736 2751 { 2737 rc = PDM R3BlkCacheRead(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); 2739 2754 if (rc == VINF_SUCCESS) 2740 2755 rc = VINF_VD_ASYNC_IO_FINISHED; … … 2784 2799 if (pThis->pBlkCache) 2785 2800 { 2786 rc = PDM R3BlkCacheWrite(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); 2788 2803 if (rc == VINF_SUCCESS) 2789 2804 rc = VINF_VD_ASYNC_IO_FINISHED; … … 2847 2862 if (pThis->pBlkCache) 2848 2863 { 2849 rc = PDM R3BlkCacheFlush(pThis->pBlkCache, pIoReq);2864 rc = PDMDrvHlpBlkCacheFlush(pThis->pDrvIns, pThis->pBlkCache, pIoReq); 2850 2865 if (rc == VINF_SUCCESS) 2851 2866 rc = VINF_VD_ASYNC_IO_FINISHED; … … 2893 2908 if (pThis->pBlkCache) 2894 2909 { 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); 2896 2913 if (rc == VINF_SUCCESS) 2897 2914 rc = VINF_VD_ASYNC_IO_FINISHED; … … 4267 4284 if (RT_VALID_PTR(pThis->pBlkCache)) 4268 4285 { 4269 PDM R3BlkCacheRelease(pThis->pBlkCache);4286 PDMDrvHlpBlkCacheRelease(pThis->pDrvIns, pThis->pBlkCache); 4270 4287 pThis->pBlkCache = NULL; 4271 4288 } … … 4317 4334 if (pThis->pBlkCache) 4318 4335 { 4319 int rc = PDM R3BlkCacheResume(pThis->pBlkCache);4336 int rc = PDMDrvHlpBlkCacheResume(pThis->pDrvIns, pThis->pBlkCache); 4320 4337 AssertRC(rc); 4321 4338 } … … 4424 4441 if (pThis->pBlkCache) 4425 4442 { 4426 int rc = PDM R3BlkCacheSuspend(pThis->pBlkCache);4443 int rc = PDMDrvHlpBlkCacheSuspend(pThis->pDrvIns, pThis->pBlkCache); 4427 4444 AssertRC(rc); 4428 4445 } … … 4452 4469 if (pThis->pBlkCache) 4453 4470 { 4454 int rc = PDM R3BlkCacheClear(pThis->pBlkCache);4471 int rc = PDMDrvHlpBlkCacheClear(pThis->pDrvIns, pThis->pBlkCache); 4455 4472 AssertRC(rc); 4456 4473 } -
trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp
r91945 r91955 2238 2238 PDMR3ThreadResume, 2239 2239 pdmR3DrvHlp_AsyncCompletionTemplateCreate, 2240 PDMR3AsyncCompletionTemplateDestroy, 2241 PDMR3AsyncCompletionEpCreateForFile, 2242 PDMR3AsyncCompletionEpClose, 2243 PDMR3AsyncCompletionEpGetSize, 2244 PDMR3AsyncCompletionEpSetSize, 2245 PDMR3AsyncCompletionEpSetBwMgr, 2246 PDMR3AsyncCompletionEpFlush, 2247 PDMR3AsyncCompletionEpRead, 2248 PDMR3AsyncCompletionEpWrite, 2240 2249 pdmR3DrvHlp_NetShaperAttach, 2241 2250 pdmR3DrvHlp_NetShaperDetach, … … 2258 2267 pdmR3DrvHlp_CallR0, 2259 2268 pdmR3DrvHlp_BlkCacheRetain, 2269 PDMR3BlkCacheRelease, 2270 PDMR3BlkCacheClear, 2271 PDMR3BlkCacheSuspend, 2272 PDMR3BlkCacheResume, 2273 PDMR3BlkCacheIoXferComplete, 2274 PDMR3BlkCacheRead, 2275 PDMR3BlkCacheWrite, 2276 PDMR3BlkCacheFlush, 2277 PDMR3BlkCacheDiscard, 2260 2278 pdmR3DrvHlp_VMGetSuspendReason, 2261 2279 pdmR3DrvHlp_VMGetResumeReason,
Note:
See TracChangeset
for help on using the changeset viewer.