VirtualBox

Changeset 41105 in vbox


Ignore:
Timestamp:
May 1, 2012 6:14:46 PM (13 years ago)
Author:
vboxsync
Message:

use openMedium instead of findMedium

Location:
trunk/src/VBox
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r40470 r41105  
    226226/* VBoxManageDisk.cpp */
    227227HRESULT findMedium(HandlerArg *a, const char *pszFilenameOrUuid,
    228                    DeviceType_T enmDevType, bool fSilent,
    229                    ComPtr<IMedium> &pMedium);
     228                    DeviceType_T enmDevType, bool fSilent,
     229                    ComPtr<IMedium> &pMedium);
    230230HRESULT findOrOpenMedium(HandlerArg *a, const char *pszFilenameOrUuid,
    231231                         DeviceType_T enmDevType, ComPtr<IMedium> &pMedium,
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp

    r40905 r41105  
    171171
    172172    if (!fSilent)
     173 #if 0 // Substitute call to FindMedium to OpenMedium
    173174        CHECK_ERROR(a->virtualBox, FindMedium(Bstr(pszFilenameOrUuid).raw(),
    174175                                              enmDevType, pMedium.asOutParam()));
     176 #endif
     177        CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(pszFilenameOrUuid).raw(),
     178                                              enmDevType, AccessMode_ReadWrite,
     179                                              /* fForceNewUuidOnOpen */ false,
     180                                              pMedium.asOutParam()));
    175181    else
     182 #if 0 // Substitute call to FindMedium to OpenMedium
    176183        rc = a->virtualBox->FindMedium(Bstr(pszFilenameOrUuid).raw(),
    177                                        enmDevType, pMedium.asOutParam());
     184                                        enmDevType, pMedium.asOutParam());
     185 #endif
     186        rc = a->virtualBox->OpenMedium(Bstr(pszFilenameOrUuid).raw(),
     187                                            enmDevType, AccessMode_ReadWrite,
     188                                            /* fForceNewUuidOnOpen */ false,
     189                                            pMedium.asOutParam());
    178190    return rc;
    179191}
     
    200212    }
    201213
     214#if 0 // Substitute call to FindMedium to OpenMedium
    202215    rc = a->virtualBox->FindMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType,
    203216                                   pMedium.asOutParam());
     217#endif
     218
     219    rc = a->virtualBox->OpenMedium(Bstr(pszFilenameOrUuid).raw(),
     220                                        enmDevType, AccessMode_ReadWrite,
     221                                        fForceNewUuidOnOpen,
     222                                        pMedium.asOutParam());
    204223    /* If the medium is unknown try to open it. */
    205224    if (!pMedium)
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r41100 r41105  
    14621462         */
    14631463        Bstr bstrHdaFile(hdaFile);
     1464#if 0 // Substitute call to FindMedium to OpenMedium
    14641465        pVirtualBox->FindMedium(bstrHdaFile.raw(), DeviceType_HardDisk,
     1466                                 pMedium.asOutParam());
     1467#endif
     1468        pVirtualBox->OpenMedium(bstrHdaFile.raw(), DeviceType_HardDisk,
     1469                                AccessMode_ReadWrite, FALSE /* fForceNewUuid */,
    14651470                                pMedium.asOutParam());
    14661471        if (!pMedium)
     
    15451550            {
    15461551                /* try to find an existing one */
     1552#if 0 // Substitute call to FindMedium to OpenMedium
    15471553                rc = pVirtualBox->FindMedium(bstrFdaFile.raw(), DeviceType_Floppy,
    15481554                                             pMedium.asOutParam());
     1555#endif
     1556                rc = pVirtualBox->OpenMedium(bstrFdaFile.raw(),
     1557                                            DeviceType_Floppy,
     1558                                            AccessMode_ReadWrite,
     1559                                            FALSE /* fForceNewUuid */,
     1560                                            pMedium.asOutParam());
    15491561                if (FAILED(rc))
    15501562                {
     
    16261638            {
    16271639                /* try to find an existing one */
     1640#if 0 // Substitute call to FindMedium to OpenMedium
    16281641                rc = pVirtualBox->FindMedium(bstrCdromFile.raw(), DeviceType_DVD,
    16291642                                             pMedium.asOutParam());
     1643#endif
     1644                rc = pVirtualBox->OpenMedium(bstrCdromFile.raw(), DeviceType_DVD,
     1645                                             AccessMode_ReadWrite, FALSE /* fForceNewUuid */,
     1646                                             pMedium.asOutParam());
    16301647                if (FAILED(rc))
    16311648                {
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r41051 r41105  
    425425    {
    426426        QString strUuid;
     427#if 0 // Substitute call to FindMedium to OpenMedium
    427428        CMedium image = vbox.FindMedium(strSource, KDeviceType_DVD);
     429#endif
     430
     431        CMedium image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite, false /* fForceNewUuid */);
    428432        if (image.isNull())
    429433        {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r41049 r41105  
    19571957      <param name="medium" type="IMedium" dir="return">
    19581958        <desc>Opened medium object.</desc>
    1959       </param>
    1960     </method>
    1961 
    1962     <method name="findMedium">
    1963       <desc>
    1964         Returns a medium of the given type that uses the given fully qualified
    1965         location or UUID to store medium data.
    1966 
    1967         The given medium must be known to this VirtualBox installation, i.e.
    1968         it must be previously created by <link to="#createHardDisk"/> or opened
    1969         by <link to="#openMedium"/>.
    1970 
    1971         The search is done by comparing the value of the @a location argument to
    1972         the <link to="IMedium::location"/> and <link to="IMedium::id" />
    1973         attributes of each known medium.
    1974 
    1975         On case sensitive file systems, a case sensitive comparison is performed,
    1976         otherwise the case of symbols in the file path is ignored.
    1977 
    1978         <result name="VBOX_E_OBJECT_NOT_FOUND">
    1979           No medium object matching @a location found.
    1980         </result>
    1981       </desc>
    1982       <param name="location" type="wstring" dir="in">
    1983         <desc>What to search for. This can either be the UUID or the location string of an open medium.</desc>
    1984       </param>
    1985       <param name="type" type="DeviceType" dir="in">
    1986         <desc>Device type (must be HardDisk, DVD or Floppy)</desc>
    1987       </param>
    1988       <param name="medium" type="IMedium" dir="return">
    1989         <desc>Medium object, if found.</desc>
    19901959      </param>
    19911960    </method>
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r40539 r41105  
    145145                          BOOL fForceNewUuid,
    146146                          IMedium **aMedium);
    147     STDMETHOD(FindMedium)(IN_BSTR aLocation,
    148                           DeviceType_T deviceType,
    149                           IMedium **aMedium);
     147#if 0 // Remove def of fineMedium
     148     STDMETHOD(FindMedium)(IN_BSTR aLocation,
     149                           DeviceType_T deviceType,
     150                           IMedium **aMedium);
     151#endif
    150152
    151153    STDMETHOD(GetGuestOSType)(IN_BSTR aId, IGuestOSType **aType);
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r39248 r41105  
    626626     * already */
    627627    /** @todo: Maybe too cost-intensive; try to find a lighter way */
    628     while (    RTPathExists(tmpName)
    629             || mVirtualBox->FindMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, &harddisk) != VBOX_E_OBJECT_NOT_FOUND
    630           )
     628
     629#if 0 // Substitute call to FindMedium to OpenMedium
     630     while (    RTPathExists(tmpName)
     631             || mVirtualBox->FindMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, &harddisk) != VBOX_E_OBJECT_NOT_FOUND
     632           )
     633#endif
     634
     635     while ( RTPathExists(tmpName)
     636             || mVirtualBox->OpenMedium(Bstr(tmpName).raw(),
     637                                            DeviceType_HardDisk,
     638                                            AccessMode_ReadWrite,
     639                                            FALSE /* fForceNewUuid */,
     640                                            &harddisk) != VBOX_E_OBJECT_NOT_FOUND
     641          )
    631642    {
    632643        RTStrFree(tmpName);
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r40329 r41105  
    795795
    796796        Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw()));
     797
     798#if 0 // Substitute call to FindMedium to OpenMedium
    797799        HRESULT rc = mVirtualBox->FindMedium(bstrSrcFilePath.raw(), DeviceType_HardDisk, pSourceDisk.asOutParam());
     800#endif
     801        HRESULT rc  = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(),
     802                                            DeviceType_HardDisk,
     803                                            AccessMode_ReadWrite,
     804                                            FALSE /* fForceNewUuid */,
     805                                            pSourceDisk.asOutParam());
    798806        if (FAILED(rc)) throw rc;
    799807
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r41026 r41105  
    17711771}
    17721772
     1773#if 0 // FindMedium  is redundant
    17731774STDMETHODIMP VirtualBox::FindMedium(IN_BSTR   aLocation,
    1774                                     DeviceType_T aDeviceType,
    1775                                     IMedium **aMedium)
    1776 {
    1777     CheckComArgStrNotEmptyOrNull(aLocation);
    1778     CheckComArgOutPointerValid(aMedium);
    1779 
    1780     AutoCaller autoCaller(this);
    1781     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    1782 
    1783     Guid id(aLocation);
    1784     Utf8Str strLocation(aLocation);
    1785 
    1786     HRESULT rc;
    1787     ComObjPtr<Medium> pMedium;
    1788 
    1789     switch (aDeviceType)
    1790     {
    1791         case DeviceType_HardDisk:
    1792             if (!id.isEmpty())
    1793                 rc = findHardDiskById(id, true /* setError */, &pMedium);
    1794             else
    1795                 rc = findHardDiskByLocation(strLocation, true /* setError */, &pMedium);
    1796         break;
    1797 
    1798         case DeviceType_Floppy:
    1799         case DeviceType_DVD:
    1800             if (!id.isEmpty())
    1801                 rc = findDVDOrFloppyImage(aDeviceType, &id, Utf8Str::Empty, true /* setError */, &pMedium);
    1802             else
    1803                 rc = findDVDOrFloppyImage(aDeviceType, NULL, strLocation, true /* setError */, &pMedium);
    1804         break;
    1805 
    1806         default:
     1775                                     DeviceType_T aDeviceType,
     1776                                     IMedium **aMedium)
     1777{
     1778     CheckComArgStrNotEmptyOrNull(aLocation);
     1779     CheckComArgOutPointerValid(aMedium);
     1780
     1781     AutoCaller autoCaller(this);
     1782     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     1783
     1784     Guid id(aLocation);
     1785     Utf8Str strLocation(aLocation);
     1786
     1787     HRESULT rc;
     1788     ComObjPtr<Medium> pMedium;
     1789 
     1790     switch (aDeviceType)
     1791     {
     1792         case DeviceType_HardDisk:
     1793             if (!id.isEmpty())
     1794                 rc = findHardDiskById(id, true /* setError */, &pMedium);
     1795             else
     1796                 rc = findHardDiskByLocation(strLocation, true /* setError */, &pMedium);
     1797         break;
     1798
     1799         case DeviceType_Floppy:
     1800         case DeviceType_DVD:
     1801             if (!id.isEmpty())
     1802                 rc = findDVDOrFloppyImage(aDeviceType, &id, Utf8Str::Empty, true /* setError */, &pMedium);
     1803             else
     1804                 rc = findDVDOrFloppyImage(aDeviceType, NULL, strLocation, true /* setError */, &pMedium);
     1805         break;
     1806
     1807         default:
    18071808            return setError(E_INVALIDARG,
    18081809                            tr("Invalid device type %d"), aDeviceType);
    1809     }
     1810}
     1811#endif
    18101812
    18111813    /* the below will set *aHardDisk to NULL if hardDisk is null */
    1812     pMedium.queryInterfaceTo(aMedium);
    1813 
    1814     return rc;
    1815 }
     1814//    pMedium.queryInterfaceTo(aMedium);
     1815
     1816//    return rc;
     1817//}
    18161818
    18171819/** @note Locks this object for reading. */
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