VirtualBox

Changeset 31236 in vbox


Ignore:
Timestamp:
Jul 30, 2010 11:25:13 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64250
Message:

Main: rename internal medium attach/detach methods

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r31228 r31236  
    35303530    {
    35313531        /* as the last step, associate the medium to the VM */
    3532         rc = medium->attachTo(mData->mUuid);
     3532        rc = medium->addBackReference(mData->mUuid);
    35333533        /* here we can fail because of Deleting, or being in process of
    35343534         * creating a Diff */
     
    37643764        /* For non-hard disk media, detach straight away. */
    37653765        if (mediumType != DeviceType_HardDisk && !oldmedium.isNull())
    3766             oldmedium->detachFrom(mData->mUuid);
     3766            oldmedium->removeBackReference(mData->mUuid);
    37673767        if (!medium.isNull())
    3768             medium->attachTo(mData->mUuid);
     3768            medium->addBackReference(mData->mUuid);
    37693769        pAttach->updateMedium(medium, false /* aImplicit */);
    37703770        setModified(IsModified_Storage);
     
    37793779    {
    37803780        if (!medium.isNull())
    3781             medium->detachFrom(mData->mUuid);
     3781            medium->removeBackReference(mData->mUuid);
    37823782        pAttach = findAttachment(mMediaData->mAttachments,
    37833783                                 aControllerName,
     
    37903790        /* For non-hard disk media, re-attach straight away. */
    37913791        if (mediumType != DeviceType_HardDisk && !oldmedium.isNull())
    3792             oldmedium->attachTo(mData->mUuid);
     3792            oldmedium->addBackReference(mData->mUuid);
    37933793        pAttach->updateMedium(oldmedium, false /* aImplicit */);
    37943794    }
     
    64786478            if (hd.isNull())
    64796479                continue;
    6480             HRESULT rc = hd->detachFrom(mData->mUuid, getSnapshotId());
     6480            HRESULT rc = hd->removeBackReference(mData->mUuid, getSnapshotId());
    64816481            AssertComRC(rc);
    64826482        }
     
    72947294        {
    72957295            if (isSnapshotMachine())
    7296                 rc = medium->attachTo(mData->mUuid, *aSnapshotId);
     7296                rc = medium->addBackReference(mData->mUuid, *aSnapshotId);
    72977297            else
    7298                 rc = medium->attachTo(mData->mUuid);
     7298                rc = medium->addBackReference(mData->mUuid);
    72997299        }
    73007300
     
    84748474            AssertComRCThrowRC(rc);
    84758475
    8476             rc = diff->attachTo(mData->mUuid);
     8476            rc = diff->addBackReference(mData->mUuid);
    84778477            AssertComRCThrowRC(rc);
    84788478
     
    85568556            /* deassociate and mark for deletion */
    85578557            LogFlowThisFunc(("Detaching '%s', pending deletion\n", (*it)->getLogName()));
    8558             rc = hd->detachFrom(mData->mUuid);
     8558            rc = hd->removeBackReference(mData->mUuid);
    85598559            AssertComRC(rc);
    85608560            implicitAtts.push_back(*it);
     
    85678567            /* no: de-associate */
    85688568            LogFlowThisFunc(("Detaching '%s', no deletion\n", (*it)->getLogName()));
    8569             rc = hd->detachFrom(mData->mUuid);
     8569            rc = hd->removeBackReference(mData->mUuid);
    85708570            AssertComRC(rc);
    85718571            continue;
     
    87618761        // if this is from a snapshot, do not defer detachment to commitMedia()
    87628762        if (pSnapshot)
    8763             oldmedium->detachFrom(mData->mUuid, pSnapshot->getId());
     8763            oldmedium->removeBackReference(mData->mUuid, pSnapshot->getId());
    87648764        // else if non-hard disk media, do not defer detachment to commitMedia() either
    87658765        else if (mediumType != DeviceType_HardDisk)
    8766             oldmedium->detachFrom(mData->mUuid);
     8766            oldmedium->removeBackReference(mData->mUuid);
    87678767    }
    87688768
     
    89418941
    89428942            /* now de-associate from the current machine state */
    8943             rc = pMedium->detachFrom(mData->mUuid);
     8943            rc = pMedium->removeBackReference(mData->mUuid);
    89448944            AssertComRC(rc);
    89458945
     
    90179017            if (pMedium)
    90189018            {
    9019                 rc = pMedium->detachFrom(mData->mUuid);
     9019                rc = pMedium->removeBackReference(mData->mUuid);
    90209020                AssertComRC(rc);
    90219021            }
     
    90319031            if (pMedium)
    90329032            {
    9033                 rc = pMedium->attachTo(mData->mUuid);
     9033                rc = pMedium->addBackReference(mData->mUuid);
    90349034                AssertComRC(rc);
    90359035            }
  • trunk/src/VBox/Main/MediumImpl.cpp

    r31180 r31236  
    26562656 * @param aSnapshotId   Snapshot ID; when non-empty, adds a snapshot attachment.
    26572657 */
    2658 HRESULT Medium::attachTo(const Guid &aMachineId,
    2659                          const Guid &aSnapshotId /*= Guid::Empty*/)
     2658HRESULT Medium::addBackReference(const Guid &aMachineId,
     2659                                 const Guid &aSnapshotId /*= Guid::Empty*/)
    26602660{
    26612661    AssertReturn(!aMachineId.isEmpty(), E_FAIL);
     
    27492749 *                      attachment.
    27502750 */
    2751 HRESULT Medium::detachFrom(const Guid &aMachineId,
    2752                            const Guid &aSnapshotId /*= Guid::Empty*/)
     2751HRESULT Medium::removeBackReference(const Guid &aMachineId,
     2752                                    const Guid &aSnapshotId /*= Guid::Empty*/)
    27532753{
    27542754    AssertReturn(!aMachineId.isEmpty(), E_FAIL);
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r31228 r31236  
    966966        if (pMedium) // can be NULL for non-harddisk
    967967        {
    968             rc = pMedium->attachTo(mData->mUuid, mSnapshotId);
     968            rc = pMedium->addBackReference(mData->mUuid, mSnapshotId);
    969969            AssertComRC(rc);
    970970        }
     
    19441944            // from the current machine data; saveSettings() below would then
    19451945            // compare the current machine data with the one in the backup
    1946             // and actually call Medium::detachFrom(). But that works only half
     1946            // and actually call Medium::removeBackReference(). But that works only half
    19471947            // the time in our case so instead we force a detachment here:
    19481948            // remove from machine data
     
    19521952            mMediaData.backedUpData()->mAttachments.remove(pAttach);
    19531953            // then clean up backrefs
    1954             pMedium->detachFrom(mData->mUuid);
     1954            pMedium->removeBackReference(mData->mUuid);
    19551955
    19561956            llDiffsToDelete.push_back(pMedium);
     
    24522452                // with the snapshot until the merge was successful.
    24532453                HRESULT rc2 = S_OK;
    2454                 rc2 = pSource->detachFrom(replaceMachineId, replaceSnapshotId);
     2454                rc2 = pSource->removeBackReference(replaceMachineId, replaceSnapshotId);
    24552455                AssertComRC(rc2);
    24562456
     
    26472647                pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments,
    26482648                                      it->mpTarget);
    2649                 it->mpTarget->detachFrom(machineId, snapshotId);
     2649                it->mpTarget->removeBackReference(machineId, snapshotId);
    26502650            }
    26512651            else
     
    26732673                    AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS);
    26742674                    pAtt->updateMedium(it->mpTarget, false /* aImplicit */);
    2675                     it->mpTarget->attachTo(pMachine->mData->mUuid, childSnapshotId);
     2675                    it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId);
    26762676                }
    26772677            }
     
    31023102    {
    31033103        // reattach the source media to the snapshot
    3104         HRESULT rc = aSource->attachTo(aMachineId, aSnapshotId);
     3104        HRESULT rc = aSource->addBackReference(aMachineId, aSnapshotId);
    31053105        AssertComRC(rc);
    31063106    }
  • trunk/src/VBox/Main/include/MediumImpl.h

    r31098 r31236  
    167167    Utf8Str getName();
    168168
    169     HRESULT attachTo(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);
    173173
    174174    const Guid* getFirstMachineBackrefId() const;
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