VirtualBox

Changeset 22480 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 26, 2009 5:14:13 PM (15 years ago)
Author:
vboxsync
Message:

SSM,VMM,Devices,Main,VBoxBFE: Live snapshot/migration SSM API adjustments.

Location:
trunk/src/VBox/Main
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r22456 r22480  
    10551055 *
    10561056 *  @param pvUser       pointer to Console
    1057  *  @param u32Version   Console unit version.
     1057 *  @param uVersion     Console unit version.
    10581058 *                      Should match sSSMConsoleVer.
     1059 *  @param uPhase       The data phase.
    10591060 *
    10601061 *  @note Should locks the Console object for writing, if necessary.
     
    10621063//static
    10631064DECLCALLBACK(int)
    1064 Console::loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version)
     1065Console::loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase)
    10651066{
    10661067    LogFlowFunc (("\n"));
    10671068
    1068     if (SSM_VERSION_MAJOR_CHANGED(u32Version, sSSMConsoleVer))
     1069    if (SSM_VERSION_MAJOR_CHANGED(uVersion, sSSMConsoleVer))
    10691070        return VERR_VERSION_MISMATCH;
    1070 
    1071     Console *that = static_cast <Console *> (pvUser);
     1071    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
     1072
     1073    Console *that = static_cast<Console *>(pvUser);
    10721074    AssertReturn(that, VERR_INVALID_PARAMETER);
    10731075
     
    67866788            {
    67876789                /*
    6788                  *  Register our load/save state file handlers
     6790                 * Register our load/save state file handlers
    67896791                 */
    6790                 vrc = SSMR3RegisterExternal (pVM,
    6791                     sSSMConsoleUnit, 0 /* iInstance */, sSSMConsoleVer,
    6792                     0 /* cbGuess */,
    6793                     NULL, saveStateFileExec, NULL, NULL, loadStateFileExec, NULL,
    6794                     static_cast <Console *> (console));
    6795                 AssertRC (vrc);
    6796                 if (VBOX_FAILURE (vrc))
    6797                     break;
     6792                vrc = SSMR3RegisterExternal(pVM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */,
     6793                                            NULL, NULL, NULL,
     6794                                            NULL, saveStateFileExec, NULL,
     6795                                            NULL, loadStateFileExec, NULL,
     6796                                            static_cast<Console *>(console));
     6797                AssertRCBreak(vrc);
    67986798
    67996799                vrc = static_cast <Console *>(console)->getDisplay()->registerSSM(pVM);
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r22455 r22480  
    14571457    /* the VMM device's Main driver */
    14581458    rc = CFGMR3InsertNode(pInst,    "LUN#0", &pLunL0);                              RC_CHECK();
    1459     rc = CFGMR3InsertString(pLunL0, "Driver",               "MainVMMDev");          RC_CHECK();
     1459    rc = CFGMR3InsertString(pLunL0, "Driver",               "HGCM");                RC_CHECK();
    14601460    rc = CFGMR3InsertNode(pLunL0,   "Config", &pCfg);                               RC_CHECK();
    14611461    VMMDev *pVMMDev = pConsole->mVMMDev;
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r22443 r22480  
    116116 */
    117117DECLCALLBACK(void)
    118 Display::displaySSMSave (PSSMHANDLE pSSM, void *pvUser)
     118Display::displaySSMSave(PSSMHANDLE pSSM, void *pvUser)
    119119{
    120120    Display *that = static_cast<Display*>(pvUser);
    121121
    122     int rc = SSMR3PutU32 (pSSM, that->mcMonitors);
    123     AssertRC(rc);
    124 
     122    SSMR3PutU32(pSSM, that->mcMonitors);
    125123    for (unsigned i = 0; i < that->mcMonitors; i++)
    126124    {
    127         rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32Offset);
    128         AssertRC(rc);
    129         rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32MaxFramebufferSize);
    130         AssertRC(rc);
    131         rc = SSMR3PutU32 (pSSM, that->maFramebuffers[i].u32InformationSize);
    132         AssertRC(rc);
     125        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32Offset);
     126        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32MaxFramebufferSize);
     127        SSMR3PutU32(pSSM, that->maFramebuffers[i].u32InformationSize);
    133128    }
    134129}
    135130
    136131DECLCALLBACK(int)
    137 Display::displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version)
     132Display::displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase)
    138133{
    139134    Display *that = static_cast<Display*>(pvUser);
     135
     136    if (uVersion != sSSMDisplayVer)
     137        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     138
    140139    uint32_t cMonitors;
    141 
    142     if (u32Version != sSSMDisplayVer)
    143         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    144 
    145     int rc = SSMR3GetU32 (pSSM, &cMonitors);
     140    int rc = SSMR3GetU32(pSSM, &cMonitors);
    146141    if (cMonitors != that->mcMonitors)
    147142    {
    148143        LogRel(("Display: Number of monitors changed (%d->%d)!\n",
    149                  cMonitors, that->mcMonitors));
     144                cMonitors, that->mcMonitors));
    150145        return VERR_SSM_LOAD_CONFIG_MISMATCH;
    151146    }
    152147
    153     for (unsigned i = 0; i < cMonitors; i++)
    154     {
    155         rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32Offset);
    156         AssertRC(rc);
    157         rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);
    158         AssertRC(rc);
    159         rc = SSMR3GetU32 (pSSM, &that->maFramebuffers[i].u32InformationSize);
    160         AssertRC(rc);
     148    for (uint32_t i = 0; i < cMonitors; i++)
     149    {
     150        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32Offset);
     151        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32MaxFramebufferSize);
     152        SSMR3GetU32(pSSM, &that->maFramebuffers[i].u32InformationSize);
    161153    }
    162154
     
    262254int Display::registerSSM(PVM pVM)
    263255{
    264     return SSMR3RegisterExternal(pVM, "DisplayData", 3*sizeof(uint32_t*),
    265                                  sSSMDisplayVer, 0,
    266                                  NULL, displaySSMSave, NULL,
    267                                  NULL, displaySSMLoad, NULL, this);
     256    int rc = SSMR3RegisterExternal(pVM, "DisplayData", 0, sSSMDisplayVer,
     257                                   mcMonitors * sizeof(uint32_t) * 3 + sizeof(uint32_t),
     258                                   NULL, NULL, NULL,
     259                                   NULL, displaySSMSave, NULL,
     260                                   NULL, displaySSMLoad, NULL, this);
     261
     262    AssertRCReturn(rc, rc);
     263
     264    /*
     265     * Register loaders for old saved states where iInstance was 3 * sizeof(uint32_t *).
     266     */
     267    rc = SSMR3RegisterExternal(pVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
     268                               NULL, NULL, NULL,
     269                               NULL, NULL, NULL,
     270                               NULL, displaySSMLoad, NULL, this);
     271    AssertRCReturn(rc, rc);
     272
     273    rc = SSMR3RegisterExternal(pVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
     274                               NULL, NULL, NULL,
     275                               NULL, NULL, NULL,
     276                               NULL, displaySSMLoad, NULL, this);
     277    AssertRCReturn(rc, rc);
     278    return VINF_SUCCESS;
    268279}
    269280
     
    23932404
    23942405    pThis->maFramebuffers[uScreenId].fVBVAEnabled = true;
    2395    
     2406
    23962407    return VINF_SUCCESS;
    23972408}
     
    25472558    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    25482559        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    2549     AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
     2560    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
    25502561                    ("Configuration error: Not possible to attach anything to this driver!\n"),
    25512562                    VERR_PDM_DRVINS_NO_ATTACH);
     
    26572668    NULL,
    26582669    /* pfnDetach */
    2659     NULL, 
     2670    NULL,
    26602671    /* pfnPowerOff */
    2661     NULL, 
     2672    NULL,
    26622673    /* pfnSoftReset */
    26632674    NULL,
  • trunk/src/VBox/Main/VMMDevInterface.cpp

    r22277 r22480  
    601601 * @param   pDrvIns         Driver instance of the driver which registered the data unit.
    602602 * @param   pSSM            SSM operation handle.
    603  * @param   u32Version      Data layout version.
    604  */
    605 static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t u32Version)
     603 * @param   uVersion        Data layout version.
     604 * @param   uPhase          The data phase.
     605 */
     606static DECLCALLBACK(int) iface_hgcmLoad(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase)
    606607{
    607608    LogFlowFunc(("Enter\n"));
    608609
    609     if (u32Version != HGCM_SSM_VERSION)
     610    if (uVersion != HGCM_SSM_VERSION)
    610611        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     612    Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase);
    611613
    612614    return HGCMHostLoadState (pSSM);
     
    716718    if (!CFGMR3AreValuesValid(pCfgHandle, "Object\0"))
    717719        return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    718     AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER, 
     720    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
    719721                    ("Configuration error: Not possible to attach anything to this driver!\n"),
    720722                    VERR_PDM_DRVINS_NO_ATTACH);
     
    812814        LogRel(("Failed to load Shared Folders service %Rrc\n", rc));
    813815
    814     pDrvIns->pDrvHlp->pfnSSMRegister(pDrvIns, "HGCM", 0, HGCM_SSM_VERSION, 4096/* bad guess */, NULL, iface_hgcmSave, NULL, NULL, iface_hgcmLoad, NULL);
     816    rc = PDMDrvHlpSSMRegisterEx(pDrvIns, HGCM_SSM_VERSION, 4096 /* bad guess */,
     817                                NULL, NULL, NULL,
     818                                NULL, iface_hgcmSave, NULL,
     819                                NULL, iface_hgcmLoad, NULL);
     820    if (RT_FAILURE(rc))
     821        return rc;
     822
    815823#endif /* VBOX_WITH_HGCM */
    816824
     
    827835    PDM_DRVREG_VERSION,
    828836    /* szDriverName */
    829     "MainVMMDev",
     837    "HGCM",
    830838    /* pszDescription */
    831839    "Main VMMDev driver (Main as in the API).",
     
    855863    NULL,
    856864    /* pfnDetach */
    857     NULL, 
     865    NULL,
    858866    /* pfnPowerOff */
    859     NULL, 
     867    NULL,
    860868    /* pfnSoftReset */
    861869    NULL,
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r22455 r22480  
    500500
    501501    static DECLCALLBACK(void)   saveStateFileExec (PSSMHANDLE pSSM, void *pvUser);
    502     static DECLCALLBACK(int)    loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
     502    static DECLCALLBACK(int)    loadStateFileExec (PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase);
    503503
    504504#ifdef VBOX_WITH_GUEST_PROPS
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r22412 r22480  
    291291
    292292
    293     static DECLCALLBACK(void)   displaySSMSave (PSSMHANDLE pSSM, void *pvUser);
    294     static DECLCALLBACK(int)    displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version);
     293    static DECLCALLBACK(void)   displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
     294    static DECLCALLBACK(int)    displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPhase);
    295295
    296296    const ComObjPtr<Console, ComWeakRef> mParent;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette