VirtualBox

Changeset 24210 in vbox


Ignore:
Timestamp:
Oct 30, 2009 4:30:19 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54157
Message:

Main/Medium: substantial fixing of Medium::queryInfo(), and eliminate some dead code

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

Legend:

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

    r24209 r24210  
    9090        : state(MediumState_NotCreated),
    9191          size(0),
     92          preLockState(MediumState_NotCreated),
    9293          readers(0),
    9394          queryInfoSem(NIL_RTSEMEVENTMULTI),
    94           queryInfoCallers(0),
    95           accessibleInLock(false),
     95          queryInfoRunning(false),
    9696          type(MediumType_Normal),
    9797          devType(DeviceType_HardDisk),
     
    119119
    120120    size_t readers;
     121    MediumState_T preLockState;
    121122
    122123    RTSEMEVENTMULTI queryInfoSem;
    123     size_t queryInfoCallers;
    124 
    125     bool accessibleInLock : 1;
     124    bool queryInfoRunning : 1;
    126125
    127126    const Bstr format;
     
    416415
    417416        /* We have to fetch the state with the COM method, cause it's possible
    418            that the medium isn't fully initialized yet. See HRESULT
    419            Medium::protectedInit(VirtualBox *aVirtualBox, const
    420            settings::Key &aImageNode) for an explanation why. */
     417           that the medium isn't fully initialized yet. */
    421418        MediumState_T m;
    422419        rc = aMedium->COMGETTER(State)(&m);
     
    854851    AssertRCReturn(vrc, E_FAIL);
    855852
     853    vrc = RTSemEventMultiCreate(&m->queryInfoSem);
     854    AssertRCReturn(vrc, E_FAIL);
     855    vrc = RTSemEventMultiSignal(m->queryInfoSem);
     856    AssertRCReturn(vrc, E_FAIL);
     857
    856858    return S_OK;
    857859}
     
    13021304    }
    13031305
     1306    RTSemEventMultiSignal(m->queryInfoSem);
     1307    RTSemEventMultiDestroy(m->queryInfoSem);
     1308    m->queryInfoSem = NIL_RTSEMEVENTMULTI;
     1309
    13041310    unconst(mVirtualBox).setNull();
    13051311}
     
    18301836            ComAssertMsgBreak(m->readers != 0, ("Counter overflow"), rc = E_FAIL);
    18311837
    1832             if (m->state == MediumState_Created)
    1833                 m->accessibleInLock = true;
    1834             else if (m->state == MediumState_Inaccessible)
    1835                 m->accessibleInLock = false;
     1838            /* Remember pre-lock state */
     1839            if (m->state != MediumState_LockedRead)
     1840                m->preLockState = m->state;
    18361841
    18371842            LogFlowThisFunc(("Okay - prev state=%d readers=%d\n", m->state, m->readers));
     
    18681873        case MediumState_LockedRead:
    18691874        {
    1870             if (m->queryInfoSem == NIL_RTSEMEVENTMULTI)
    1871             {
    1872                 Assert(m->readers != 0);
    1873                 --m->readers;
    1874 
    1875                 /* Reset the state after the last reader */
    1876                 if (m->readers == 0)
    1877                 {
    1878                     if (m->accessibleInLock)
    1879                         m->state = MediumState_Created;
    1880                     else
    1881                         m->state = MediumState_Inaccessible;
    1882                 }
    1883 
    1884                 LogFlowThisFunc(("new state=%d\n", m->state));
    1885                 break;
    1886             }
    1887 
    1888             /* otherwise, queryInfo() is in progress; fall through */
     1875            Assert(m->readers != 0);
     1876            --m->readers;
     1877
     1878            /* Reset the state after the last reader */
     1879            if (m->readers == 0)
     1880                m->state = m->preLockState;
     1881
     1882            LogFlowThisFunc(("new state=%d\n", m->state));
     1883            break;
    18891884        }
    18901885        default:
     
    19271922        case MediumState_Inaccessible:
    19281923        {
    1929             if (m->state == MediumState_Created)
    1930                 m->accessibleInLock = true;
    1931             else if (m->state == MediumState_Inaccessible)
    1932                 m->accessibleInLock = false;
     1924            m->preLockState = m->state;
    19331925
    19341926            LogFlowThisFunc(("Okay - prev state=%d\n", m->state));
     
    19641956        case MediumState_LockedWrite:
    19651957        {
    1966             if (m->accessibleInLock)
    1967                 m->state = MediumState_Created;
    1968             else
    1969                 m->state = MediumState_Inaccessible;
     1958            m->state = m->preLockState;
    19701959            LogFlowThisFunc(("new state=%d\n", m->state));
    19711960            break;
     
    26522641    }
    26532642
    2654     HRESULT rc = canAttach(aMachineId, aSnapshotId);
    2655     CheckComRCReturnRC(rc);
     2643    if (m->numCreateDiffTasks > 0)
     2644        return setError(E_FAIL,
     2645                        tr("One or more differencing child hard disks are being created for the hard disk '%ls' (%u)"),
     2646                        m->locationFull.raw(), m->numCreateDiffTasks);
    26562647
    26572648    BackRefList::iterator it =
     
    33543345}
    33553346
    3356 // protected methods
     3347// private methods
    33573348////////////////////////////////////////////////////////////////////////////////
    33583349
     
    35633554    AssertReturn(m->state == MediumState_Created ||
    35643555                 m->state == MediumState_Inaccessible ||
    3565                  m->state == MediumState_LockedRead ||
    3566                  m->state == MediumState_LockedWrite,
     3556                 m->state == MediumState_LockedRead,
    35673557                 E_FAIL);
    35683558
     
    35733563    /* check if a blocking queryInfo() call is in progress on some other thread,
    35743564     * and wait for it to finish if so instead of querying data ourselves */
    3575     if (m->queryInfoSem != NIL_RTSEMEVENTMULTI)
    3576     {
    3577         Assert(m->state == MediumState_LockedRead);
    3578 
    3579         ++m->queryInfoCallers;
     3565    if (m->queryInfoRunning)
     3566    {
     3567        Assert(   m->state == MediumState_LockedRead
     3568               || m->state == MediumState_LockedWrite);
     3569
    35803570        alock.leave();
    35813571
     
    35833573
    35843574        alock.enter();
    3585         --m->queryInfoCallers;
    3586 
    3587         if (m->queryInfoCallers == 0)
    3588         {
    3589             /* last waiting caller deletes the semaphore */
    3590             RTSemEventMultiDestroy(m->queryInfoSem);
    3591             m->queryInfoSem = NIL_RTSEMEVENTMULTI;
    3592         }
    35933575
    35943576        AssertRC(vrc);
     
    35963578        return S_OK;
    35973579    }
    3598 
    3599     /* lazily create a semaphore for possible callers */
    3600     vrc = RTSemEventMultiCreate(&m->queryInfoSem);
    3601     ComAssertRCRet(vrc, E_FAIL);
    3602 
    3603     bool tempStateSet = false;
    3604     if (m->state != MediumState_LockedRead &&
    3605         m->state != MediumState_LockedWrite)
    3606     {
    3607         /* Cause other methods to prevent any modifications before leaving the
    3608          * lock. Note that clients will never see this temporary state change
    3609          * since any COMGETTER(State) is (or will be) blocked until we finish
    3610          * and restore the actual state. */
    3611         LogFlowThisFunc(("read locking - prev state=%d - %ls\n", m->state, m->locationFull.raw()));
    3612         m->state = MediumState_LockedRead;
    3613         tempStateSet = true;
    3614     }
    3615 
    3616     /* leave the lock before a blocking operation */
    3617     alock.leave();
    36183580
    36193581    bool success = false;
    36203582    Utf8Str lastAccessError;
    36213583
     3584    /* are we dealing with a new medium constructed using the existing
     3585     * location? */
     3586    bool isImport = m->id.isEmpty();
     3587    unsigned flags = VD_OPEN_FLAGS_INFO;
     3588
     3589    /* Note that we don't use VD_OPEN_FLAGS_READONLY when opening new
     3590     * media because that would prevent necessary modifications
     3591     * when opening media of some third-party formats for the first
     3592     * time in VirtualBox (such as VMDK for which VDOpen() needs to
     3593     * generate an UUID if it is missing) */
     3594    if (    (m->hddOpenMode == OpenReadOnly)
     3595         || !isImport
     3596       )
     3597        flags |= VD_OPEN_FLAGS_READONLY;
     3598
     3599    /* Lock the medium, which makes the behavior much more consistent */
     3600    if (flags & VD_OPEN_FLAGS_READONLY)
     3601        rc = LockRead(NULL);
     3602    else
     3603        rc = LockWrite(NULL);
     3604    CheckComRCReturnRC(rc);
     3605
     3606    /* Copies of the input state fields which are not read-only,
     3607     * as we're dropping the lock. CAUTION: be extremely careful what
     3608     * you do with the contents of this medium object, as you will
     3609     * create races if there are concurrent changes. */
     3610    Utf8Str format(m->format);
     3611    Utf8Str location(m->locationFull);
     3612    ComObjPtr<MediumFormat> formatObj = m->formatObj;
     3613
     3614    /* "Output" values which can't be set because the lock isn't held
     3615     * at the time the values are determined. */
     3616    Guid mediumId = m->id;
     3617    uint64_t mediumSize = 0;
     3618    uint64_t mediumLogicalSize = 0;
     3619
     3620    /* leave the lock before a lengthy operation */
     3621    vrc = RTSemEventMultiReset(m->queryInfoSem);
     3622    ComAssertRCThrow(vrc, E_FAIL);
     3623    m->queryInfoRunning = true;
     3624    alock.leave();
     3625
    36223626    try
    36233627    {
    3624         Utf8Str location(m->locationFull);
    3625 
    3626         /* totally useless to do accessibility checks for host drives */
     3628        /* skip accessibility checks for host drives */
    36273629        if (m->hostDrive)
    36283630        {
     
    36303632            throw S_OK;
    36313633        }
    3632 
    3633         /* are we dealing with a new medium constructed using the existing
    3634          * location? */
    3635         bool isImport = m->id.isEmpty();
    36363634
    36373635        PVBOXHDD hdd;
     
    36413639        try
    36423640        {
    3643             unsigned flags = VD_OPEN_FLAGS_INFO;
    3644 
    3645             /* Note that we don't use VD_OPEN_FLAGS_READONLY when opening new
    3646              * media because that would prevent necessary modifications
    3647              * when opening media of some third-party formats for the first
    3648              * time in VirtualBox (such as VMDK for which VDOpen() needs to
    3649              * generate an UUID if it is missing) */
    3650             if (    (m->hddOpenMode == OpenReadOnly)
    3651                  || !isImport
    3652                )
    3653                 flags |= VD_OPEN_FLAGS_READONLY;
    3654 
    36553641            /** @todo This kind of opening of images is assuming that diff
    36563642             * images can be opened as base images. Should be fixed ASAP. */
    36573643            vrc = VDOpen(hdd,
    3658                          Utf8Str(m->format).c_str(),
     3644                         format.c_str(),
    36593645                         location.c_str(),
    36603646                         flags,
     
    36623648            if (RT_FAILURE(vrc))
    36633649            {
    3664                 lastAccessError = Utf8StrFmt(tr("Could not open the medium '%ls'%s"),
    3665                                              m->locationFull.raw(), vdError(vrc).raw());
     3650                lastAccessError = Utf8StrFmt(tr("Could not open the medium '%s'%s"),
     3651                                             location.c_str(), vdError(vrc).c_str());
    36663652                throw S_OK;
    36673653            }
    36683654
    3669             if (m->formatObj->capabilities() & MediumFormatCapabilities_Uuid)
     3655            if (formatObj->capabilities() & MediumFormatCapabilities_Uuid)
    36703656            {
    3671                 /* modify the UUIDs if necessary */
     3657                /* Modify the UUIDs if necessary. The associated fields are
     3658                 * not modified by other code, so no need to copy. */
    36723659                if (m->setImageId)
    36733660                {
     
    36933680                if (isImport)
    36943681                {
    3695                     unconst(m->id) = uuid;
    3696 
    3697                     if (m->id.isEmpty() && (m->hddOpenMode == OpenReadOnly))
     3682                    mediumId = uuid;
     3683
     3684                    if (mediumId.isEmpty() && (m->hddOpenMode == OpenReadOnly))
    36983685                        // only when importing a VDMK that has no UUID, create one in memory
    3699                         unconst(m->id).create();
     3686                        mediumId.create();
    37003687                }
    37013688                else
    37023689                {
    3703                     Assert(!m->id.isEmpty());
    3704 
    3705                     if (m->id != uuid)
     3690                    Assert(!mediumId.isEmpty());
     3691
     3692                    if (mediumId != uuid)
    37063693                    {
    37073694                        lastAccessError = Utf8StrFmt(
    3708                             tr("UUID {%RTuuid} of the medium '%ls' does not match the value {%RTuuid} stored in the media registry ('%ls')"),
    3709                             &uuid, m->locationFull.raw(), m->id.raw(),
     3695                            tr("UUID {%RTuuid} of the medium '%s' does not match the value {%RTuuid} stored in the media registry ('%ls')"),
     3696                            &uuid, location.c_str(), mediumId.raw(),
    37103697                            mVirtualBox->settingsFilePath().raw());
    37113698                        throw S_OK;
     
    37223709                {
    37233710                    if (m->setImageId)
    3724                         unconst(m->id) = m->imageId;
     3711                        mediumId = m->imageId;
    37253712                    else
    3726                         unconst(m->id).create();
     3713                        mediumId.create();
    37273714                }
    37283715            }
     
    37563743                    {
    37573744                        lastAccessError = Utf8StrFmt(
    3758                             tr("Parent hard disk with UUID {%RTuuid} of the hard disk '%ls' is not found in the media registry ('%ls')"),
    3759                             &parentId, m->locationFull.raw(),
     3745                            tr("Parent hard disk with UUID {%RTuuid} of the hard disk '%s' is not found in the media registry ('%ls')"),
     3746                            &parentId, location.c_str(),
    37603747                            mVirtualBox->settingsFilePath().raw());
    37613748                        throw S_OK;
     
    37853772                    {
    37863773                        lastAccessError = Utf8StrFmt(
    3787                             tr("Hard disk '%ls' is differencing but it is not associated with any parent hard disk in the media registry ('%ls')"),
    3788                             m->locationFull.raw(),
     3774                            tr("Hard disk '%s' is differencing but it is not associated with any parent hard disk in the media registry ('%ls')"),
     3775                            location.c_str(),
    37893776                            mVirtualBox->settingsFilePath().raw());
    37903777                        throw S_OK;
     
    37963783                    {
    37973784                        lastAccessError = Utf8StrFmt(
    3798                             tr ("Parent UUID {%RTuuid} of the hard disk '%ls' does not match UUID {%RTuuid} of its parent hard disk stored in the media registry ('%ls')"),
    3799                             &parentId, m->locationFull.raw(),
     3785                            tr ("Parent UUID {%RTuuid} of the hard disk '%s' does not match UUID {%RTuuid} of its parent hard disk stored in the media registry ('%ls')"),
     3786                            &parentId, location.c_str(),
    38003787                            mParent->id().raw(),
    38013788                            mVirtualBox->settingsFilePath().raw());
     
    38093796            }
    38103797
    3811             m->size = VDGetFileSize(hdd, 0);
    3812             m->logicalSize = VDGetSize(hdd, 0) / _1M;
     3798            mediumSize = VDGetFileSize(hdd, 0);
     3799            mediumLogicalSize = VDGetSize(hdd, 0) / _1M;
    38133800
    38143801            success = true;
     
    38293816    alock.enter();
    38303817
     3818    if (isImport)
     3819        unconst(m->id) = mediumId;
     3820
    38313821    if (success)
     3822    {
     3823        m->size = mediumSize;
     3824        m->logicalSize = mediumLogicalSize;
    38323825        m->lastAccessError.setNull();
     3826    }
    38333827    else
    38343828    {
    38353829        m->lastAccessError = lastAccessError;
    3836         LogWarningFunc(("'%ls' is not accessible (error='%ls', rc=%Rhrc, vrc=%Rrc)\n",
    3837                          m->locationFull.raw(), m->lastAccessError.raw(),
     3830        LogWarningFunc(("'%s' is not accessible (error='%ls', rc=%Rhrc, vrc=%Rrc)\n",
     3831                         location.c_str(), m->lastAccessError.raw(),
    38383832                         rc, vrc));
    38393833    }
    38403834
    38413835    /* inform other callers if there are any */
    3842     if (m->queryInfoCallers > 0)
    3843     {
    3844         RTSemEventMultiSignal(m->queryInfoSem);
    3845     }
     3836    RTSemEventMultiSignal(m->queryInfoSem);
     3837    m->queryInfoRunning = false;
     3838
     3839    /* Set the proper state according to the result of the check */
     3840    if (success)
     3841        m->preLockState = MediumState_Created;
    38463842    else
    3847     {
    3848         /* delete the semaphore ourselves */
    3849         RTSemEventMultiDestroy(m->queryInfoSem);
    3850         m->queryInfoSem = NIL_RTSEMEVENTMULTI;
    3851     }
    3852 
    3853     if (tempStateSet)
    3854     {
    3855         /* Set the proper state according to the result of the check */
    3856         if (success)
    3857             m->state = MediumState_Created;
    3858         else
    3859             m->state = MediumState_Inaccessible;
    3860         LogFlowThisFunc(("restored state=%d\n", m->state));
    3861     }
     3843        m->preLockState = MediumState_Inaccessible;
     3844
     3845    if (flags & VD_OPEN_FLAGS_READONLY)
     3846        rc = UnlockRead(NULL);
    38623847    else
    3863     {
    3864         /* we're locked, use a special field to store the result */
    3865         m->accessibleInLock = success;
    3866     }
     3848        rc = UnlockWrite(NULL);
     3849    CheckComRCReturnRC(rc);
    38673850
    38683851    return rc;
     
    44934476
    44944477/**
    4495  * Initializes the image medium object by opening an image file at the specified
    4496  * location.
    4497  *
    4498  * @param aVirtualBox   Parent VirtualBox object.
    4499  * @param aLocation     Path to the image file (can be relative to the
    4500  *                      VirtualBox home directory).
    4501  * @param aId           UUID of the image.
    4502  */
    4503 HRESULT Medium::protectedInit(VirtualBox *aVirtualBox, CBSTR aLocation,
    4504                               const Guid &aId)
    4505 {
    4506     LogFlowThisFunc(("aLocation='%ls', aId={%RTuuid}\n", aLocation, aId.raw()));
    4507 
    4508     AssertReturn(aVirtualBox, E_INVALIDARG);
    4509     AssertReturn(aLocation, E_INVALIDARG);
    4510     AssertReturn(!aId.isEmpty(), E_INVALIDARG);
    4511 
    4512     /* Enclose the state transition NotReady->InInit->Ready */
    4513     AutoInitSpan autoInitSpan(this);
    4514     AssertReturn(autoInitSpan.isOk(), E_FAIL);
    4515 
    4516     HRESULT rc = S_OK;
    4517 
    4518     /* share parent weakly */
    4519     unconst(mVirtualBox) = aVirtualBox;
    4520 
    4521     /* register with parent early, since uninit() will unconditionally
    4522      * unregister on failure */
    4523     mVirtualBox->addDependentChild(this);
    4524 
    4525     /* there must be a storage unit */
    4526     m->state = MediumState_Created;
    4527 
    4528     unconst(m->id) = aId;
    4529     rc = setLocation(aLocation);
    4530     CheckComRCReturnRC(rc);
    4531 
    4532     LogFlowThisFunc(("m->locationFull='%ls'\n", m->locationFull.raw()));
    4533 
    4534     /* get all the information about the medium from the file */
    4535     rc = queryInfo();
    4536 
    4537     if (SUCCEEDED(rc))
    4538     {
    4539         /* if the image file is not accessible, it's not acceptable for the
    4540          * newly opened media so convert this into an error */
    4541         if (!m->lastAccessError.isEmpty())
    4542             rc = setError(VBOX_E_FILE_ERROR, Utf8Str(m->lastAccessError).c_str());
    4543     }
    4544 
    4545     /* Confirm a successful initialization when it's the case */
    4546     if (SUCCEEDED(rc))
    4547         autoInitSpan.setSucceeded();
    4548 
    4549     return rc;
    4550 }
    4551 
    4552 /**
    4553  * Initializes the image medium object by loading its data from the given
    4554  * settings node.
    4555  *
    4556  * Note that it is assumed that this method is called only for registered media.
    4557  *
    4558  * @param aVirtualBox   Parent VirtualBox object.
    4559  * @param aImageNode    Either <DVDImage> or <FloppyImage> settings node.
    4560  */
    4561 HRESULT Medium::protectedInit(VirtualBox *aVirtualBox,
    4562                               const settings::Medium &data)
    4563 {
    4564     AssertReturn(aVirtualBox, E_INVALIDARG);
    4565 
    4566     /* Enclose the state transition NotReady->InInit->Ready */
    4567     AutoInitSpan autoInitSpan(this);
    4568     AssertReturn(autoInitSpan.isOk(), E_FAIL);
    4569 
    4570     HRESULT rc = S_OK;
    4571 
    4572     /* share parent weakly */
    4573     unconst(mVirtualBox) = aVirtualBox;
    4574 
    4575     /* register with parent early, since uninit() will unconditionally
    4576      * unregister on failure */
    4577     mVirtualBox->addDependentChild(this);
    4578 
    4579     /* see below why we don't call queryInfo() (and therefore treat the medium
    4580      * as inaccessible for now */
    4581     m->state = MediumState_Inaccessible;
    4582 
    4583     /* required */
    4584     unconst(m->id) = data.uuid;
    4585     /* required */
    4586     rc = setLocation(data.strLocation);
    4587     CheckComRCReturnRC(rc);
    4588 
    4589     m->description = data.strDescription;
    4590 
    4591     LogFlowThisFunc(("m->locationFull='%ls', m->id={%RTuuid}\n",
    4592                       m->locationFull.raw(), m->id.raw()));
    4593 
    4594     /* Don't call queryInfo() for registered media to prevent the calling
    4595      * thread (i.e. the VirtualBox server startup thread) from an unexpected
    4596      * freeze but mark it as initially inaccessible instead. The vital UUID and
    4597      * location properties are read from the registry file above; to get the
    4598      * actual state and the rest of the data, the user will have to call
    4599      * COMGETTER(State).*/
    4600 
    4601     /* Confirm a successful initialization when it's the case */
    4602     if (SUCCEEDED(rc))
    4603         autoInitSpan.setSucceeded();
    4604 
    4605     return rc;
    4606 }
    4607 
    4608 /**
    4609  * Uninitializes the instance.
    4610  *
    4611  * Called either from FinalRelease() or by the parent when it gets destroyed.
    4612  */
    4613 void Medium::protectedUninit()
    4614 {
    4615     LogFlowThisFunc(("\n"));
    4616 
    4617     /* Enclose the state transition Ready->InUninit->NotReady */
    4618     AutoUninitSpan autoUninitSpan(this);
    4619     if (autoUninitSpan.uninitDone())
    4620         return;
    4621 
    4622     mVirtualBox->removeDependentChild(this);
    4623 
    4624     unconst(mVirtualBox).setNull();
    4625 }
    4626 
    4627 // private methods
    4628 ////////////////////////////////////////////////////////////////////////////////
    4629 
    4630 /**
    46314478 * Checks that the format ID is valid and sets it on success.
    46324479 *
     
    46914538                        tr("Hard disk '%ls' has %d child hard disks"),
    46924539                        children().size());
    4693 
    4694     return S_OK;
    4695 }
    4696 
    4697 /**
    4698  * @note Called from within this object's AutoWriteLock.
    4699  */
    4700 HRESULT Medium::canAttach(const Guid & /* aMachineId */,
    4701                             const Guid & /* aSnapshotId */)
    4702 {
    4703     if (m->numCreateDiffTasks > 0)
    4704         return setError(E_FAIL,
    4705                         tr("One or more differencing child hard disks are being created for the hard disk '%ls' (%u)"),
    4706                         m->locationFull.raw(), m->numCreateDiffTasks);
    47074540
    47084541    return S_OK;
  • trunk/src/VBox/Main/include/MediumImpl.h

    r23947 r24210  
    166166    const Bstr& location() const;
    167167    const Bstr& locationFull() const;
    168 //     const BackRefList& backRefs() const;
    169168
    170169    const Guid* getFirstMachineBackrefId() const;
     
    261260protected:
    262261
    263     // protected initializer/uninitializer for internal purposes only
    264     HRESULT protectedInit(VirtualBox *aVirtualBox,
    265                           CBSTR aLocation,
    266                           const Guid &aId);
    267     HRESULT protectedInit(VirtualBox *aVirtualBox,
    268                           const settings::Medium &data);
    269     void protectedUninit();
     262    RWLockHandle* treeLock();
     263
     264    /** Reimplements VirtualBoxWithTypedChildren::childrenLock() to return
     265     *  treeLock(). */
     266    RWLockHandle *childrenLock() { return treeLock(); }
     267
     268private:
    270269
    271270    HRESULT queryInfo();
     
    280279
    281280    /**
    282      * Performs extra checks if the medium can be attached to the specified
    283      * VM and shapshot at the given time and returns S_OK in this case.
    284      * Otherwise, returns a respective error message. Called by attachTo() from
    285      * within this object's AutoWriteLock.
    286      */
    287     HRESULT canAttach(const Guid & /* aMachineId */,
    288                       const Guid & /* aSnapshotId */);
    289 
    290     /**
    291281     * Unregisters this medium with mVirtualBox. Called by Close() from within
    292282     * this object's AutoMayUninitSpan and from under mVirtualBox write lock.
     
    309299                    ComObjPtr<Progress> *aProgress,
    310300                    bool aWait);
    311 
    312     RWLockHandle* treeLock();
    313 
    314     /** Reimplements VirtualBoxWithTypedChildren::childrenLock() to return
    315      *  treeLock(). */
    316     RWLockHandle *childrenLock() { return treeLock(); }
    317 
    318 private:
    319301
    320302    HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str());
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette