Changeset 30668 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jul 6, 2010 2:26:53 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp
r28800 r30668 75 75 } 76 76 77 /** 78 * Query the session id of this VM; this is a unique id that gets changed for each VM start, reset or restore. 79 * Useful for detection a VM restore. 80 * 81 * @returns IPRT status code. 82 * pu64IdSession Session id (out) 83 * 84 */ 85 VBGLR3DECL(int) VbglR3GetSessionId(uint64_t *pu64IdSession) 86 { 87 VMMDevReqSessionId Req; 88 89 vmmdevInitRequest(&Req.header, VMMDevReq_GetSessionId); 90 int rc = vbglR3GRPerform(&Req.header); 91 if (rc == VINF_SUCCESS) 92 *pu64IdSession = Req.idSession; 93 94 return rc; 95 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp
r30666 r30668 87 87 static DECLCALLBACK(int) VBoxServicePageSharingEmptyTreeCallback(PAVLPVNODECORE pNode, void *pvUser); 88 88 89 static PAVLPVNODECORE pKnownModuleTree = NULL; 89 static PAVLPVNODECORE g_pKnownModuleTree = NULL; 90 static uint64_t g_idSession = 0; 90 91 91 92 /** … … 302 303 if (!pRec) 303 304 { 304 pRec = RTAvlPVRemove(& pKnownModuleTree, ModuleInfo.modBaseAddr);305 pRec = RTAvlPVRemove(&g_pKnownModuleTree, ModuleInfo.modBaseAddr); 305 306 if (!pRec) 306 307 { … … 411 412 if (!pRec) 412 413 { 413 pRec = RTAvlPVRemove(& pKnownModuleTree, pSystemModules->Modules[i].ImageBase);414 pRec = RTAvlPVRemove(&g_pKnownModuleTree, pSystemModules->Modules[i].ImageBase); 414 415 if (!pRec) 415 416 { … … 484 485 485 486 /* Delete leftover modules in the old tree. */ 486 RTAvlPVDestroy(& pKnownModuleTree, VBoxServicePageSharingEmptyTreeCallback, NULL);487 RTAvlPVDestroy(&g_pKnownModuleTree, VBoxServicePageSharingEmptyTreeCallback, NULL); 487 488 488 489 /* Check all registered modules. */ 489 490 VbglR3CheckSharedModules(); 491 490 492 /* Activate new module tree. */ 491 pKnownModuleTree = pNewTree;493 g_pKnownModuleTree = pNewTree; 492 494 } 493 495 … … 566 568 #endif 567 569 570 rc = VbglR3GetSessionId(&g_idSession); 571 AssertRCReturn(rc, rc); 572 568 573 /* Never fail here. */ 569 574 return VINF_SUCCESS; … … 584 589 for (;;) 585 590 { 591 uint64_t idNewSession; 592 586 593 VBoxServiceVerbose(3, "VBoxServicePageSharingWorker: enabled=%d\n", VbglR3PageSharingIsEnabled()); 587 594 … … 605 612 break; 606 613 } 614 idNewSession = g_idSession; 615 rc = VbglR3GetSessionId(&idNewSession); 616 AssertRC(rc); 617 618 if (idNewSession != g_idSession) 619 { 620 bool fUnregister = false; 621 622 VBoxServiceVerbose(3, "VBoxServicePageSharingWorker: VM was restored!!\n")); 623 /* The VM was restored, so reregister all modules the next time. */ 624 RTAvlPVDestroy(&g_pKnownModuleTree, VBoxServicePageSharingEmptyTreeCallback, &fUnregister); 625 g_pKnownModuleTree = NULL; 626 } 627 607 628 } 608 629
Note:
See TracChangeset
for help on using the changeset viewer.