Changeset 23595 in vbox for trunk/src/VBox
- Timestamp:
- Oct 7, 2009 1:49:38 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/SSM.cpp
r23593 r23595 63 63 * The live saving sequence is something like this: 64 64 * 65 * -# SSMR3Live ToFile is called on EMT0. It returns a saved state65 * -# SSMR3LiveSave is called on EMT0. It returns a saved state 66 66 * handle. 67 67 * -# SSMR3LiveDoStep1 is called on a non-EMT. This will save the major … … 3592 3592 * Closes the SSM handle. 3593 3593 * 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. 3596 3595 * 3597 3596 * @returns VBox status. 3598 3597 * 3599 * @param pSSM The SSM handle returned by SSMR3LiveToFile or 3600 * SSMR3LiveToRemote. 3598 * @param pSSM The SSM handle returned by SSMR3LiveSave. 3601 3599 * 3602 3600 * @thread EMT(0). … … 4004 4002 4005 4003 /** 4006 * Common worker for SSMR3Save and SSMR3 Migrate.4004 * Common worker for SSMR3Save and SSMR3LiveSave. 4007 4005 * 4008 4006 * @returns VBox status code (no need to check pSSM->rc). … … 4040 4038 * @returns VBox status. 4041 4039 * 4042 * @param pSSM The SSM handle returned by SSMR3LiveToFile or 4043 * SSMR3LiveToRemote. 4040 * @param pSSM The SSM handle returned by SSMR3LiveSave. 4044 4041 * 4045 4042 * @thread Non-EMT thread. Will involve the EMT at the end of the operation. … … 4121 4118 * @returns VBox status code. 4122 4119 * @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. 4124 4125 * @param enmAfter What to do afterwards. 4125 4126 * @param pfnProgress The progress callback. … … 4129 4130 * RTMemFree after closing the stream. 4130 4131 */ 4131 static int ssmR3SaveDoCreateFile(PVM pVM, const char *pszFilename, SSMAFTER enmAfter,4132 PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM)4132 static int ssmR3SaveDoCreateFile(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, 4133 SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser, PSSMHANDLE *ppSSM) 4133 4134 { 4134 4135 PSSMHANDLE pSSM = (PSSMHANDLE)RTMemAllocZ(sizeof(*pSSM)); … … 4156 4157 pSSM->u.Write.offDataBuffer = 0; 4157 4158 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*/); 4159 4164 if (RT_FAILURE(rc)) 4160 4165 { … … 4202 4207 */ 4203 4208 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); 4205 4211 if (RT_FAILURE(rc)) 4206 4212 return rc; … … 4422 4428 * @returns VBox status. 4423 4429 * 4424 * @param pSSM The SSM handle returned by SSMR3LiveToFile or 4425 * SSMR3LiveToRemote. 4430 * @param pSSM The SSM handle returned by SSMR3LiveSave. 4426 4431 * 4427 4432 * @thread Non-EMT thread. Will involve the EMT at the end of the operation. … … 4607 4612 4608 4613 /** 4609 * Start saving the live state to a file.4614 * Start saving the live state. 4610 4615 * 4611 4616 * Call SSMR3LiveDoStep1, SSMR3LiveDoStep2 and finally SSMR3LiveDone on success. … … 4624 4629 * @thread EMT0 4625 4630 */ 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)); 4631 VMMR3_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)); 4630 4636 VM_ASSERT_EMT0(pVM); 4631 4637 … … 4637 4643 ("%d\n", enmAfter), 4638 4644 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 } 4639 4657 4640 4658 /* … … 4645 4663 */ 4646 4664 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); 4648 4667 if (RT_FAILURE(rc)) 4649 4668 return rc; -
trunk/src/VBox/VMM/VM.cpp
r23593 r23595 1601 1601 else if (rc == 2) 1602 1602 { 1603 rc = SSMR3LiveToFile(pVM, pszFilename, enmAfter, pfnProgress, pvUser, ppSSM); 1603 rc = SSMR3LiveSave(pVM, pszFilename, NULL /*pStreamOps*/, NULL /*pvStreamOpsUser*/, 1604 enmAfter, pfnProgress, pvUser, ppSSM); 1604 1605 /* (We're not subject to cancellation just yet.) */ 1605 1606 }
Note:
See TracChangeset
for help on using the changeset viewer.