Changeset 31236 in vbox
- Timestamp:
- Jul 30, 2010 11:25:13 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64250
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r31228 r31236 3530 3530 { 3531 3531 /* as the last step, associate the medium to the VM */ 3532 rc = medium->a ttachTo(mData->mUuid);3532 rc = medium->addBackReference(mData->mUuid); 3533 3533 /* here we can fail because of Deleting, or being in process of 3534 3534 * creating a Diff */ … … 3764 3764 /* For non-hard disk media, detach straight away. */ 3765 3765 if (mediumType != DeviceType_HardDisk && !oldmedium.isNull()) 3766 oldmedium-> detachFrom(mData->mUuid);3766 oldmedium->removeBackReference(mData->mUuid); 3767 3767 if (!medium.isNull()) 3768 medium->a ttachTo(mData->mUuid);3768 medium->addBackReference(mData->mUuid); 3769 3769 pAttach->updateMedium(medium, false /* aImplicit */); 3770 3770 setModified(IsModified_Storage); … … 3779 3779 { 3780 3780 if (!medium.isNull()) 3781 medium-> detachFrom(mData->mUuid);3781 medium->removeBackReference(mData->mUuid); 3782 3782 pAttach = findAttachment(mMediaData->mAttachments, 3783 3783 aControllerName, … … 3790 3790 /* For non-hard disk media, re-attach straight away. */ 3791 3791 if (mediumType != DeviceType_HardDisk && !oldmedium.isNull()) 3792 oldmedium->a ttachTo(mData->mUuid);3792 oldmedium->addBackReference(mData->mUuid); 3793 3793 pAttach->updateMedium(oldmedium, false /* aImplicit */); 3794 3794 } … … 6478 6478 if (hd.isNull()) 6479 6479 continue; 6480 HRESULT rc = hd-> detachFrom(mData->mUuid, getSnapshotId());6480 HRESULT rc = hd->removeBackReference(mData->mUuid, getSnapshotId()); 6481 6481 AssertComRC(rc); 6482 6482 } … … 7294 7294 { 7295 7295 if (isSnapshotMachine()) 7296 rc = medium->a ttachTo(mData->mUuid, *aSnapshotId);7296 rc = medium->addBackReference(mData->mUuid, *aSnapshotId); 7297 7297 else 7298 rc = medium->a ttachTo(mData->mUuid);7298 rc = medium->addBackReference(mData->mUuid); 7299 7299 } 7300 7300 … … 8474 8474 AssertComRCThrowRC(rc); 8475 8475 8476 rc = diff->a ttachTo(mData->mUuid);8476 rc = diff->addBackReference(mData->mUuid); 8477 8477 AssertComRCThrowRC(rc); 8478 8478 … … 8556 8556 /* deassociate and mark for deletion */ 8557 8557 LogFlowThisFunc(("Detaching '%s', pending deletion\n", (*it)->getLogName())); 8558 rc = hd-> detachFrom(mData->mUuid);8558 rc = hd->removeBackReference(mData->mUuid); 8559 8559 AssertComRC(rc); 8560 8560 implicitAtts.push_back(*it); … … 8567 8567 /* no: de-associate */ 8568 8568 LogFlowThisFunc(("Detaching '%s', no deletion\n", (*it)->getLogName())); 8569 rc = hd-> detachFrom(mData->mUuid);8569 rc = hd->removeBackReference(mData->mUuid); 8570 8570 AssertComRC(rc); 8571 8571 continue; … … 8761 8761 // if this is from a snapshot, do not defer detachment to commitMedia() 8762 8762 if (pSnapshot) 8763 oldmedium-> detachFrom(mData->mUuid, pSnapshot->getId());8763 oldmedium->removeBackReference(mData->mUuid, pSnapshot->getId()); 8764 8764 // else if non-hard disk media, do not defer detachment to commitMedia() either 8765 8765 else if (mediumType != DeviceType_HardDisk) 8766 oldmedium-> detachFrom(mData->mUuid);8766 oldmedium->removeBackReference(mData->mUuid); 8767 8767 } 8768 8768 … … 8941 8941 8942 8942 /* now de-associate from the current machine state */ 8943 rc = pMedium-> detachFrom(mData->mUuid);8943 rc = pMedium->removeBackReference(mData->mUuid); 8944 8944 AssertComRC(rc); 8945 8945 … … 9017 9017 if (pMedium) 9018 9018 { 9019 rc = pMedium-> detachFrom(mData->mUuid);9019 rc = pMedium->removeBackReference(mData->mUuid); 9020 9020 AssertComRC(rc); 9021 9021 } … … 9031 9031 if (pMedium) 9032 9032 { 9033 rc = pMedium->a ttachTo(mData->mUuid);9033 rc = pMedium->addBackReference(mData->mUuid); 9034 9034 AssertComRC(rc); 9035 9035 } -
trunk/src/VBox/Main/MediumImpl.cpp
r31180 r31236 2656 2656 * @param aSnapshotId Snapshot ID; when non-empty, adds a snapshot attachment. 2657 2657 */ 2658 HRESULT Medium::a ttachTo(const Guid &aMachineId,2659 const Guid &aSnapshotId /*= Guid::Empty*/)2658 HRESULT Medium::addBackReference(const Guid &aMachineId, 2659 const Guid &aSnapshotId /*= Guid::Empty*/) 2660 2660 { 2661 2661 AssertReturn(!aMachineId.isEmpty(), E_FAIL); … … 2749 2749 * attachment. 2750 2750 */ 2751 HRESULT Medium:: detachFrom(const Guid &aMachineId,2752 const Guid &aSnapshotId /*= Guid::Empty*/)2751 HRESULT Medium::removeBackReference(const Guid &aMachineId, 2752 const Guid &aSnapshotId /*= Guid::Empty*/) 2753 2753 { 2754 2754 AssertReturn(!aMachineId.isEmpty(), E_FAIL); -
trunk/src/VBox/Main/SnapshotImpl.cpp
r31228 r31236 966 966 if (pMedium) // can be NULL for non-harddisk 967 967 { 968 rc = pMedium->a ttachTo(mData->mUuid, mSnapshotId);968 rc = pMedium->addBackReference(mData->mUuid, mSnapshotId); 969 969 AssertComRC(rc); 970 970 } … … 1944 1944 // from the current machine data; saveSettings() below would then 1945 1945 // compare the current machine data with the one in the backup 1946 // and actually call Medium:: detachFrom(). But that works only half1946 // and actually call Medium::removeBackReference(). But that works only half 1947 1947 // the time in our case so instead we force a detachment here: 1948 1948 // remove from machine data … … 1952 1952 mMediaData.backedUpData()->mAttachments.remove(pAttach); 1953 1953 // then clean up backrefs 1954 pMedium-> detachFrom(mData->mUuid);1954 pMedium->removeBackReference(mData->mUuid); 1955 1955 1956 1956 llDiffsToDelete.push_back(pMedium); … … 2452 2452 // with the snapshot until the merge was successful. 2453 2453 HRESULT rc2 = S_OK; 2454 rc2 = pSource-> detachFrom(replaceMachineId, replaceSnapshotId);2454 rc2 = pSource->removeBackReference(replaceMachineId, replaceSnapshotId); 2455 2455 AssertComRC(rc2); 2456 2456 … … 2647 2647 pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments, 2648 2648 it->mpTarget); 2649 it->mpTarget-> detachFrom(machineId, snapshotId);2649 it->mpTarget->removeBackReference(machineId, snapshotId); 2650 2650 } 2651 2651 else … … 2673 2673 AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS); 2674 2674 pAtt->updateMedium(it->mpTarget, false /* aImplicit */); 2675 it->mpTarget->a ttachTo(pMachine->mData->mUuid, childSnapshotId);2675 it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId); 2676 2676 } 2677 2677 } … … 3102 3102 { 3103 3103 // reattach the source media to the snapshot 3104 HRESULT rc = aSource->a ttachTo(aMachineId, aSnapshotId);3104 HRESULT rc = aSource->addBackReference(aMachineId, aSnapshotId); 3105 3105 AssertComRC(rc); 3106 3106 } -
trunk/src/VBox/Main/include/MediumImpl.h
r31098 r31236 167 167 Utf8Str getName(); 168 168 169 HRESULT a ttachTo(const Guid &aMachineId,170 const Guid &aSnapshotId = Guid::Empty);171 HRESULT detachFrom(const Guid &aMachineId,172 const Guid &aSnapshotId = Guid::Empty);169 HRESULT addBackReference(const Guid &aMachineId, 170 const Guid &aSnapshotId = Guid::Empty); 171 HRESULT removeBackReference(const Guid &aMachineId, 172 const Guid &aSnapshotId = Guid::Empty); 173 173 174 174 const Guid* getFirstMachineBackrefId() const;
Note:
See TracChangeset
for help on using the changeset viewer.