Changeset 37586 in vbox
- Timestamp:
- Jun 22, 2011 11:49:40 AM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MediumFormatImpl.h
r35638 r37586 7 7 8 8 /* 9 * Copyright (C) 2008-201 0Oracle Corporation9 * Copyright (C) 2008-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 65 65 const StrList llFileExtensions; 66 66 const DeviceTypeList llDeviceTypes; 67 const uint64_tcapabilities;67 const MediumFormatCapabilities_T capabilities; 68 68 const PropertyList llProperties; 69 69 }; … … 112 112 const StrList& getFileExtensions() const { return m.llFileExtensions; } 113 113 /** Const, no need to lock */ 114 uint64_tgetCapabilities() const { return m.capabilities; }114 MediumFormatCapabilities_T getCapabilities() const { return m.capabilities; } 115 115 /** Const, no need to lock */ 116 116 const PropertyList& getProperties() const { return m.llProperties; } -
trunk/src/VBox/Main/src-server/MediumFormatImpl.cpp
r37423 r37586 6 6 7 7 /* 8 * Copyright (C) 2008-201 0Oracle Corporation8 * Copyright (C) 2008-2011 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 66 66 * name/description field. */ 67 67 unconst(m.strName) = aVDInfo->pszBackend; 68 /* The capabilities of the backend */68 /* The capabilities of the backend. Assumes 1:1 mapping! */ 69 69 unconst(m.capabilities) = aVDInfo->uBackendCaps; 70 70 /* Save the supported file extensions in a list */ -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r37525 r37586 923 923 * file. 924 924 * 925 * For hard disks that don't have the VD_CAP_CREATE_FIXEDor926 * VD_CAP_CREATE_DYNAMICcapability (and therefore cannot be created or deleted925 * For hard disks that don't have the MediumFormatCapabilities_CreateFixed or 926 * MediumFormatCapabilities_CreateDynamic capability (and therefore cannot be created or deleted 927 927 * with the means of VirtualBox) the associated storage unit is assumed to be 928 928 * ready for use so the state of the hard disk object will be set to Created. … … 1185 1185 } 1186 1186 1187 // compose full path of the medium, if it's not fully qualified...1188 // slightly convoluted logic here. If the caller has given us a1189 // machine folder, then a relative path will be relative to that:1190 1187 Utf8Str strFull; 1191 if ( !strMachineFolder.isEmpty() 1192 && !RTPathStartsWithRoot(data.strLocation.c_str()) 1193 ) 1194 { 1195 strFull = strMachineFolder; 1196 strFull += RTPATH_SLASH; 1197 strFull += data.strLocation; 1188 if (m->formatObj->getCapabilities() & MediumFormatCapabilities_File) 1189 { 1190 // compose full path of the medium, if it's not fully qualified... 1191 // slightly convoluted logic here. If the caller has given us a 1192 // machine folder, then a relative path will be relative to that: 1193 if ( !strMachineFolder.isEmpty() 1194 && !RTPathStartsWithRoot(data.strLocation.c_str()) 1195 ) 1196 { 1197 strFull = strMachineFolder; 1198 strFull += RTPATH_SLASH; 1199 strFull += data.strLocation; 1200 } 1201 else 1202 { 1203 // Otherwise use the old VirtualBox "make absolute path" logic: 1204 rc = m->pVirtualBox->calculateFullPath(data.strLocation, strFull); 1205 if (FAILED(rc)) return rc; 1206 } 1198 1207 } 1199 1208 else 1200 { 1201 // Otherwise use the old VirtualBox "make absolute path" logic: 1202 rc = m->pVirtualBox->calculateFullPath(data.strLocation, strFull); 1203 if (FAILED(rc)) return rc; 1204 } 1209 strFull = data.strLocation; 1205 1210 1206 1211 rc = setLocation(strFull); … … 5678 5683 } 5679 5684 5680 // we must always have full paths now 5681 if (!RTPathStartsWithRoot(locationFull.c_str())) 5685 // we must always have full paths now (if it refers to a file) 5686 if ( (m->formatObj->getCapabilities() & MediumFormatCapabilities_File) 5687 && !RTPathStartsWithRoot(locationFull.c_str())) 5682 5688 return setError(VBOX_E_FILE_ERROR, 5683 5689 tr("The given path '%s' is not fully qualified"), … … 6198 6204 Utf8Str location(m->strLocationFull); 6199 6205 uint64_t capabilities = m->formatObj->getCapabilities(); 6200 ComAssertThrow(capabilities & ( VD_CAP_CREATE_FIXED6201 | VD_CAP_CREATE_DYNAMIC), E_FAIL);6206 ComAssertThrow(capabilities & ( MediumFormatCapabilities_CreateFixed 6207 | MediumFormatCapabilities_CreateDynamic), E_FAIL); 6202 6208 Assert(m->state == MediumState_Creating); 6203 6209 … … 6212 6218 { 6213 6219 /* ensure the directory exists */ 6214 if (capabilities & VD_CAP_FILE)6220 if (capabilities & MediumFormatCapabilities_File) 6215 6221 { 6216 6222 rc = VirtualBox::ensureFilePathExists(location); … … 6329 6335 Utf8Str targetLocation(pTarget->m->strLocationFull); 6330 6336 uint64_t capabilities = pTarget->m->formatObj->getCapabilities(); 6331 ComAssertThrow(capabilities & VD_CAP_CREATE_DYNAMIC, E_FAIL);6337 ComAssertThrow(capabilities & MediumFormatCapabilities_CreateDynamic, E_FAIL); 6332 6338 6333 6339 Assert(pTarget->m->state == MediumState_Creating); … … 6379 6385 6380 6386 /* ensure the target directory exists */ 6381 if (capabilities & VD_CAP_FILE)6387 if (capabilities & MediumFormatCapabilities_File) 6382 6388 { 6383 6389 HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation); … … 6882 6888 6883 6889 /* ensure the target directory exists */ 6884 if (capabilities & VD_CAP_FILE)6890 if (capabilities & MediumFormatCapabilities_File) 6885 6891 { 6886 6892 HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation); … … 7531 7537 7532 7538 /* ensure the target directory exists */ 7533 if (capabilities & VD_CAP_FILE)7539 if (capabilities & MediumFormatCapabilities_File) 7534 7540 { 7535 7541 rc = VirtualBox::ensureFilePathExists(targetLocation); … … 7656 7662 7657 7663 /* ensure the target directory exists */ 7658 if (capabilities & VD_CAP_FILE)7664 if (capabilities & MediumFormatCapabilities_File) 7659 7665 { 7660 7666 HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation);
Note:
See TracChangeset
for help on using the changeset viewer.