- Timestamp:
- Feb 1, 2016 10:33:38 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmstorageifs.h
r59536 r59538 832 832 DECLR3CALLBACKMEMBER(uint32_t, pfnIoReqGetActiveCount, (PPDMIMEDIAEX pInterface)); 833 833 834 /** 835 * Returns the number of suspended requests. 836 * 837 * @returns Number of suspended I/O requests. 838 * @param pInterface Pointer to the interface structure containing the called function pointer. 839 * @thread Any thread. 840 */ 841 DECLR3CALLBACKMEMBER(uint32_t, pfnIoReqGetSuspendedCount, (PPDMIMEDIAEX pInterface)); 842 843 /** 844 * Gets the first suspended request handle. 845 * 846 * @returns VBox status code. 847 * @retval VERR_NOT_FOUND if there is no suspended request waiting. 848 * @param pInterface Pointer to the interface structure containing the called function pointer. 849 * @param phIoReq Where to store the request handle on success. 850 * @param ppvIoReqAlloc Where to store the pointer to the allocator specific memory on success. 851 * @thread Any thread. 852 * 853 * @note This should only be called when the VM is suspended to make sure the request doesn't suddenly 854 * changes into the active state again. The only purpose for this method for now is to make saving the state 855 * possible without breaking saved state versions. 856 */ 857 DECLR3CALLBACKMEMBER(int, pfnIoReqQuerySuspendedStart, (PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, void **ppvIoReqAlloc)); 858 859 /** 860 * Gets the next suspended request handle. 861 * 862 * @returns VBox status code. 863 * @retval VERR_NOT_FOUND if there is no suspended request waiting. 864 * @param pInterface Pointer to the interface structure containing the called function pointer. 865 * @param hIoReq The current request handle. 866 * @param phIoReqNext Where to store the request handle on success. 867 * @param ppvIoReqAllocNext Where to store the pointer to the allocator specific memory on success. 868 * @thread Any thread. 869 * 870 * @note This should only be called when the VM is suspended to make sure the request doesn't suddenly 871 * changes into the active state again. The only purpose for this method for now is to make saving the state 872 * possible without breaking saved state versions. 873 */ 874 DECLR3CALLBACKMEMBER(int, pfnIoReqQuerySuspendedNext, (PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, 875 PPDMMEDIAEXIOREQ phIoReqNext, void **ppvIoReqAllocNext)); 876 834 877 } PDMIMEDIAEX; 835 878 /** PDMIMEDIAEX interface ID. */ 836 #define PDMIMEDIAEX_IID " d5ee47d8-5f7c-411d-bd9d-1021ee721a88"879 #define PDMIMEDIAEX_IID "a1eee1a8-cf51-43ed-a528-9f678a1b2224" 837 880 838 881 /** -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r59536 r59538 3051 3051 3052 3052 /** 3053 * Returns whether the VM is in a running state. 3054 * 3055 * @returns Flag indicating whether the VM is currently in a running state. 3056 * @param pThis VBox disk container instance data. 3057 */ 3058 DECLINLINE(bool) drvvdMediaExIoReqIsVmRunning(PVBOXDISK pThis) 3059 { 3060 VMSTATE enmVmState = PDMDrvHlpVMState(pThis->pDrvIns); 3061 if ( enmVmState == VMSTATE_RESUMING 3062 || enmVmState == VMSTATE_RUNNING 3063 || enmVmState == VMSTATE_RUNNING_LS 3064 || enmVmState == VMSTATE_RUNNING_FT 3065 || enmVmState == VMSTATE_RESETTING 3066 || enmVmState == VMSTATE_RESETTING_LS 3067 || enmVmState == VMSTATE_SUSPENDING 3068 || enmVmState == VMSTATE_SUSPENDING_LS 3069 || enmVmState == VMSTATE_SUSPENDING_EXT_LS) 3070 return true; 3071 3072 return false; 3073 } 3074 3075 /** 3053 3076 * @copydoc FNVDASYNCTRANSFERCOMPLETE 3054 3077 */ … … 3404 3427 PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx); 3405 3428 return ASMAtomicReadU32(&pThis->cIoReqsActive); 3429 } 3430 3431 /** 3432 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqGetSuspendedCount} 3433 */ 3434 static DECLCALLBACK(uint32_t) drvvdIoReqGetSuspendedCount(PPDMIMEDIAEX pInterface) 3435 { 3436 PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx); 3437 3438 AssertReturn(!drvvdMediaExIoReqIsVmRunning(pThis), 0); 3439 3440 uint32_t cIoReqSuspended = 0; 3441 PPDMMEDIAEXIOREQINT pIoReq; 3442 RTCritSectEnter(&pThis->CritSectIoReqRedo); 3443 RTListForEach(&pThis->LstIoReqRedo, pIoReq, PDMMEDIAEXIOREQINT, NdLstWait) 3444 { 3445 cIoReqSuspended++; 3446 } 3447 RTCritSectLeave(&pThis->CritSectIoReqRedo); 3448 3449 return cIoReqSuspended; 3450 } 3451 3452 /** 3453 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQuerySuspendedFirst} 3454 */ 3455 static DECLCALLBACK(int) drvvdIoReqQuerySuspendedStart(PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, 3456 void **ppvIoReqAlloc) 3457 { 3458 PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx); 3459 3460 AssertReturn(!drvvdMediaExIoReqIsVmRunning(pThis), VERR_INVALID_STATE); 3461 AssertReturn(!RTListIsEmpty(&pThis->LstIoReqRedo), VERR_NOT_FOUND); 3462 3463 RTCritSectEnter(&pThis->CritSectIoReqRedo); 3464 PPDMMEDIAEXIOREQINT pIoReq = RTListGetFirst(&pThis->LstIoReqRedo, PDMMEDIAEXIOREQINT, NdLstWait); 3465 *phIoReq = pIoReq; 3466 *ppvIoReqAlloc = &pIoReq->abAlloc[0]; 3467 RTCritSectLeave(&pThis->CritSectIoReqRedo); 3468 3469 return VINF_SUCCESS; 3470 } 3471 3472 /** 3473 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQuerySuspendedNext} 3474 */ 3475 static DECLCALLBACK(int) drvvdIoReqQuerySuspendedNext(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, 3476 PPDMMEDIAEXIOREQ phIoReqNext, void **ppvIoReqAllocNext) 3477 { 3478 PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx); 3479 PPDMMEDIAEXIOREQINT pIoReq = hIoReq; 3480 3481 AssertReturn(!drvvdMediaExIoReqIsVmRunning(pThis), VERR_INVALID_STATE); 3482 AssertPtrReturn(pIoReq, VERR_INVALID_HANDLE); 3483 AssertReturn(!RTListNodeIsLast(&pThis->LstIoReqRedo, &pIoReq->NdLstWait), VERR_NOT_FOUND); 3484 3485 RTCritSectEnter(&pThis->CritSectIoReqRedo); 3486 PPDMMEDIAEXIOREQINT pIoReqNext = RTListNodeGetNext(&pIoReq->NdLstWait, PDMMEDIAEXIOREQINT, NdLstWait); 3487 *phIoReqNext = pIoReqNext; 3488 *ppvIoReqAllocNext = &pIoReqNext->abAlloc[0]; 3489 RTCritSectLeave(&pThis->CritSectIoReqRedo); 3490 3491 return VINF_SUCCESS; 3406 3492 } 3407 3493 … … 3940 4026 3941 4027 /* IMediaEx */ 3942 pThis->IMediaEx.pfnIoReqAllocSizeSet = drvvdIoReqAllocSizeSet; 3943 pThis->IMediaEx.pfnIoReqAlloc = drvvdIoReqAlloc; 3944 pThis->IMediaEx.pfnIoReqFree = drvvdIoReqFree; 3945 pThis->IMediaEx.pfnIoReqCancel = drvvdIoReqCancel; 3946 pThis->IMediaEx.pfnIoReqRead = drvvdIoReqRead; 3947 pThis->IMediaEx.pfnIoReqWrite = drvvdIoReqWrite; 3948 pThis->IMediaEx.pfnIoReqFlush = drvvdIoReqFlush; 3949 pThis->IMediaEx.pfnIoReqDiscard = drvvdIoReqDiscard; 3950 pThis->IMediaEx.pfnIoReqGetActiveCount = drvvdIoReqGetActiveCount; 4028 pThis->IMediaEx.pfnIoReqAllocSizeSet = drvvdIoReqAllocSizeSet; 4029 pThis->IMediaEx.pfnIoReqAlloc = drvvdIoReqAlloc; 4030 pThis->IMediaEx.pfnIoReqFree = drvvdIoReqFree; 4031 pThis->IMediaEx.pfnIoReqCancel = drvvdIoReqCancel; 4032 pThis->IMediaEx.pfnIoReqRead = drvvdIoReqRead; 4033 pThis->IMediaEx.pfnIoReqWrite = drvvdIoReqWrite; 4034 pThis->IMediaEx.pfnIoReqFlush = drvvdIoReqFlush; 4035 pThis->IMediaEx.pfnIoReqDiscard = drvvdIoReqDiscard; 4036 pThis->IMediaEx.pfnIoReqGetActiveCount = drvvdIoReqGetActiveCount; 4037 pThis->IMediaEx.pfnIoReqGetSuspendedCount = drvvdIoReqGetSuspendedCount; 4038 pThis->IMediaEx.pfnIoReqQuerySuspendedStart = drvvdIoReqQuerySuspendedStart; 4039 pThis->IMediaEx.pfnIoReqQuerySuspendedNext = drvvdIoReqQuerySuspendedNext; 3951 4040 3952 4041 /* Initialize supported VD interfaces. */
Note:
See TracChangeset
for help on using the changeset viewer.