Changeset 34223 in vbox
- Timestamp:
- Nov 21, 2010 11:51:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMBlkCache.cpp
r34219 r34223 603 603 return VERR_NO_MEMORY; 604 604 605 ASMAtomicIncU32(&pReq->cXfersPending); 605 606 pIoXfer->fIoCache = false; 606 607 pIoXfer->pReq = pReq; … … 945 946 int rc = VINF_SUCCESS; 946 947 PPDMBLKCACHE pBlkCache = NULL; 948 bool fAlreadyExists = false; 947 949 PPDMBLKCACHEGLOBAL pBlkCacheGlobal = pVM->pUVM->pdm.s.pBlkCacheGlobal; 948 950 … … 959 961 { 960 962 if (!RTStrCmp(pBlkCache->pszId, pcszId)) 963 { 964 fAlreadyExists = true; 961 965 break; 962 } 963 964 if (!pBlkCache) 966 } 967 } 968 969 if (!fAlreadyExists) 965 970 { 966 971 pBlkCache = (PPDMBLKCACHE)RTMemAllocZ(sizeof(PDMBLKCACHE)); … … 1045 1050 if (RT_SUCCESS(rc)) 1046 1051 { 1052 pBlkCache->enmType = PDMBLKCACHETYPE_DRV; 1047 1053 pBlkCache->u.Drv.pfnXferComplete = pfnXferComplete; 1048 1054 pBlkCache->u.Drv.pfnXferEnqueue = pfnXferEnqueue; 1049 1055 pBlkCache->u.Drv.pDrvIns = pDrvIns; 1056 *ppBlkCache = pBlkCache; 1050 1057 } 1051 1058 … … 1065 1072 if (RT_SUCCESS(rc)) 1066 1073 { 1074 pBlkCache->enmType = PDMBLKCACHETYPE_DEV; 1067 1075 pBlkCache->u.Dev.pfnXferComplete = pfnXferComplete; 1068 1076 pBlkCache->u.Dev.pfnXferEnqueue = pfnXferEnqueue; 1069 1077 pBlkCache->u.Dev.pDevIns = pDevIns; 1078 *ppBlkCache = pBlkCache; 1070 1079 } 1071 1080 … … 1086 1095 if (RT_SUCCESS(rc)) 1087 1096 { 1097 pBlkCache->enmType = PDMBLKCACHETYPE_USB; 1088 1098 pBlkCache->u.Usb.pfnXferComplete = pfnXferComplete; 1089 1099 pBlkCache->u.Usb.pfnXferEnqueue = pfnXferEnqueue; 1090 1100 pBlkCache->u.Usb.pUsbIns = pUsbIns; 1101 *ppBlkCache = pBlkCache; 1091 1102 } 1092 1103 … … 1107 1118 if (RT_SUCCESS(rc)) 1108 1119 { 1120 pBlkCache->enmType = PDMBLKCACHETYPE_INTERNAL; 1109 1121 pBlkCache->u.Int.pfnXferComplete = pfnXferComplete; 1110 1122 pBlkCache->u.Int.pfnXferEnqueue = pfnXferEnqueue; 1111 1123 pBlkCache->u.Int.pvUser = pvUser; 1124 *ppBlkCache = pBlkCache; 1112 1125 } 1113 1126 … … 1488 1501 return VERR_NO_MEMORY; 1489 1502 1503 ASMAtomicIncU32(&pReq->cXfersPending); 1490 1504 pWaiter->pReq = pReq; 1491 1505 pWaiter->offCacheEntry = offDiff; … … 1733 1747 } 1734 1748 1749 LogFlowFunc(("pReq=%#p cXfersPending=%u cbXfer=%u\n", pReq, cXfersPending, (cbOld - cbComplete))); 1735 1750 return false; 1736 1751 } … … 1752 1767 /* Allocate new request structure. */ 1753 1768 pReq = pdmBlkCacheReqAlloc(cbRead, pvUser); 1754 if (RT_UNLIKELY( pReq))1769 if (RT_UNLIKELY(!pReq)) 1755 1770 return VERR_NO_MEMORY; 1756 1771 … … 1818 1833 /* Read as much as we can from the entry. */ 1819 1834 RTSgBufCopyFromBuf(&SgBuf, pEntry->pbData + offDiff, cbToRead); 1835 ASMAtomicSubU32(&pReq->cbXfer, cbToRead); 1820 1836 } 1821 1837 … … 1967 1983 /* Allocate new request structure. */ 1968 1984 pReq = pdmBlkCacheReqAlloc(cbWrite, pvUser); 1969 if (RT_UNLIKELY( pReq))1985 if (RT_UNLIKELY(!pReq)) 1970 1986 return VERR_NO_MEMORY; 1971 1987
Note:
See TracChangeset
for help on using the changeset viewer.