VirtualBox

Changeset 23595 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 7, 2009 1:49:38 PM (15 years ago)
Author:
vboxsync
Message:

SSM: SSMR3LiveToFile -> SSMR3LiveSave.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/SSM.cpp

    r23593 r23595  
    6363 * The live saving sequence is something like this:
    6464 *
    65  *      -# SSMR3LiveToFile is called on EMT0.  It returns a saved state
     65 *      -# SSMR3LiveSave is called on EMT0.  It returns a saved state
    6666 *         handle.
    6767 *      -# SSMR3LiveDoStep1 is called on a non-EMT.  This will save the major
     
    35923592 * Closes the SSM handle.
    35933593 *
    3594  * This must always be called on a handled returned by SSMR3LiveToFile or
    3595  * SSMR3LiveToRemote.
     3594 * This must always be called on a handled returned by SSMR3LiveSave.
    35963595 *
    35973596 * @returns VBox status.
    35983597 *
    3599  * @param   pSSM            The SSM handle returned by SSMR3LiveToFile or
    3600  *                          SSMR3LiveToRemote.
     3598 * @param   pSSM            The SSM handle returned by SSMR3LiveSave.
    36013599 *
    36023600 * @thread  EMT(0).
     
    40044002
    40054003/**
    4006  * Common worker for SSMR3Save and SSMR3Migrate.
     4004 * Common worker for SSMR3Save and SSMR3LiveSave.
    40074005 *
    40084006 * @returns VBox status code (no need to check pSSM->rc).
     
    40404038 * @returns VBox status.
    40414039 *
    4042  * @param   pSSM            The SSM handle returned by SSMR3LiveToFile or
    4043  *                          SSMR3LiveToRemote.
     4040 * @param   pSSM            The SSM handle returned by SSMR3LiveSave.
    40444041 *
    40454042 * @thread  Non-EMT thread. Will involve the EMT at the end of the operation.
     
    41214118 * @returns VBox status code.
    41224119 * @param   pVM                 The VM handle.
    4123  * @param   pszFilename         The name of the file.
     4120 * @param   pszFilename         The name of the file.  NULL if pStreamOps is
     4121 *                              used.
     4122 * @param   pStreamOps          The stream methods.  NULL if pszFilename is
     4123 *                              used.
     4124 * @param   pvStreamOpsUser     The user argument to the stream methods.
    41244125 * @param   enmAfter            What to do afterwards.
    41254126 * @param   pfnProgress         The progress callback.
     
    41294130 *                              RTMemFree after closing the stream.
    41304131 */
    4131 static int ssmR3SaveDoCreateFile(PVM pVM, const char *pszFilename, SSMAFTER enmAfter,
    4132                                  PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM)
     4132static int ssmR3SaveDoCreateFile(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,
     4133                                 SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM)
    41334134{
    41344135    PSSMHANDLE pSSM = (PSSMHANDLE)RTMemAllocZ(sizeof(*pSSM));
     
    41564157    pSSM->u.Write.offDataBuffer = 0;
    41574158
    4158     int rc = ssmR3StrmOpenFile(&pSSM->Strm, pszFilename, true /*fWrite*/, true /*fChecksummed*/, 8 /*cBuffers*/);
     4159    int rc;
     4160    if (pStreamOps)
     4161        rc = ssmR3StrmInit(&pSSM->Strm, pStreamOps, pvStreamOpsUser, true /*fWrite*/, true /*fChecksummed*/, 8 /*cBuffers*/);
     4162    else
     4163        rc = ssmR3StrmOpenFile(&pSSM->Strm, pszFilename,             true /*fWrite*/, true /*fChecksummed*/, 8 /*cBuffers*/);
    41594164    if (RT_FAILURE(rc))
    41604165    {
     
    42024207     */
    42034208    PSSMHANDLE pSSM;
    4204     int rc = ssmR3SaveDoCreateFile(pVM, pszFilename, enmAfter, pfnProgress, pvUser, &pSSM);
     4209    int rc = ssmR3SaveDoCreateFile(pVM, pszFilename, NULL /*pStreamOps*/, NULL /*pvStreamOpsUser*/,
     4210                                   enmAfter, pfnProgress, pvUser, &pSSM);
    42054211    if (RT_FAILURE(rc))
    42064212        return rc;
     
    44224428 * @returns VBox status.
    44234429 *
    4424  * @param   pSSM            The SSM handle returned by SSMR3LiveToFile or
    4425  *                          SSMR3LiveToRemote.
     4430 * @param   pSSM            The SSM handle returned by SSMR3LiveSave.
    44264431 *
    44274432 * @thread  Non-EMT thread. Will involve the EMT at the end of the operation.
     
    46074612
    46084613/**
    4609  * Start saving the live state to a file.
     4614 * Start saving the live state.
    46104615 *
    46114616 * Call SSMR3LiveDoStep1, SSMR3LiveDoStep2 and finally SSMR3LiveDone on success.
     
    46244629 * @thread  EMT0
    46254630 */
    4626 VMMR3_INT_DECL(int) SSMR3LiveToFile(PVM pVM, const char *pszFilename, SSMAFTER enmAfter,
    4627                                     PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM)
    4628 {
    4629     LogFlow(("SSMR3LiveToFile: pszFilename=%p:{%s} enmAfter=%d pfnProgress=%p pvUser=%p\n", pszFilename, pszFilename, enmAfter, pfnProgress, pvUser));
     4631VMMR3_INT_DECL(int) SSMR3LiveSave(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser,
     4632                                  SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvProgressUser, PSSMHANDLE *ppSSM)
     4633{
     4634    LogFlow(("SSMR3LiveSave: pszFilename=%p:{%s} pStreamOps=%p pvStreamOpsUser=%p enmAfter=%d pfnProgress=%p pvProgressUser=%p\n",
     4635             pszFilename, pszFilename, pStreamOps, pvStreamOpsUser, enmAfter, pfnProgress, pvProgressUser));
    46304636    VM_ASSERT_EMT0(pVM);
    46314637
     
    46374643                    ("%d\n", enmAfter),
    46384644                    VERR_INVALID_PARAMETER);
     4645    AssertReturn(!pszFilename != !pStreamOps, VERR_INVALID_PARAMETER);
     4646    if (pStreamOps)
     4647    {
     4648        AssertReturn(pStreamOps->u32Version == SSMSTRMOPS_VERSION, VERR_INVALID_MAGIC);
     4649        AssertReturn(pStreamOps->u32EndVersion == SSMSTRMOPS_VERSION, VERR_INVALID_MAGIC);
     4650        AssertReturn(pStreamOps->pfnWrite, VERR_INVALID_PARAMETER);
     4651        AssertReturn(pStreamOps->pfnRead, VERR_INVALID_PARAMETER);
     4652        AssertReturn(pStreamOps->pfnSeek, VERR_INVALID_PARAMETER);
     4653        AssertReturn(pStreamOps->pfnTell, VERR_INVALID_PARAMETER);
     4654        AssertReturn(pStreamOps->pfnSize, VERR_INVALID_PARAMETER);
     4655        AssertReturn(pStreamOps->pfnClose, VERR_INVALID_PARAMETER);
     4656    }
    46394657
    46404658    /*
     
    46454663     */
    46464664    PSSMHANDLE pSSM;
    4647     int rc = ssmR3SaveDoCreateFile(pVM, pszFilename, enmAfter, pfnProgress, pvUser, &pSSM);
     4665    int rc = ssmR3SaveDoCreateFile(pVM, pszFilename, pStreamOps, pvStreamOpsUser,
     4666                                   enmAfter, pfnProgress, pvProgressUser, &pSSM);
    46484667    if (RT_FAILURE(rc))
    46494668        return rc;
  • trunk/src/VBox/VMM/VM.cpp

    r23593 r23595  
    16011601    else if (rc == 2)
    16021602    {
    1603         rc = SSMR3LiveToFile(pVM, pszFilename, enmAfter, pfnProgress, pvUser, ppSSM);
     1603        rc = SSMR3LiveSave(pVM, pszFilename, NULL /*pStreamOps*/, NULL /*pvStreamOpsUser*/,
     1604                           enmAfter, pfnProgress, pvUser, ppSSM);
    16041605        /* (We're not subject to cancellation just yet.) */
    16051606    }
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