Changeset 23540 in vbox
- Timestamp:
- Oct 4, 2009 9:00:21 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53183
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/ssm.h
r23002 r23540 658 658 VMMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus); 659 659 VMMR3DECL(SSMAFTER) SSMR3HandleGetAfter(PSSMHANDLE pSSM); 660 VMMR3DECL( uint64_t) SSMR3HandleGetUnitOffset(PSSMHANDLE pSSM);660 VMMR3DECL(bool) SSMR3HandleIsLiveSave(PSSMHANDLE pSSM); 661 661 VMMR3_INT_DECL(int) SSMR3SetGCPtrSize(PSSMHANDLE pSSM, unsigned cbGCPtr); 662 662 VMMR3DECL(int) SSMR3Cancel(PVM pVM); -
trunk/src/VBox/VMM/SSM.cpp
r23448 r23540 191 191 /** The stream is checkesummed up to the footer using CRC-32. */ 192 192 #define SSMFILEHDR_FLAGS_STREAM_CRC32 RT_BIT_32(0) 193 /** Indicates that the file was produced by a live save. */ 194 #define SSMFILEHDR_FLAGS_STREAM_LIVE_SAVE RT_BIT_32(1) 193 195 /** @} */ 194 196 … … 318 320 } while (0) 319 321 322 #define SSM_ASSERT_VALID_HANDLE(pSSM) \ 323 do \ 324 { \ 325 AssertPtr(pSSM); \ 326 Assert(pSSM->enmOp > SSMSTATE_INVALID && pSSM->enmOp < SSMSTATE_OPEN_END); \ 327 } while (0) 328 320 329 321 330 /******************************************************************************* … … 337 346 SSMSTATE_LOAD_EXEC, 338 347 SSMSTATE_LOAD_DONE, 339 SSMSTATE_OPEN_READ 348 SSMSTATE_OPEN_READ, 349 SSMSTATE_OPEN_END 340 350 } SSMSTATE; 341 351 … … 440 450 /** The current uncompressed offset into the data unit. */ 441 451 uint64_t offUnit; 452 /** Indicates that this is a live save or restore operation. */ 453 bool fLiveSave; 442 454 443 455 /** Pointer to the progress callback function. */ … … 3805 3817 3806 3818 /* (progress should be pending 99% now) */ 3807 AssertMsg(pSSM->uPercent == (101 - pSSM->uPercentDone), ("%d\n", pSSM->uPercent)); 3819 AssertMsg( pSSM->uPercent == (101 - pSSM->uPercentDone) 3820 || pSSM->fLiveSave, ("%d\n", pSSM->uPercent)); 3808 3821 return VINF_SUCCESS; 3809 3822 } … … 3962 3975 FileHdr.cUnits = pVM->ssm.s.cUnits; 3963 3976 FileHdr.fFlags = SSMFILEHDR_FLAGS_STREAM_CRC32; 3977 if (pSSM->fLiveSave) 3978 FileHdr.fFlags |= SSMFILEHDR_FLAGS_STREAM_LIVE_SAVE; 3964 3979 FileHdr.cbMaxDecompr = RT_SIZEOFMEMB(SSMHANDLE, u.Read.abDataBuffer); 3965 3980 FileHdr.u32CRC = 0; … … 4009 4024 pSSM->cbUnitLeftV1 = 0; 4010 4025 pSSM->offUnit = UINT64_MAX; 4026 pSSM->fLiveSave = false; 4011 4027 pSSM->pfnProgress = pfnProgress; 4012 4028 pSSM->pvUser = pvUser; … … 4377 4393 } 4378 4394 } 4379 #if 0 4395 #if 0 /** @todo check this out... */ 4380 4396 /* 4381 4397 * Check the VM state to see if it has changed. … … 4515 4531 pSSM->uPercentPrepare = 20; /** @todo fix these. */ 4516 4532 pSSM->uPercentDone = 2; 4533 pSSM->fLiveSave = true; 4517 4534 4518 4535 /* … … 4525 4542 { 4526 4543 /** @todo If it turns out we don't need to do ssmR3DoLivePrepRun on EMT0, 4527 * simply move the code to SSMR3LiveDoStep1. */ 4544 * simply move the code to SSMR3LiveDoStep1. 4545 * Update: This is certinaly the case, move it. */ 4528 4546 rc = ssmR3DoLivePrepRun(pVM, pSSM); 4529 4547 if (RT_SUCCESS(rc)) … … 6027 6045 * 6028 6046 * @returns VBox status. 6029 * @param File File to validate. 6030 * The file position is undefined on return. 6047 * @param pSSM The saved state handle. A number of field will 6048 * be updated, mostly header related information. 6049 * fLiveSave is also set if appropriate. 6031 6050 * @param fChecksumIt Whether to checksum the file or not. This will 6032 6051 * be ignored if it the stream isn't a file. … … 6112 6131 return VERR_SSM_INTEGRITY; 6113 6132 } 6114 if ( (uHdr.v2_0.fFlags & ~SSMFILEHDR_FLAGS_STREAM_CRC32))6133 if (uHdr.v2_0.fFlags & ~(SSMFILEHDR_FLAGS_STREAM_CRC32 | SSMFILEHDR_FLAGS_STREAM_LIVE_SAVE)) 6115 6134 { 6116 6135 LogRel(("SSM: Unknown header flags: %08x\n", uHdr.v2_0.fFlags)); … … 6133 6152 pSSM->u.Read.cbGCPhys = uHdr.v2_0.cbGCPhys; 6134 6153 pSSM->u.Read.cbGCPtr = uHdr.v2_0.cbGCPtr; 6135 pSSM->u.Read.fFixedGCPtrSize 6154 pSSM->u.Read.fFixedGCPtrSize= true; 6136 6155 fChecksummed = !!(uHdr.v2_0.fFlags & SSMFILEHDR_FLAGS_STREAM_CRC32); 6156 pSSM->fLiveSave = !!(uHdr.v2_0.fFlags & SSMFILEHDR_FLAGS_STREAM_LIVE_SAVE); 6137 6157 } 6138 6158 else … … 6338 6358 pSSM->cbUnitLeftV1 = 0; 6339 6359 pSSM->offUnit = UINT64_MAX; 6360 pSSM->fLiveSave = false; 6340 6361 pSSM->pfnProgress = NULL; 6341 6362 pSSM->pvUser = NULL; … … 7321 7342 VMMR3DECL(int) SSMR3HandleGetStatus(PSSMHANDLE pSSM) 7322 7343 { 7344 SSM_ASSERT_VALID_HANDLE(pSSM); 7323 7345 return pSSM->rc; 7324 7346 } … … 7338 7360 VMMR3DECL(int) SSMR3HandleSetStatus(PSSMHANDLE pSSM, int iStatus) 7339 7361 { 7362 SSM_ASSERT_VALID_HANDLE(pSSM); 7340 7363 Assert(pSSM->enmOp != SSMSTATE_LIVE_VOTE); 7341 7364 if (RT_FAILURE(iStatus)) … … 7359 7382 VMMR3DECL(SSMAFTER) SSMR3HandleGetAfter(PSSMHANDLE pSSM) 7360 7383 { 7384 SSM_ASSERT_VALID_HANDLE(pSSM); 7361 7385 return pSSM->enmAfter; 7362 7386 } … … 7364 7388 7365 7389 /** 7366 * Get the current unit byte offset (uncompressed).7367 * 7368 * @returns T he offset. UINT64_MAX if called at a wrong time.7390 * Checks if it is a live save operation or not. 7391 * 7392 * @returns True if it is, false if it isn't. 7369 7393 * @param pSSM SSM operation handle. 7370 7394 */ 7371 VMMR3DECL( uint64_t) SSMR3HandleGetUnitOffset(PSSMHANDLE pSSM)7372 { 7373 AssertMsgFailed(("/** @todo this isn't correct any longer. */"));7374 return pSSM-> offUnit;7395 VMMR3DECL(bool) SSMR3HandleIsLiveSave(PSSMHANDLE pSSM) 7396 { 7397 SSM_ASSERT_VALID_HANDLE(pSSM); 7398 return pSSM->fLiveSave; 7375 7399 } 7376 7400
Note:
See TracChangeset
for help on using the changeset viewer.