Changeset 13673 in vbox
- Timestamp:
- Oct 30, 2008 1:04:36 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38632
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDiskFormatImpl.cpp
r13580 r13673 1 /* $Id 1 /* $Id$ */ 2 2 3 3 /** @file … … 50 50 * @param aVDInfo Pointer to a backend info object. 51 51 */ 52 HRESULT HardDiskFormat::init ( VDBACKENDINFO *aVDInfo)52 HRESULT HardDiskFormat::init (const VDBACKENDINFO *aVDInfo) 53 53 { 54 54 LogFlowThisFunc (("aVDInfo=%p\n", aVDInfo)); … … 62 62 /* The ID of the backend */ 63 63 unconst (mData.id) = aVDInfo->pszBackend; 64 /* The Name of the backend */ 65 /* Use id for now as long as VDBACKENDINFO hasn't any extra 66 * name/description field. */ 67 unconst (mData.name) = aVDInfo->pszBackend; 64 68 /* The capabilities of the backend */ 65 69 unconst (mData.capabilities) = aVDInfo->uBackendCaps; … … 74 78 } 75 79 } 80 /* Save a list of config names */ 81 if (aVDInfo->paConfigInfo) 82 { 83 PCVDCONFIGINFO pa = aVDInfo->paConfigInfo; 84 while (pa->pszKey != NULL) 85 { 86 unconst (mData.configNames).push_back (*pa->pszKey); 87 ++ pa; 88 } 89 } 76 90 77 91 /* Confirm a successful initialization */ … … 94 108 return; 95 109 110 unconst (mData.configNames).clear(); 96 111 unconst (mData.fileExtensions).clear(); 97 112 unconst (mData.capabilities) = 0; 113 unconst (mData.name).setNull(); 98 114 unconst (mData.id).setNull(); 99 115 } … … 110 126 CheckComRCReturnRC (autoCaller.rc()); 111 127 112 /* mData.id is const, no need to lock */ 113 128 /* this is const, no need to lock */ 114 129 mData.id.cloneTo (aId); 130 131 return S_OK; 132 } 133 134 STDMETHODIMP HardDiskFormat::COMGETTER(Name)(BSTR *aName) 135 { 136 if (!aName) 137 return E_POINTER; 138 139 AutoCaller autoCaller (this); 140 CheckComRCReturnRC (autoCaller.rc()); 141 142 /* this is const, no need to lock */ 143 mData.name.cloneTo (aName); 115 144 116 145 return S_OK; … … 126 155 CheckComRCReturnRC (autoCaller.rc()); 127 156 128 /* mData.fileExtensions is const, no need to lock */ 129 157 /* this is const, no need to lock */ 130 158 com::SafeArray <BSTR> fileExtentions (mData.fileExtensions.size()); 131 159 int i = 0; … … 138 166 } 139 167 140 STDMETHODIMP HardDiskFormat::COMGETTER(SupportUuid)(BOOL *aBool) 141 { 142 if (!aBool) 143 return E_POINTER; 144 145 AutoCaller autoCaller (this); 146 CheckComRCReturnRC (autoCaller.rc()); 147 148 /* mData.capabilities is const, no need to lock */ 149 150 *aBool = mData.capabilities & VD_CAP_UUID; 151 152 return S_OK; 153 } 154 155 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateFixed)(BOOL *aBool) 156 { 157 if (!aBool) 158 return E_POINTER; 159 160 AutoCaller autoCaller (this); 161 CheckComRCReturnRC (autoCaller.rc()); 162 163 /* mData.capabilities is const, no need to lock */ 164 165 *aBool = mData.capabilities & VD_CAP_CREATE_FIXED; 166 167 return S_OK; 168 } 169 170 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateDynamic)(BOOL *aBool) 171 { 172 if (!aBool) 173 return E_POINTER; 174 175 AutoCaller autoCaller (this); 176 CheckComRCReturnRC (autoCaller.rc()); 177 178 /* mData.capabilities is const, no need to lock */ 179 180 *aBool = mData.capabilities & VD_CAP_CREATE_DYNAMIC; 181 182 return S_OK; 183 } 184 185 STDMETHODIMP HardDiskFormat::COMGETTER(SupportCreateSplit2G)(BOOL *aBool) 186 { 187 if (!aBool) 188 return E_POINTER; 189 190 AutoCaller autoCaller (this); 191 CheckComRCReturnRC (autoCaller.rc()); 192 193 /* mData.capabilities is const, no need to lock */ 194 195 *aBool = mData.capabilities & VD_CAP_CREATE_SPLIT_2G; 196 197 return S_OK; 198 } 199 200 STDMETHODIMP HardDiskFormat::COMGETTER(SupportDiff)(BOOL *aBool) 201 { 202 if (!aBool) 203 return E_POINTER; 204 205 AutoCaller autoCaller (this); 206 CheckComRCReturnRC (autoCaller.rc()); 207 208 /* mData.capabilities is const, no need to lock */ 209 210 *aBool = mData.capabilities & VD_CAP_DIFF; 211 212 return S_OK; 213 } 214 215 STDMETHODIMP HardDiskFormat::COMGETTER(SupportASync)(BOOL *aBool) 216 { 217 if (!aBool) 218 return E_POINTER; 219 220 AutoCaller autoCaller (this); 221 CheckComRCReturnRC (autoCaller.rc()); 222 223 /* mData.capabilities is const, no need to lock */ 224 225 *aBool = mData.capabilities & VD_CAP_ASYNC; 226 227 return S_OK; 228 } 229 230 STDMETHODIMP HardDiskFormat::COMGETTER(SupportFile)(BOOL *aBool) 231 { 232 if (!aBool) 233 return E_POINTER; 234 235 AutoCaller autoCaller (this); 236 CheckComRCReturnRC (autoCaller.rc()); 237 238 /* mData.capabilities is const, no need to lock */ 239 240 *aBool = mData.capabilities & VD_CAP_FILE; 241 242 return S_OK; 243 } 244 245 STDMETHODIMP HardDiskFormat::COMGETTER(SupportConfig)(BOOL *aBool) 246 { 247 if (!aBool) 248 return E_POINTER; 249 250 AutoCaller autoCaller (this); 251 CheckComRCReturnRC (autoCaller.rc()); 252 253 /* mData.capabilities is const, no need to lock */ 254 255 *aBool = mData.capabilities & VD_CAP_CONFIG; 168 STDMETHODIMP HardDiskFormat::COMGETTER(Capabilities)(ULONG *aCaps) 169 { 170 if (!aCaps) 171 return E_POINTER; 172 173 AutoCaller autoCaller (this); 174 CheckComRCReturnRC (autoCaller.rc()); 175 176 /* this is const, no need to lock */ 177 *aCaps = mData.capabilities; 178 179 return S_OK; 180 } 181 182 STDMETHODIMP HardDiskFormat:: 183 COMGETTER(ConfigNames)(ComSafeArrayOut (BSTR, aConfigNames)) 184 { 185 if (ComSafeArrayOutIsNull (aConfigNames)) 186 return E_POINTER; 187 188 AutoCaller autoCaller (this); 189 CheckComRCReturnRC (autoCaller.rc()); 190 191 /* this is const, no need to lock */ 192 com::SafeArray <BSTR> configNames (mData.configNames.size()); 193 int i = 0; 194 for (BstrList::const_iterator it = mData.configNames.begin(); 195 it != mData.configNames.end(); ++ it, ++ i) 196 (*it).cloneTo (&configNames [i]); 197 configNames.detachTo (ComSafeArrayOutArg (aConfigNames)); 256 198 257 199 return S_OK; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r13588 r13673 7200 7200 --> 7201 7201 7202 <enum 7203 name="HardDiskFormatCaps" 7204 uuid="80aa4ab9-8abe-42f0-a270-225b8f9882fb" 7205 > 7206 <desc> 7207 Harddisk format capability flags. 7208 </desc> 7209 7210 <const name="CapilityUuid" value="0x00"> 7211 <desc> 7212 Supports UUIDs as expected by VirtualBox code. 7213 </desc> 7214 </const> 7215 7216 <const name="CapilityCreateFixed" value="0x01"> 7217 <desc> 7218 Supports creating fixed size images, allocating all space instantly. 7219 </desc> 7220 </const> 7221 7222 <const name="CapilityCreateDynamic" value="0x02"> 7223 <desc> 7224 Supports creating dynamically growing images, allocating space on 7225 demand. 7226 </desc> 7227 </const> 7228 7229 <const name="CapilityCreateSplit2G" value="0x04"> 7230 <desc> 7231 Supports creating images split in chunks of a bit less than 2GBytes. 7232 </desc> 7233 </const> 7234 7235 <const name="CapilityDiff" value="0x08"> 7236 <desc> 7237 Supports being used as differencing image format backend. 7238 </desc> 7239 </const> 7240 7241 <const name="CapilityASync" value="0x10"> 7242 <desc> 7243 Supports asynchronous I/O operations for at least some configurations. 7244 </desc> 7245 </const> 7246 7247 <const name="CapilityFile" value="0x20"> 7248 <desc> 7249 The backend operates on files. The caller needs to know to handle the 7250 location appropriately. For a list of supported file extentions see 7251 <link to="IHardDiskFormat::fileExtensions"/>. 7252 </desc> 7253 </const> 7254 7255 <const name="CapilityConfig" value="0x40"> 7256 <desc> 7257 The backend uses the config interface. The caller needs to know how to 7258 provide the mandatory configuration parts this way. 7259 7260 <see>IHardDiskFormat::configNames</see> 7261 </desc> 7262 </const> 7263 7264 <const name="CapilityMask" value="0x7F"/> 7265 </enum> 7266 7202 7267 <interface 7203 7268 name="IHardDiskFormat" extends="$unknown" 7204 uuid=" e4d3c3af-bcff-4b6a-a50f-854298864cb4"7269 uuid="3753099d-9c92-494f-ae2d-bd6faa857d95" 7205 7270 wsmap="managed" 7206 7271 > … … 7233 7298 </attribute> 7234 7299 7235 <attribute name="supportUuid" type="boolean" readonly="yes"> 7236 <desc> 7237 Supports UUIDs as expected by VirtualBox code. 7238 </desc> 7239 </attribute> 7240 7241 <attribute name="supportCreateFixed" type="boolean" readonly="yes"> 7242 <desc> 7243 Supports creating fixed size images, allocating all space instantly. 7244 </desc> 7245 </attribute> 7246 7247 <attribute name="supportCreateDynamic" type="boolean" readonly="yes"> 7248 <desc> 7249 Supports creating dynamically growing images, allocating space on 7250 demand. 7251 </desc> 7252 </attribute> 7253 7254 <attribute name="supportCreateSplit2G" type="boolean" readonly="yes"> 7255 <desc> 7256 Supports creating images split in chunks of a bit less than 2GBytes. 7257 </desc> 7258 </attribute> 7259 7260 <attribute name="supportDiff" type="boolean" readonly="yes"> 7261 <desc> 7262 Supports being used as differencing image format backend. 7263 </desc> 7264 </attribute> 7265 7266 <attribute name="supportASync" type="boolean" readonly="yes"> 7267 <desc> 7268 Supports asynchronous I/O operations for at least some configurations. 7269 </desc> 7270 </attribute> 7271 7272 <attribute name="supportFile" type="boolean" readonly="yes"> 7273 <desc> 7274 The backend operates on files. The caller needs to know to handle the 7275 location appropriately. For a list of supported file extentions see 7276 <link to="IHardDiskFormat::fileExtensions"/>. 7277 </desc> 7278 </attribute> 7279 7280 <attribute name="supportConfig" type="boolean" readonly="yes"> 7281 <desc> 7282 The backend uses the config interface. The caller needs to know how to 7283 provide the mandatory configuration parts this way. 7300 <attribute name="name" type="wstring" readonly="yes"> 7301 <desc> 7302 Human readable description of this format. 7303 7304 Mainly for use in file open dialogs. 7284 7305 </desc> 7285 7306 </attribute> … … 7297 7318 7298 7319 <see>IHardDiskFormat::supportFile</see> 7320 </desc> 7321 </attribute> 7322 7323 <attribute name="capabilities" type="unsigned long" readonly="yes"> 7324 <desc> 7325 The backend uses the config interface. The caller needs to know how to 7326 provide the mandatory configuration parts this way. For the meaning of 7327 the different capabilities see <link to="HardDiskFormatCaps"/>. 7328 </desc> 7329 </attribute> 7330 7331 <attribute name="configNames" type="wstring" safearray="yes" readonly="yes"> 7332 <desc> 7333 Array of strings containing the supported configuration keys. 7299 7334 </desc> 7300 7335 </attribute> -
trunk/src/VBox/Main/include/HardDiskFormatImpl.h
r13580 r13673 1 /* $Id 1 /* $Id$ */ 2 2 3 3 /** @file … … 43 43 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (HardDiskFormat) 44 44 45 DECLARE_NOT_AGGREGATABLE (HardDiskFormat)45 DECLARE_NOT_AGGREGATABLE (HardDiskFormat) 46 46 47 47 DECLARE_PROTECT_FINAL_CONSTRUCT() 48 48 49 49 BEGIN_COM_MAP(HardDiskFormat) 50 COM_INTERFACE_ENTRY (ISupportErrorInfo)51 COM_INTERFACE_ENTRY (IHardDiskFormat)50 COM_INTERFACE_ENTRY (ISupportErrorInfo) 51 COM_INTERFACE_ENTRY (IHardDiskFormat) 52 52 END_COM_MAP() 53 53 … … 60 60 61 61 // public initializer/uninitializer for internal purposes only 62 HRESULT init ( VDBACKENDINFO *aVDInfo);62 HRESULT init (const VDBACKENDINFO *aVDInfo); 63 63 void uninit(); 64 64 65 65 // IHardDiskFormat properties 66 66 STDMETHOD(COMGETTER(Id)) (BSTR *aId); 67 STDMETHOD(COMGETTER(Name)) (BSTR *aName); 68 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions)); 67 69 68 STDMETHOD(COMGETTER(SupportUuid) (BOOL *aBool)); 69 STDMETHOD(COMGETTER(SupportCreateFixed) (BOOL *aBool)); 70 STDMETHOD(COMGETTER(SupportCreateDynamic) (BOOL *aBool)); 71 STDMETHOD(COMGETTER(SupportCreateSplit2G) (BOOL *aBool)); 72 STDMETHOD(COMGETTER(SupportDiff) (BOOL *aBool)); 73 STDMETHOD(COMGETTER(SupportASync) (BOOL *aBool)); 74 STDMETHOD(COMGETTER(SupportFile) (BOOL *aBool)); 75 STDMETHOD(COMGETTER(SupportConfig) (BOOL *aBool)); 76 77 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions)); 70 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps); 71 STDMETHOD(COMGETTER(ConfigNames)) (ComSafeArrayOut (BSTR, aConfigNames)); 78 72 79 73 // public methods only for internal purposes … … 94 88 95 89 const Bstr id; 90 const Bstr name; 91 const BstrList fileExtensions; 96 92 const uint64_t capabilities; 97 const BstrList fileExtensions;93 const BstrList configNames; 98 94 }; 99 95
Note:
See TracChangeset
for help on using the changeset viewer.