Changeset 48986 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Oct 8, 2013 11:10:16 PM (11 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMUsb.cpp
r48980 r48986 1062 1062 } 1063 1063 TMR3TimerDestroyUsb(pVM, pUsbIns); 1064 //SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0);1064 SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0); 1065 1065 pdmR3ThreadDestroyUsb(pVM, pUsbIns); 1066 1066 #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION … … 1615 1615 pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 1616 1616 1617 /** @todo1618 1617 int rc = SSMR3RegisterUsb(pUsbIns->Internal.s.pVM, pUsbIns, pUsbIns->pReg->szName, pUsbIns->iInstance, 1619 1618 uVersion, cbGuess, 1620 1619 pfnLivePrep, pfnLiveExec, pfnLiveVote, 1621 1620 pfnSavePrep, pfnSaveExec, pfnSaveDone, 1622 pfnLoadPrep, pfnLoadExec, pfnLoadDone); */ 1623 int rc = VERR_NOT_IMPLEMENTED; AssertFailed(); 1621 pfnLoadPrep, pfnLoadExec, pfnLoadDone); 1624 1622 1625 1623 LogFlow(("pdmR3UsbHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pUsbIns->pReg->szName, pUsbIns->iInstance, rc)); -
trunk/src/VBox/VMM/VMMR3/SSM.cpp
r44528 r48986 1316 1316 1317 1317 /** 1318 * Register a PDM USB device data unit. 1319 * 1320 * @returns VBox status. 1321 * 1322 * @param pVM Pointer to the VM. 1323 * @param pUsbIns USB instance. 1324 * @param pszName Data unit name. 1325 * @param uInstance The instance identifier of the data unit. 1326 * This must together with the name be unique. 1327 * @param uVersion Data layout version number. 1328 * @param cbGuess The approximate amount of data in the unit. 1329 * Only for progress indicators. 1330 * 1331 * @param pfnLivePrep Prepare live save callback, optional. 1332 * @param pfnLiveExec Execute live save callback, optional. 1333 * @param pfnLiveVote Vote live save callback, optional. 1334 * 1335 * @param pfnSavePrep Prepare save callback, optional. 1336 * @param pfnSaveExec Execute save callback, optional. 1337 * @param pfnSaveDone Done save callback, optional. 1338 * 1339 * @param pfnLoadPrep Prepare load callback, optional. 1340 * @param pfnLoadExec Execute load callback, optional. 1341 * @param pfnLoadDone Done load callback, optional. 1342 */ 1343 VMMR3_INT_DECL(int) 1344 SSMR3RegisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, 1345 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote, 1346 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone, 1347 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone) 1348 { 1349 PSSMUNIT pUnit; 1350 int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit); 1351 if (RT_SUCCESS(rc)) 1352 { 1353 pUnit->enmType = SSMUNITTYPE_USB; 1354 pUnit->u.Usb.pfnLivePrep = pfnLivePrep; 1355 pUnit->u.Usb.pfnLiveExec = pfnLiveExec; 1356 pUnit->u.Usb.pfnLiveVote = pfnLiveVote; 1357 pUnit->u.Usb.pfnSavePrep = pfnSavePrep; 1358 pUnit->u.Usb.pfnSaveExec = pfnSaveExec; 1359 pUnit->u.Usb.pfnSaveDone = pfnSaveDone; 1360 pUnit->u.Usb.pfnLoadPrep = pfnLoadPrep; 1361 pUnit->u.Usb.pfnLoadExec = pfnLoadExec; 1362 pUnit->u.Usb.pfnLoadDone = pfnLoadDone; 1363 pUnit->u.Usb.pUsbIns = pUsbIns; 1364 } 1365 return rc; 1366 } 1367 1368 1369 /** 1318 1370 * Register a internal data unit. 1319 1371 * … … 1558 1610 AssertMsgReturn(!pszName, 1559 1611 ("Caller is not owner! Owner=%p Caller=%p %s\n", pUnit->u.Drv.pDrvIns, pDrvIns, pszName), 1612 VERR_SSM_UNIT_NOT_OWNER); 1613 } 1614 1615 /* next */ 1616 pUnitPrev = pUnit; 1617 pUnit = pUnit->pNext; 1618 } 1619 1620 return rc; 1621 } 1622 1623 1624 /** 1625 * Deregister one or more PDM USB device data units. 1626 * 1627 * @returns VBox status. 1628 * @param pVM Pointer to the VM. 1629 * @param pUsbIns USB device instance. 1630 * @param pszName Data unit name. 1631 * Use NULL to deregister all data units for that driver instance. 1632 * @param uInstance The instance identifier of the data unit. 1633 * This must together with the name be unique. Ignored if pszName is NULL. 1634 * @remark Only for dynamic data units and dynamic unloaded modules. 1635 */ 1636 VMMR3_INT_DECL(int) SSMR3DeregisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance) 1637 { 1638 /* 1639 * Validate input. 1640 */ 1641 AssertMsgReturn(VALID_PTR(pUsbIns), ("pUsbIns is NULL!\n"), VERR_INVALID_PARAMETER); 1642 1643 /* 1644 * Search the list. 1645 */ 1646 size_t cchName = pszName ? strlen(pszName) : 0; 1647 int rc = pszName ? VERR_SSM_UNIT_NOT_FOUND : VINF_SUCCESS; 1648 PSSMUNIT pUnitPrev = NULL; 1649 PSSMUNIT pUnit = pVM->ssm.s.pHead; 1650 while (pUnit) 1651 { 1652 if ( pUnit->enmType == SSMUNITTYPE_USB 1653 && ( !pszName 1654 || ( pUnit->cchName == cchName 1655 && !memcmp(pUnit->szName, pszName, cchName) 1656 && pUnit->u32Instance == uInstance)) 1657 ) 1658 { 1659 if (pUnit->u.Usb.pUsbIns == pUsbIns) 1660 { 1661 /* 1662 * Unlink it, advance pointer, and free the node. 1663 */ 1664 PSSMUNIT pFree = pUnit; 1665 pUnit = pUnit->pNext; 1666 if (pUnitPrev) 1667 pUnitPrev->pNext = pUnit; 1668 else 1669 pVM->ssm.s.pHead = pUnit; 1670 pVM->ssm.s.cUnits--; 1671 Log(("SSM: Removed data unit '%s' (pdm drv).\n", pFree->szName)); 1672 MMR3HeapFree(pFree); 1673 1674 if (pszName) 1675 return VINF_SUCCESS; 1676 rc = VINF_SUCCESS; 1677 continue; 1678 } 1679 1680 AssertMsgReturn(!pszName, 1681 ("Caller is not owner! Owner=%p Caller=%p %s\n", pUnit->u.Usb.pUsbIns, pUsbIns, pszName), 1560 1682 VERR_SSM_UNIT_NOT_OWNER); 1561 1683 } … … 4310 4432 rc = pUnit->u.Drv.pfnSaveDone(pUnit->u.Drv.pDrvIns, pSSM); 4311 4433 break; 4434 case SSMUNITTYPE_USB: 4435 rc = pUnit->u.Usb.pfnSaveDone(pUnit->u.Usb.pUsbIns, pSSM); 4436 break; 4312 4437 case SSMUNITTYPE_INTERNAL: 4313 4438 rc = pUnit->u.Internal.pfnSaveDone(pVM, pSSM); … … 4659 4784 rc = pUnit->u.Drv.pfnSaveExec(pUnit->u.Drv.pDrvIns, pSSM); 4660 4785 break; 4786 case SSMUNITTYPE_USB: 4787 rc = pUnit->u.Usb.pfnSaveExec(pUnit->u.Usb.pUsbIns, pSSM); 4788 break; 4661 4789 case SSMUNITTYPE_INTERNAL: 4662 4790 rc = pUnit->u.Internal.pfnSaveExec(pVM, pSSM); … … 4748 4876 case SSMUNITTYPE_DRV: 4749 4877 rc = pUnit->u.Drv.pfnSavePrep(pUnit->u.Drv.pDrvIns, pSSM); 4878 break; 4879 case SSMUNITTYPE_USB: 4880 rc = pUnit->u.Usb.pfnSavePrep(pUnit->u.Usb.pUsbIns, pSSM); 4750 4881 break; 4751 4882 case SSMUNITTYPE_INTERNAL: … … 5091 5222 case SSMUNITTYPE_DRV: 5092 5223 rc = pUnit->u.Drv.pfnLiveVote(pUnit->u.Drv.pDrvIns, pSSM, uPass); 5224 break; 5225 case SSMUNITTYPE_USB: 5226 rc = pUnit->u.Usb.pfnLiveVote(pUnit->u.Usb.pUsbIns, pSSM, uPass); 5093 5227 break; 5094 5228 case SSMUNITTYPE_INTERNAL: … … 5232 5366 rc = pUnit->u.Drv.pfnLiveExec(pUnit->u.Drv.pDrvIns, pSSM, uPass); 5233 5367 break; 5368 case SSMUNITTYPE_USB: 5369 rc = pUnit->u.Usb.pfnLiveExec(pUnit->u.Usb.pUsbIns, pSSM, uPass); 5370 break; 5234 5371 case SSMUNITTYPE_INTERNAL: 5235 5372 rc = pUnit->u.Internal.pfnLiveExec(pVM, pSSM, uPass); … … 5390 5527 case SSMUNITTYPE_DRV: 5391 5528 rc = pUnit->u.Drv.pfnLivePrep(pUnit->u.Drv.pDrvIns, pSSM); 5529 break; 5530 case SSMUNITTYPE_USB: 5531 rc = pUnit->u.Usb.pfnLivePrep(pUnit->u.Usb.pUsbIns, pSSM); 5392 5532 break; 5393 5533 case SSMUNITTYPE_INTERNAL: … … 7978 8118 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL); 7979 8119 break; 8120 case SSMUNITTYPE_USB: 8121 rc = pUnit->u.Usb.pfnLoadExec(pUnit->u.Usb.pUsbIns, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL); 8122 break; 7980 8123 case SSMUNITTYPE_INTERNAL: 7981 8124 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL); … … 8242 8385 case SSMUNITTYPE_DRV: 8243 8386 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Pass); 8387 break; 8388 case SSMUNITTYPE_USB: 8389 rc = pUnit->u.Usb.pfnLoadExec(pUnit->u.Usb.pUsbIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Pass); 8244 8390 break; 8245 8391 case SSMUNITTYPE_INTERNAL: … … 8415 8561 rc = pUnit->u.Drv.pfnLoadPrep(pUnit->u.Drv.pDrvIns, &Handle); 8416 8562 break; 8563 case SSMUNITTYPE_USB: 8564 rc = pUnit->u.Usb.pfnLoadPrep(pUnit->u.Usb.pUsbIns, &Handle); 8565 break; 8417 8566 case SSMUNITTYPE_INTERNAL: 8418 8567 rc = pUnit->u.Internal.pfnLoadPrep(pVM, &Handle); … … 8487 8636 case SSMUNITTYPE_DRV: 8488 8637 rc = pUnit->u.Drv.pfnLoadDone(pUnit->u.Drv.pDrvIns, &Handle); 8638 break; 8639 case SSMUNITTYPE_USB: 8640 rc = pUnit->u.Usb.pfnLoadDone(pUnit->u.Usb.pUsbIns, &Handle); 8489 8641 break; 8490 8642 case SSMUNITTYPE_INTERNAL:
Note:
See TracChangeset
for help on using the changeset viewer.