- Timestamp:
- Nov 14, 2008 5:55:28 PM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDisk2Impl.cpp
r14224 r14225 1653 1653 /* delegate the rest to the profi */ 1654 1654 cancelMergeTo (aChain); 1655 } 1656 1657 /** 1658 * Returns a preferred format for differencing hard disks. 1659 */ 1660 Bstr HardDisk2::preferredDiffFormat() 1661 { 1662 Bstr format; 1663 1664 AutoCaller autoCaller (this); 1665 AssertComRCReturn (autoCaller.rc(), format); 1666 1667 /* mm.format is const, no need to lock */ 1668 format = mm.format; 1669 1670 /* check that our own format supports diffs */ 1671 1672 /* lock system properties now to make the format check atomic with 1673 * defaultHardDiskFormat() */ 1674 AutoReadLock propsLock (mVirtualBox->systemProperties()); 1675 1676 ComObjPtr <HardDiskFormat> formatObj = 1677 mVirtualBox->systemProperties()->hardDiskFormat (format); 1678 AssertReturn (!formatObj.isNull(), format); 1679 1680 if (!(formatObj->capabilities() & HardDiskFormatCapabilities_Differencing)) 1681 format = mVirtualBox->systemProperties()->defaultHardDiskFormat(); 1682 1683 return format; 1655 1684 } 1656 1685 -
trunk/src/VBox/Main/HardDiskFormatImpl.cpp
r14009 r14225 61 61 62 62 /* The ID of the backend */ 63 unconst (m Data.id) = aVDInfo->pszBackend;63 unconst (m.id) = aVDInfo->pszBackend; 64 64 /* The Name of the backend */ 65 65 /* Use id for now as long as VDBACKENDINFO hasn't any extra 66 66 * name/description field. */ 67 unconst (m Data.name) = aVDInfo->pszBackend;67 unconst (m.name) = aVDInfo->pszBackend; 68 68 /* The capabilities of the backend */ 69 unconst (m Data.capabilities) = aVDInfo->uBackendCaps;69 unconst (m.capabilities) = aVDInfo->uBackendCaps; 70 70 /* Save the supported file extensions in a list */ 71 71 if (aVDInfo->papszFileExtensions) … … 74 74 while (*papsz != NULL) 75 75 { 76 unconst (m Data.fileExtensions).push_back (*papsz);76 unconst (m.fileExtensions).push_back (*papsz); 77 77 ++ papsz; 78 78 } … … 137 137 flags, 138 138 defaultValue }; 139 unconst (m Data.properties).push_back (prop);139 unconst (m.properties).push_back (prop); 140 140 ++ pa; 141 141 } … … 161 161 return; 162 162 163 unconst (m Data.properties).clear();164 unconst (m Data.fileExtensions).clear();165 unconst (m Data.capabilities) = 0;166 unconst (m Data.name).setNull();167 unconst (m Data.id).setNull();163 unconst (m.properties).clear(); 164 unconst (m.fileExtensions).clear(); 165 unconst (m.capabilities) = 0; 166 unconst (m.name).setNull(); 167 unconst (m.id).setNull(); 168 168 } 169 169 … … 180 180 181 181 /* this is const, no need to lock */ 182 m Data.id.cloneTo (aId);182 m.id.cloneTo (aId); 183 183 184 184 return S_OK; … … 194 194 195 195 /* this is const, no need to lock */ 196 m Data.name.cloneTo (aName);196 m.name.cloneTo (aName); 197 197 198 198 return S_OK; … … 209 209 210 210 /* this is const, no need to lock */ 211 com::SafeArray <BSTR> fileExtentions (m Data.fileExtensions.size());211 com::SafeArray <BSTR> fileExtentions (m.fileExtensions.size()); 212 212 int i = 0; 213 for (BstrList::const_iterator it = m Data.fileExtensions.begin();214 it != m Data.fileExtensions.end(); ++ it, ++ i)213 for (BstrList::const_iterator it = m.fileExtensions.begin(); 214 it != m.fileExtensions.end(); ++ it, ++ i) 215 215 (*it).cloneTo (&fileExtentions [i]); 216 216 fileExtentions.detachTo (ComSafeArrayOutArg (aFileExtensions)); … … 227 227 CheckComRCReturnRC (autoCaller.rc()); 228 228 229 /* m Data.capabilities is const, no need to lock */229 /* m.capabilities is const, no need to lock */ 230 230 231 231 /// @todo add COMGETTER(ExtendedCapabilities) when we reach the 32 bit … … 233 233 /// of defining enums (used to represent bit flags) that contain 64-bit 234 234 /// values) 235 ComAssertRet (m Data.capabilities == ((ULONG) mData.capabilities), E_FAIL);236 237 *aCaps = (ULONG) m Data.capabilities;235 ComAssertRet (m.capabilities == ((ULONG) m.capabilities), E_FAIL); 236 237 *aCaps = (ULONG) m.capabilities; 238 238 239 239 return S_OK; … … 257 257 258 258 /* this is const, no need to lock */ 259 com::SafeArray <BSTR> propertyNames (m Data.properties.size());260 com::SafeArray <BSTR> propertyDescriptions (m Data.properties.size());261 com::SafeArray <DataType_T> propertyTypes (m Data.properties.size());262 com::SafeArray <ULONG> propertyFlags (m Data.properties.size());263 com::SafeArray <BSTR> propertyDefaults (m Data.properties.size());259 com::SafeArray <BSTR> propertyNames (m.properties.size()); 260 com::SafeArray <BSTR> propertyDescriptions (m.properties.size()); 261 com::SafeArray <DataType_T> propertyTypes (m.properties.size()); 262 com::SafeArray <ULONG> propertyFlags (m.properties.size()); 263 com::SafeArray <BSTR> propertyDefaults (m.properties.size()); 264 264 265 265 int i = 0; 266 for (PropertyList::const_iterator it = m Data.properties.begin();267 it != m Data.properties.end(); ++ it, ++ i)266 for (PropertyList::const_iterator it = m.properties.begin(); 267 it != m.properties.end(); ++ it, ++ i) 268 268 { 269 269 const Property &prop = (*it); -
trunk/src/VBox/Main/MachineImpl.cpp
r14142 r14225 2131 2131 } 2132 2132 2133 /// @todo NEWMEDIA use the proper storage format (either the parent2134 /// storage type or the ISystemProperties::defaultHardDiskFormat)2135 2133 ComObjPtr <HardDisk2> diff; 2136 2134 diff.createObject(); 2137 rc = diff->init (mParent, Bstr ("VDI"),2135 rc = diff->init (mParent, hd->preferredDiffFormat(), 2138 2136 BstrFmt ("%ls"RTPATH_SLASH_STR, 2139 2137 mUserData->mSnapshotFolderFull.raw())); … … 6862 6860 CheckComRCThrowRC (rc); 6863 6861 6864 /// @todo NEWMEDIA use the proper storage format (either the parent6865 /// storage type or the ISystemProperties::defaultHardDiskFormat)6866 6862 ComObjPtr <HardDisk2> diff; 6867 6863 diff.createObject(); 6868 rc = diff->init (mParent, Bstr ("VDI"),6864 rc = diff->init (mParent, hd->preferredDiffFormat(), 6869 6865 BstrFmt ("%ls"RTPATH_SLASH_STR, 6870 6866 mUserData->mSnapshotFolderFull.raw())); -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r14224 r14225 602 602 } 603 603 604 /** 605 * Rerurns a hard disk format object corresponding to the given format 606 * identifier or null if no such format. 607 * 608 * @param aFormat Format identifier. 609 * 610 * @return ComObjPtr<HardDiskFormat> 611 */ 612 ComObjPtr <HardDiskFormat> SystemProperties::hardDiskFormat (const BSTR aFormat) 613 { 614 ComObjPtr <HardDiskFormat> format; 615 616 AutoCaller autoCaller (this); 617 AssertComRCReturn (autoCaller.rc(), format); 618 619 AutoReadLock alock (this); 620 621 for (HardDiskFormatList::const_iterator it = mHardDiskFormats.begin(); 622 it != mHardDiskFormats.end(); ++ it) 623 { 624 /* HardDiskFormat is all const, no need to lock */ 625 626 if ((*it)->id() == aFormat) 627 { 628 format = *it; 629 break; 630 } 631 } 632 633 return format; 634 } 635 604 636 // private methods 605 637 ///////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/Main/include/HardDisk2Impl.h
r14143 r14225 180 180 void cancelDiscard (MergeChain *aChain); 181 181 182 /** Returns a preferred format for a differencing hard disk. */ 183 Bstr preferredDiffFormat(); 184 182 185 // unsafe inline public methods for internal purposes only (ensure there is 183 186 // a caller and a read lock before calling them!) -
trunk/src/VBox/Main/include/HardDiskFormatImpl.h
r13956 r14225 81 81 // (ensure there is a caller and a read lock before calling them!) 82 82 83 /** Const, no need to lock */ 84 const Bstr &id() { return m.id; } 85 /** Const, no need to lock */ 86 uint64_t capabilities() { return m.capabilities; } 87 83 88 // for VirtualBoxSupportErrorInfoImpl 84 89 static const wchar_t *getComponentName() { return L"HardDiskFormat"; } … … 109 114 }; 110 115 111 Data m Data;116 Data m; 112 117 }; 113 118 -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r14224 r14225 96 96 HRESULT saveSettings (settings::Key &aGlobal); 97 97 98 ComObjPtr <HardDiskFormat> hardDiskFormat (const BSTR aFormat); 99 100 // public methods for internal purposes only 101 // (ensure there is a caller and a read lock before calling them!) 102 98 103 /** Default Machine path (as is, not full). Not thread safe (use object lock). */ 99 104 const Bstr &defaultMachineFolder() const { return mDefaultMachineFolder; }
Note:
See TracChangeset
for help on using the changeset viewer.