Changeset 64725 in vbox
- Timestamp:
- Nov 20, 2016 10:33:04 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvRamDisk.cpp
r64274 r64725 177 177 /** Flag whether the RAM disk was pre allocated. */ 178 178 bool fPreallocRamDisk; 179 /** Flag whether to report a non totating medium. */ 180 bool fNonRotational; 179 181 /** AVL tree containing the disk blocks to check. */ 180 182 PAVLRFOFFTREE pTreeSegments; … … 638 640 } 639 641 642 /** @interface_method_impl{PDMIMEDIA,pfnIsNonRotational} */ 643 static DECLCALLBACK(bool) drvramdiskIsNonRotational(PPDMIMEDIA pInterface) 644 { 645 PDRVRAMDISK pThis = RT_FROM_MEMBER(pInterface, DRVRAMDISK, IMedia); 646 return pThis->fNonRotational; 647 } 648 640 649 641 650 /********************************************************************************************************************************* … … 1132 1141 1133 1142 /** 1143 * @interface_method_impl{PDMIMEDIAEX,pfnQueryFeatures} 1144 */ 1145 static DECLCALLBACK(int) drvramdiskQueryFeatures(PPDMIMEDIAEX pInterface, uint32_t *pfFeatures) 1146 { 1147 RT_NOREF1(pInterface) 1148 *pfFeatures = PDMIMEDIAEX_FEATURE_F_ASYNC | PDMIMEDIAEX_FEATURE_F_DISCARD; 1149 return VINF_SUCCESS; 1150 } 1151 1152 1153 /** 1134 1154 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqAllocSizeSet} 1135 1155 */ … … 1209 1229 RTMemCacheFree(pThis->hIoReqCache, pIoReq); 1210 1230 return VINF_SUCCESS; 1231 } 1232 1233 /** 1234 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQueryResidual} 1235 */ 1236 static DECLCALLBACK(int) drvramdiskIoReqQueryResidual(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, size_t *pcbResidual) 1237 { 1238 RT_NOREF2(pInterface, hIoReq); 1239 1240 *pcbResidual = 0; 1241 return VINF_SUCCESS; 1242 } 1243 1244 /** 1245 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQueryXferSize} 1246 */ 1247 static DECLCALLBACK(int) drvramdiskIoReqQueryXferSize(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, size_t *pcbXfer) 1248 { 1249 RT_NOREF1(pInterface); 1250 PPDMMEDIAEXIOREQINT pIoReq = hIoReq; 1251 1252 if ( pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ 1253 || pIoReq->enmType == PDMMEDIAEXIOREQTYPE_WRITE) 1254 *pcbXfer = pIoReq->ReadWrite.cbReq; 1255 else 1256 *pcbXfer = 0; 1257 1258 return VINF_SUCCESS; 1259 } 1260 1261 /** 1262 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqCancelAll} 1263 */ 1264 static DECLCALLBACK(int) drvramdiskIoReqCancelAll(PPDMIMEDIAEX pInterface) 1265 { 1266 RT_NOREF1(pInterface); 1267 return VINF_SUCCESS; /** @todo */ 1211 1268 } 1212 1269 … … 1600 1657 "PreAlloc\0" 1601 1658 "IoBufMax\0" 1602 "SectorSize\0")) 1659 "SectorSize\0" 1660 "NonRotational\0")) 1603 1661 return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES; 1604 1662 … … 1608 1666 N_("RamDisk: Error querying the media size")); 1609 1667 rc = CFGMR3QueryBoolDef(pCfg, "PreAlloc", &pThis->fPreallocRamDisk, false); 1610 AssertRC(rc); 1668 if (RT_FAILURE(rc)) 1669 return PDMDRV_SET_ERROR(pDrvIns, rc, 1670 N_("RamDisk: Error querying \"PreAlloc\"")); 1671 rc = CFGMR3QueryBoolDef(pCfg, "NonRotational", &pThis->fNonRotational, true); 1672 if (RT_FAILURE(rc)) 1673 return PDMDRV_SET_ERROR(pDrvIns, rc, 1674 N_("RamDisk: Error querying \"NonRotational\"")); 1611 1675 rc = CFGMR3QueryU32Def(pCfg, "IoBufMax", &cbIoBufMax, 5 * _1M); 1612 1676 if (RT_FAILURE(rc)) … … 1640 1704 pThis->IMedia.pfnReadPcBios = drvramdiskReadPcBios; 1641 1705 pThis->IMedia.pfnDiscard = drvramdiskDiscard; 1706 pThis->IMedia.pfnIsNonRotational = drvramdiskIsNonRotational; 1642 1707 1643 1708 /* IMediaEx */ 1709 pThis->IMediaEx.pfnQueryFeatures = drvramdiskQueryFeatures; 1644 1710 pThis->IMediaEx.pfnIoReqAllocSizeSet = drvramdiskIoReqAllocSizeSet; 1645 1711 pThis->IMediaEx.pfnIoReqAlloc = drvramdiskIoReqAlloc; 1646 1712 pThis->IMediaEx.pfnIoReqFree = drvramdiskIoReqFree; 1713 pThis->IMediaEx.pfnIoReqQueryResidual = drvramdiskIoReqQueryResidual; 1714 pThis->IMediaEx.pfnIoReqQueryXferSize = drvramdiskIoReqQueryXferSize; 1715 pThis->IMediaEx.pfnIoReqCancelAll = drvramdiskIoReqCancelAll; 1647 1716 pThis->IMediaEx.pfnIoReqCancel = drvramdiskIoReqCancel; 1648 1717 pThis->IMediaEx.pfnIoReqRead = drvramdiskIoReqRead;
Note:
See TracChangeset
for help on using the changeset viewer.