Changeset 41120 in vbox
- Timestamp:
- May 2, 2012 2:55:59 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r41106 r41120 226 226 /* VBoxManageDisk.cpp */ 227 227 HRESULT 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); 230 230 HRESULT findOrOpenMedium(HandlerArg *a, const char *pszFilenameOrUuid, 231 231 DeviceType_T enmDevType, ComPtr<IMedium> &pMedium, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r41106 r41120 171 171 172 172 if (!fSilent) 173 CHECK_ERROR(a->virtualBox, FindMedium(Bstr(pszFilenameOrUuid).raw(), 174 enmDevType, pMedium.asOutParam())); 173 CHECK_ERROR(a->virtualBox, OpenMedium(Bstr(pszFilenameOrUuid).raw(), 174 enmDevType, AccessMode_ReadWrite, 175 /* fForceNewUuidOnOpen */ false, 176 pMedium.asOutParam())); 175 177 else 176 rc = a->virtualBox->FindMedium(Bstr(pszFilenameOrUuid).raw(), 177 enmDevType, pMedium.asOutParam()); 178 rc = a->virtualBox->OpenMedium(Bstr(pszFilenameOrUuid).raw(), 179 enmDevType, AccessMode_ReadWrite, 180 /* fForceNewUuidOnOpen */ false, 181 pMedium.asOutParam()); 178 182 return rc; 179 183 } … … 200 204 } 201 205 202 rc = a->virtualBox->FindMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, 206 rc = a->virtualBox->OpenMedium(Bstr(pszFilenameOrUuid).raw(), 207 enmDevType, AccessMode_ReadWrite, 208 /* fForceNewUuidOnOpen */ false, 203 209 pMedium.asOutParam()); 204 210 /* If the medium is unknown try to open it. */ -
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r41106 r41120 1462 1462 */ 1463 1463 Bstr bstrHdaFile(hdaFile); 1464 pVirtualBox->FindMedium(bstrHdaFile.raw(), DeviceType_HardDisk, 1464 pVirtualBox->OpenMedium(bstrHdaFile.raw(), DeviceType_HardDisk, 1465 AccessMode_ReadWrite, FALSE /* fForceNewUuid */, 1465 1466 pMedium.asOutParam()); 1466 1467 if (!pMedium) … … 1545 1546 { 1546 1547 /* try to find an existing one */ 1547 rc = pVirtualBox->FindMedium(bstrFdaFile.raw(), DeviceType_Floppy, 1548 rc = pVirtualBox->OpenMedium(bstrFdaFile.raw(), 1549 DeviceType_Floppy, 1550 AccessMode_ReadWrite, 1551 FALSE /* fForceNewUuid */, 1548 1552 pMedium.asOutParam()); 1549 1553 if (FAILED(rc)) … … 1626 1630 { 1627 1631 /* try to find an existing one */ 1628 rc = pVirtualBox->FindMedium(bstrCdromFile.raw(), DeviceType_DVD, 1629 pMedium.asOutParam()); 1632 rc = pVirtualBox->OpenMedium(bstrCdromFile.raw(), 1633 DeviceType_DVD, 1634 AccessMode_ReadWrite, 1635 FALSE /* fForceNewUuid */, 1636 pMedium.asOutParam()); 1630 1637 if (FAILED(rc)) 1631 1638 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r41107 r41120 425 425 { 426 426 QString strUuid; 427 CMedium image = vbox. FindMedium(strSource, KDeviceType_DVD);427 CMedium image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite, false /* fForceNewUuid */); 428 428 if (image.isNull()) 429 429 { -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r41113 r41120 1958 1958 <param name="medium" type="IMedium" dir="return"> 1959 1959 <desc>Opened medium object.</desc> 1960 </param>1961 </method>1962 1963 <method name="findMedium">1964 <desc>1965 Returns a medium of the given type that uses the given fully qualified1966 location or UUID to store medium data.1967 1968 The given medium must be known to this VirtualBox installation, i.e.1969 it must be previously created by <link to="#createHardDisk"/> or opened1970 by <link to="#openMedium"/>.1971 1972 The search is done by comparing the value of the @a location argument to1973 the <link to="IMedium::location"/> and <link to="IMedium::id" />1974 attributes of each known medium.1975 1976 On case sensitive file systems, a case sensitive comparison is performed,1977 otherwise the case of symbols in the file path is ignored.1978 1979 <result name="VBOX_E_OBJECT_NOT_FOUND">1980 No medium object matching @a location found.1981 </result>1982 </desc>1983 <param name="location" type="wstring" dir="in">1984 <desc>What to search for. This can either be the UUID or the location string of an open medium.</desc>1985 </param>1986 <param name="type" type="DeviceType" dir="in">1987 <desc>Device type (must be HardDisk, DVD or Floppy)</desc>1988 </param>1989 <param name="medium" type="IMedium" dir="return">1990 <desc>Medium object, if found.</desc>1991 1960 </param> 1992 1961 </method> -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r41106 r41120 145 145 BOOL fForceNewUuid, 146 146 IMedium **aMedium); 147 STDMETHOD(FindMedium)(IN_BSTR aLocation,148 DeviceType_T deviceType,149 IMedium **aMedium);150 147 151 148 STDMETHOD(GetGuestOSType)(IN_BSTR aId, IGuestOSType **aType); -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r41106 r41120 627 627 /** @todo: Maybe too cost-intensive; try to find a lighter way */ 628 628 while ( RTPathExists(tmpName) 629 || mVirtualBox-> FindMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, &harddisk) != VBOX_E_OBJECT_NOT_FOUND629 || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, &harddisk) 630 630 ) 631 631 { -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r41106 r41120 795 795 796 796 Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw())); 797 HRESULT rc = mVirtualBox->FindMedium(bstrSrcFilePath.raw(), DeviceType_HardDisk,pSourceDisk.asOutParam());797 HRESULT rc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */, pSourceDisk.asOutParam()); 798 798 if (FAILED(rc)) throw rc; 799 799 -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r41106 r41120 1771 1771 } 1772 1772 1773 STDMETHODIMP 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 else1795 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 else1803 rc = findDVDOrFloppyImage(aDeviceType, NULL, strLocation, true /* setError */, &pMedium);1804 break;1805 1806 default:1807 return setError(E_INVALIDARG,1808 tr("Invalid device type %d"), aDeviceType);1809 }1810 1811 /* the below will set *aHardDisk to NULL if hardDisk is null */1812 pMedium.queryInterfaceTo(aMedium);1813 1814 return rc;1815 }1816 1773 1817 1774 /** @note Locks this object for reading. */
Note:
See TracChangeset
for help on using the changeset viewer.