- Timestamp:
- Dec 5, 2013 6:53:18 PM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MediumImpl.h
r48538 r49795 22 22 23 23 #include <VBox/vd.h> 24 25 #include "VirtualBoxBase.h" 26 #include "MediumLock.h" 27 24 #include "MediumWrap.h" 28 25 class Progress; 29 26 class MediumFormat; 27 class MediumLockList; 30 28 31 29 namespace settings … … 40 38 */ 41 39 class ATL_NO_VTABLE Medium : 42 public VirtualBoxBase, 43 VBOX_SCRIPTABLE_IMPL(IMedium) 40 public MediumWrap 44 41 { 45 42 public: 46 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Medium, IMedium)47 48 DECLARE_NOT_AGGREGATABLE(Medium)49 50 DECLARE_PROTECT_FINAL_CONSTRUCT()51 52 BEGIN_COM_MAP(Medium)53 VBOX_DEFAULT_INTERFACE_ENTRIES(IMedium)54 END_COM_MAP()55 56 43 DECLARE_EMPTY_CTOR_DTOR(Medium) 57 44 … … 96 83 void uninit(); 97 84 98 void deparent(); 99 void setParent(const ComObjPtr<Medium> &pParent); 100 101 // IMedium properties 102 STDMETHOD(COMGETTER(Id))(BSTR *aId); 103 STDMETHOD(COMGETTER(Description))(BSTR *aDescription); 104 STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription); 105 STDMETHOD(COMGETTER(State))(MediumState_T *aState); 106 STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant)); 107 STDMETHOD(COMGETTER(Location))(BSTR *aLocation); 108 STDMETHOD(COMGETTER(Name))(BSTR *aName); 109 STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType); 110 STDMETHOD(COMGETTER(HostDrive))(BOOL *aHostDrive); 111 STDMETHOD(COMGETTER(Size))(LONG64 *aSize); 112 STDMETHOD(COMGETTER(Format))(BSTR *aFormat); 113 STDMETHOD(COMGETTER(MediumFormat))(IMediumFormat **aMediumFormat); 114 STDMETHOD(COMGETTER(Type))(MediumType_T *aType); 115 STDMETHOD(COMSETTER(Type))(MediumType_T aType); 116 STDMETHOD(COMGETTER(AllowedTypes))(ComSafeArrayOut(MediumType_T, aAllowedTypes)); 117 STDMETHOD(COMGETTER(Parent))(IMedium **aParent); 118 STDMETHOD(COMGETTER(Children))(ComSafeArrayOut(IMedium *, aChildren)); 119 STDMETHOD(COMGETTER(Base))(IMedium **aBase); 120 STDMETHOD(COMGETTER(ReadOnly))(BOOL *aReadOnly); 121 STDMETHOD(COMGETTER(LogicalSize))(LONG64 *aLogicalSize); 122 STDMETHOD(COMGETTER(AutoReset))(BOOL *aAutoReset); 123 STDMETHOD(COMSETTER(AutoReset))(BOOL aAutoReset); 124 STDMETHOD(COMGETTER(LastAccessError))(BSTR *aLastAccessError); 125 STDMETHOD(COMGETTER(MachineIds))(ComSafeArrayOut(BSTR, aMachineIds)); 126 127 // IMedium methods 128 STDMETHOD(SetIds)(BOOL aSetImageId, IN_BSTR aImageId, 129 BOOL aSetParentId, IN_BSTR aParentId); 130 STDMETHOD(RefreshState)(MediumState_T *aState); 131 STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId, 132 ComSafeArrayOut(BSTR, aSnapshotIds)); 133 STDMETHOD(LockRead)(IToken **aToken); 134 STDMETHOD(LockWrite)(IToken **aToken); 135 STDMETHOD(Close)(); 136 STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue); 137 STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue); 138 STDMETHOD(GetProperties)(IN_BSTR aNames, 139 ComSafeArrayOut(BSTR, aReturnNames), 140 ComSafeArrayOut(BSTR, aReturnValues)); 141 STDMETHOD(SetProperties)(ComSafeArrayIn(IN_BSTR, aNames), 142 ComSafeArrayIn(IN_BSTR, aValues)); 143 STDMETHOD(CreateBaseStorage)(LONG64 aLogicalSize, 144 ComSafeArrayIn(MediumVariant_T, aVariant), 145 IProgress **aProgress); 146 STDMETHOD(DeleteStorage)(IProgress **aProgress); 147 STDMETHOD(CreateDiffStorage)(IMedium *aTarget, 148 ComSafeArrayIn(MediumVariant_T, aVariant), 149 IProgress **aProgress); 150 STDMETHOD(MergeTo)(IMedium *aTarget, IProgress **aProgress); 151 STDMETHOD(CloneTo)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant), 152 IMedium *aParent, IProgress **aProgress); 153 STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant), 154 IProgress **aProgress); 155 STDMETHOD(SetLocation)(IN_BSTR aLocation, IProgress **aProgress); 156 STDMETHOD(Compact)(IProgress **aProgress); 157 STDMETHOD(Resize)(LONG64 aLogicalSize, IProgress **aProgress); 158 STDMETHOD(Reset)(IProgress **aProgress); 85 void i_deparent(); 86 void i_setParent(const ComObjPtr<Medium> &pParent); 159 87 160 88 // unsafe methods for internal purposes only (ensure there is 161 89 // a caller and a read lock before calling them!) 162 const ComObjPtr<Medium>& getParent() const;163 const MediaList& getChildren() const;164 165 const Guid& getId() const;166 MediumState_T getState() const;167 MediumVariant_T getVariant() const;168 bool i sHostDrive() const;169 const Utf8Str& getLocationFull() const;170 const Utf8Str& getFormat() const;171 const ComObjPtr<MediumFormat> & getMediumFormat() const;172 bool i sMediumFormatFile() const;173 uint64_t getSize() const;174 DeviceType_T getDeviceType() const;175 MediumType_T getType() const;176 Utf8Str getName();90 const ComObjPtr<Medium>& i_getParent() const; 91 const MediaList& i_getChildren() const; 92 93 const Guid& i_getId() const; 94 MediumState_T i_getState() const; 95 MediumVariant_T i_getVariant() const; 96 bool i_isHostDrive() const; 97 const Utf8Str& i_getLocationFull() const; 98 const Utf8Str& i_getFormat() const; 99 const ComObjPtr<MediumFormat> & i_getMediumFormat() const; 100 bool i_isMediumFormatFile() const; 101 uint64_t i_getSize() const; 102 DeviceType_T i_getDeviceType() const; 103 MediumType_T i_getType() const; 104 Utf8Str i_getName(); 177 105 178 106 /* handles caller/locking itself */ 179 bool addRegistry(const Guid& id, bool fRecurse);107 bool i_addRegistry(const Guid& id, bool fRecurse); 180 108 /* handles caller/locking itself */ 181 bool removeRegistry(const Guid& id, bool fRecurse);182 bool i sInRegistry(const Guid& id);183 bool getFirstRegistryMachineId(Guid &uuid) const;184 void markRegistriesModified();185 186 HRESULT setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue);187 188 HRESULT addBackReference(const Guid &aMachineId,189 const Guid &aSnapshotId = Guid::Empty);190 HRESULT removeBackReference(const Guid &aMachineId,191 const Guid &aSnapshotId = Guid::Empty);192 193 194 const Guid* getFirstMachineBackrefId() const;195 const Guid* getAnyMachineBackref() const;196 const Guid* getFirstMachineBackrefSnapshotId() const;197 size_t getMachineBackRefCount() const;109 bool i_removeRegistry(const Guid& id, bool fRecurse); 110 bool i_isInRegistry(const Guid& id); 111 bool i_getFirstRegistryMachineId(Guid &uuid) const; 112 void i_markRegistriesModified(); 113 114 HRESULT i_setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue); 115 116 HRESULT i_addBackReference(const Guid &aMachineId, 117 const Guid &aSnapshotId = Guid::Empty); 118 HRESULT i_removeBackReference(const Guid &aMachineId, 119 const Guid &aSnapshotId = Guid::Empty); 120 121 122 const Guid* i_getFirstMachineBackrefId() const; 123 const Guid* i_getAnyMachineBackref() const; 124 const Guid* i_getFirstMachineBackrefSnapshotId() const; 125 size_t i_getMachineBackRefCount() const; 198 126 199 127 #ifdef DEBUG 200 void dumpBackRefs();128 void i_dumpBackRefs(); 201 129 #endif 202 130 203 HRESULT updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath);204 205 ComObjPtr<Medium> getBase(uint32_t *aLevel = NULL);206 207 bool i sReadOnly();208 void updateId(const Guid &id);209 210 HRESULT saveSettings(settings::Medium &data,211 const Utf8Str &strHardDiskFolder);212 213 HRESULT createMediumLockList(bool fFailIfInaccessible,214 bool fMediumLockWrite,215 Medium *pToBeParent,216 MediumLockList &mediumLockList);217 218 HRESULT createDiffStorage(ComObjPtr<Medium> &aTarget,219 MediumVariant_T aVariant,220 MediumLockList *pMediumLockList,221 ComObjPtr<Progress> *aProgress,222 bool aWait);223 Utf8Str getPreferredDiffFormat();224 225 HRESULT close(AutoCaller &autoCaller);226 HRESULT unlockRead(MediumState_T *aState);227 HRESULT unlockWrite(MediumState_T *aState);228 HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);229 HRESULT markForDeletion();230 HRESULT unmarkForDeletion();231 HRESULT markLockedForDeletion();232 HRESULT unmarkLockedForDeletion();233 234 HRESULT queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,235 bool &fMergeForward);236 237 HRESULT prepareMergeTo(const ComObjPtr<Medium> &pTarget,238 const Guid *aMachineId,239 const Guid *aSnapshotId,240 bool fLockMedia,241 bool &fMergeForward,242 ComObjPtr<Medium> &pParentForTarget,243 MediumLockList * &aChildrenToReparent,244 MediumLockList * &aMediumLockList);245 HRESULT mergeTo(const ComObjPtr<Medium> &pTarget,246 bool fMergeForward,247 const ComObjPtr<Medium> &pParentForTarget,248 MediumLockList *aChildrenToReparent,249 MediumLockList *aMediumLockList,250 ComObjPtr<Progress> *aProgress,251 bool aWait);252 void cancelMergeTo(MediumLockList *aChildrenToReparent,131 HRESULT i_updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath); 132 133 ComObjPtr<Medium> i_getBase(uint32_t *aLevel = NULL); 134 135 bool i_isReadOnly(); 136 void i_updateId(const Guid &id); 137 138 HRESULT i_saveSettings(settings::Medium &data, 139 const Utf8Str &strHardDiskFolder); 140 141 HRESULT i_createMediumLockList(bool fFailIfInaccessible, 142 bool fMediumLockWrite, 143 Medium *pToBeParent, 144 MediumLockList &mediumLockList); 145 146 HRESULT i_createDiffStorage(ComObjPtr<Medium> &aTarget, 147 MediumVariant_T aVariant, 148 MediumLockList *pMediumLockList, 149 ComObjPtr<Progress> *aProgress, 150 bool aWait); 151 Utf8Str i_getPreferredDiffFormat(); 152 153 HRESULT i_close(AutoCaller &autoCaller); 154 HRESULT i_unlockRead(MediumState_T *aState); 155 HRESULT i_unlockWrite(MediumState_T *aState); 156 HRESULT i_deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait); 157 HRESULT i_markForDeletion(); 158 HRESULT i_unmarkForDeletion(); 159 HRESULT i_markLockedForDeletion(); 160 HRESULT i_unmarkLockedForDeletion(); 161 162 HRESULT i_queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther, 163 bool &fMergeForward); 164 165 HRESULT i_prepareMergeTo(const ComObjPtr<Medium> &pTarget, 166 const Guid *aMachineId, 167 const Guid *aSnapshotId, 168 bool fLockMedia, 169 bool &fMergeForward, 170 ComObjPtr<Medium> &pParentForTarget, 171 MediumLockList * &aChildrenToReparent, 172 MediumLockList * &aMediumLockList); 173 HRESULT i_mergeTo(const ComObjPtr<Medium> &pTarget, 174 bool fMergeForward, 175 const ComObjPtr<Medium> &pParentForTarget, 176 MediumLockList *aChildrenToReparent, 177 MediumLockList *aMediumLockList, 178 ComObjPtr<Progress> *aProgress, 179 bool aWait); 180 void i_cancelMergeTo(MediumLockList *aChildrenToReparent, 253 181 MediumLockList *aMediumLockList); 254 182 255 HRESULT fixParentUuidOfChildren(MediumLockList *pChildrenToReparent);256 257 HRESULT exportFile(const char *aFilename,258 const ComObjPtr<MediumFormat> &aFormat,259 MediumVariant_T aVariant,260 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,261 const ComObjPtr<Progress> &aProgress);262 HRESULT i mportFile(const char *aFilename,263 const ComObjPtr<MediumFormat> &aFormat,264 MediumVariant_T aVariant,265 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,266 const ComObjPtr<Medium> &aParent,267 const ComObjPtr<Progress> &aProgress);268 269 HRESULT cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,270 const ComObjPtr<Medium> &aParent, IProgress **aProgress,271 uint32_t idxSrcImageSame, uint32_t idxDstImageSame);183 HRESULT i_fixParentUuidOfChildren(MediumLockList *pChildrenToReparent); 184 185 HRESULT i_exportFile(const char *aFilename, 186 const ComObjPtr<MediumFormat> &aFormat, 187 MediumVariant_T aVariant, 188 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser, 189 const ComObjPtr<Progress> &aProgress); 190 HRESULT i_importFile(const char *aFilename, 191 const ComObjPtr<MediumFormat> &aFormat, 192 MediumVariant_T aVariant, 193 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser, 194 const ComObjPtr<Medium> &aParent, 195 const ComObjPtr<Progress> &aProgress); 196 197 HRESULT i_cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant, 198 const ComObjPtr<Medium> &aParent, IProgress **aProgress, 199 uint32_t idxSrcImageSame, uint32_t idxDstImageSame); 272 200 273 201 private: 274 202 275 HRESULT queryInfo(bool fSetImageId, bool fSetParentId); 276 277 HRESULT canClose(); 278 HRESULT unregisterWithVirtualBox(); 279 280 HRESULT setStateError(); 281 282 HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str::Empty); 283 HRESULT setFormat(const Utf8Str &aFormat); 284 285 VDTYPE convertDeviceType(); 286 DeviceType_T convertToDeviceType(VDTYPE enmType); 287 288 Utf8Str vdError(int aVRC); 289 290 static DECLCALLBACK(void) vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL, 291 const char *pszFormat, va_list va); 292 293 static DECLCALLBACK(bool) vdConfigAreKeysValid(void *pvUser, 294 const char *pszzValid); 295 static DECLCALLBACK(int) vdConfigQuerySize(void *pvUser, const char *pszName, 296 size_t *pcbValue); 297 static DECLCALLBACK(int) vdConfigQuery(void *pvUser, const char *pszName, 298 char *pszValue, size_t cchValue); 299 300 static DECLCALLBACK(int) vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock); 301 static DECLCALLBACK(int) vdTcpSocketDestroy(VDSOCKET Sock); 302 static DECLCALLBACK(int) vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort); 303 static DECLCALLBACK(int) vdTcpClientClose(VDSOCKET Sock); 304 static DECLCALLBACK(bool) vdTcpIsClientConnected(VDSOCKET Sock); 305 static DECLCALLBACK(int) vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies); 306 static DECLCALLBACK(int) vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead); 307 static DECLCALLBACK(int) vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer); 308 static DECLCALLBACK(int) vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf); 309 static DECLCALLBACK(int) vdTcpFlush(VDSOCKET Sock); 310 static DECLCALLBACK(int) vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable); 311 static DECLCALLBACK(int) vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr); 312 static DECLCALLBACK(int) vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr); 203 // wrapped IMedium properties 204 HRESULT getId(com::Guid &aId); 205 HRESULT getDescription(com::Utf8Str &aDescription); 206 HRESULT setDescription(const com::Utf8Str &aDescription); 207 HRESULT getState(MediumState_T *aState); 208 HRESULT getVariant(std::vector<MediumVariant_T> &aVariant); 209 HRESULT getLocation(com::Utf8Str &aLocation); 210 HRESULT getName(com::Utf8Str &aName); 211 HRESULT getDeviceType(DeviceType_T *aDeviceType); 212 HRESULT getHostDrive(BOOL *aHostDrive); 213 HRESULT getSize(LONG64 *aSize); 214 HRESULT getFormat(com::Utf8Str &aFormat); 215 HRESULT getMediumFormat(ComPtr<IMediumFormat> &aMediumFormat); 216 HRESULT getType(MediumType_T *aType); 217 HRESULT setType(MediumType_T aType); 218 HRESULT getAllowedTypes(std::vector<MediumType_T> &aAllowedTypes); 219 HRESULT getParent(ComPtr<IMedium> &aParent); 220 HRESULT getChildren(std::vector<ComPtr<IMedium> > &aChildren); 221 HRESULT getBase(ComPtr<IMedium> &aBase); 222 HRESULT getReadOnly(BOOL *aReadOnly); 223 HRESULT getLogicalSize(LONG64 *aLogicalSize); 224 HRESULT getAutoReset(BOOL *aAutoReset); 225 HRESULT setAutoReset(BOOL aAutoReset); 226 HRESULT getLastAccessError(com::Utf8Str &aLastAccessError); 227 HRESULT getMachineIds(std::vector<com::Guid> &aMachineIds); 228 229 // wrapped IMedium methods 230 HRESULT setIds(BOOL aSetImageId, 231 const com::Guid &aImageId, 232 BOOL aSetParentId, 233 const com::Guid &aParentId); 234 HRESULT refreshState(MediumState_T *aState); 235 HRESULT getSnapshotIds(const com::Guid &aMachineId, 236 std::vector<com::Guid> &aSnapshotIds); 237 HRESULT lockRead(ComPtr<IToken> &aToken); 238 HRESULT lockWrite(ComPtr<IToken> &aToken); 239 HRESULT close(); 240 HRESULT getProperty(const com::Utf8Str &aName, 241 com::Utf8Str &aValue); 242 HRESULT setProperty(const com::Utf8Str &aName, 243 const com::Utf8Str &aValue); 244 HRESULT getProperties(const com::Utf8Str &aNames, 245 std::vector<com::Utf8Str> &aReturnNames, 246 std::vector<com::Utf8Str> &aReturnValues); 247 HRESULT setProperties(const std::vector<com::Utf8Str> &aNames, 248 const std::vector<com::Utf8Str> &aValues); 249 HRESULT createBaseStorage(LONG64 aLogicalSize, 250 const std::vector<MediumVariant_T> &aVariant, 251 ComPtr<IProgress> &aProgress); 252 HRESULT deleteStorage(ComPtr<IProgress> &aProgress); 253 HRESULT createDiffStorage(const ComPtr<IMedium> &aTarget, 254 const std::vector<MediumVariant_T> &aVariant, 255 ComPtr<IProgress> &aProgress); 256 HRESULT mergeTo(const ComPtr<IMedium> &aTarget, 257 ComPtr<IProgress> &aProgress); 258 HRESULT cloneTo(const ComPtr<IMedium> &aTarget, 259 const std::vector<MediumVariant_T> &aVariant, 260 const ComPtr<IMedium> &aParent, 261 ComPtr<IProgress> &aProgress); 262 HRESULT cloneToBase(const ComPtr<IMedium> &aTarget, 263 const std::vector<MediumVariant_T> &aVariant, 264 ComPtr<IProgress> &aProgress); 265 HRESULT setLocation(const com::Utf8Str &aLocation, 266 ComPtr<IProgress> &aProgress); 267 HRESULT compact(ComPtr<IProgress> &aProgress); 268 HRESULT resize(LONG64 aLogicalSize, 269 ComPtr<IProgress> &aProgress); 270 HRESULT reset(ComPtr<IProgress> &aProgress); 271 272 // Private internal nmethods 273 HRESULT i_queryInfo(bool fSetImageId, bool fSetParentId); 274 HRESULT i_canClose(); 275 HRESULT i_unregisterWithVirtualBox(); 276 HRESULT i_setStateError(); 277 HRESULT i_setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str::Empty); 278 HRESULT i_setFormat(const Utf8Str &aFormat); 279 VDTYPE i_convertDeviceType(); 280 DeviceType_T i_convertToDeviceType(VDTYPE enmType); 281 Utf8Str i_vdError(int aVRC); 282 283 static DECLCALLBACK(void) i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL, 284 const char *pszFormat, va_list va); 285 static DECLCALLBACK(bool) i_vdConfigAreKeysValid(void *pvUser, 286 const char *pszzValid); 287 static DECLCALLBACK(int) i_vdConfigQuerySize(void *pvUser, const char *pszName, 288 size_t *pcbValue); 289 static DECLCALLBACK(int) i_vdConfigQuery(void *pvUser, const char *pszName, 290 char *pszValue, size_t cchValue); 291 static DECLCALLBACK(int) i_vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock); 292 static DECLCALLBACK(int) i_vdTcpSocketDestroy(VDSOCKET Sock); 293 static DECLCALLBACK(int) i_vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort); 294 static DECLCALLBACK(int) i_vdTcpClientClose(VDSOCKET Sock); 295 static DECLCALLBACK(bool) i_vdTcpIsClientConnected(VDSOCKET Sock); 296 static DECLCALLBACK(int) i_vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies); 297 static DECLCALLBACK(int) i_vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead); 298 static DECLCALLBACK(int) i_vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer); 299 static DECLCALLBACK(int) i_vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf); 300 static DECLCALLBACK(int) i_vdTcpFlush(VDSOCKET Sock); 301 static DECLCALLBACK(int) i_vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable); 302 static DECLCALLBACK(int) i_vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr); 303 static DECLCALLBACK(int) i_vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr); 313 304 314 305 class Task; … … 335 326 friend class ImportTask; 336 327 337 HRESULT startThread(Medium::Task *pTask);338 HRESULT runNow(Medium::Task *pTask);339 340 HRESULT taskCreateBaseHandler(Medium::CreateBaseTask &task);341 HRESULT taskCreateDiffHandler(Medium::CreateDiffTask &task);342 HRESULT taskMergeHandler(Medium::MergeTask &task);343 HRESULT taskCloneHandler(Medium::CloneTask &task);344 HRESULT taskDeleteHandler(Medium::DeleteTask &task);345 HRESULT taskResetHandler(Medium::ResetTask &task);346 HRESULT taskCompactHandler(Medium::CompactTask &task);347 HRESULT taskResizeHandler(Medium::ResizeTask &task);348 HRESULT taskExportHandler(Medium::ExportTask &task);349 HRESULT taskImportHandler(Medium::ImportTask &task);328 HRESULT i_startThread(Medium::Task *pTask); 329 HRESULT i_runNow(Medium::Task *pTask); 330 331 HRESULT i_taskCreateBaseHandler(Medium::CreateBaseTask &task); 332 HRESULT i_taskCreateDiffHandler(Medium::CreateDiffTask &task); 333 HRESULT i_taskMergeHandler(Medium::MergeTask &task); 334 HRESULT i_taskCloneHandler(Medium::CloneTask &task); 335 HRESULT i_taskDeleteHandler(Medium::DeleteTask &task); 336 HRESULT i_taskResetHandler(Medium::ResetTask &task); 337 HRESULT i_taskCompactHandler(Medium::CompactTask &task); 338 HRESULT i_taskResizeHandler(Medium::ResizeTask &task); 339 HRESULT i_taskExportHandler(Medium::ExportTask &task); 340 HRESULT i_taskImportHandler(Medium::ImportTask &task); 350 341 351 342 struct Data; // opaque data struct, defined in MediumImpl.cpp -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r49747 r49795 2135 2135 if (FAILED(rc)) throw rc; 2136 2136 2137 rc = pSourceDisk-> exportFile(strTargetFilePath.c_str(),2138 format,2139 MediumVariant_VmdkStreamOptimized,2140 pIfIo,2141 pStorage,2142 pProgress2);2137 rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(), 2138 format, 2139 MediumVariant_VmdkStreamOptimized, 2140 pIfIo, 2141 pStorage, 2142 pProgress2); 2143 2143 if (FAILED(rc)) throw rc; 2144 2144 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r49753 r49795 1566 1566 /* 1567 1567 * Restoring original UUID from OVF description file. 1568 * During import VB creates new UUIDs for imported images and 1568 * During import VB creates new UUIDs for imported images and 1569 1569 * assigns them to the images. In case of failure we have to restore 1570 1570 * the original UUIDs because those new UUIDs are obsolete now and … … 1792 1792 /* 1793 1793 * Restoring original UUID from OVF description file. 1794 * During import VB creates new UUIDs for imported images and 1794 * During import VB creates new UUIDs for imported images and 1795 1795 * assigns them to the images. In case of failure we have to restore 1796 1796 * the original UUIDs because those new UUIDs are obsolete now and … … 2488 2488 /* Clone the source disk image */ 2489 2489 ComObjPtr<Medium> nullParent; 2490 rc = pTargetHD->i mportFile(strSrcFilePath.c_str(),2491 srcFormat,2492 MediumVariant_Standard,2493 pCallbacks, pRealUsedStorage,2494 nullParent,2495 pProgress);2490 rc = pTargetHD->i_importFile(strSrcFilePath.c_str(), 2491 srcFormat, 2492 MediumVariant_Standard, 2493 pCallbacks, pRealUsedStorage, 2494 nullParent, 2495 pProgress); 2496 2496 if (FAILED(rc)) throw rc; 2497 2497 … … 3764 3764 3765 3765 /* 3766 * 1. saving original UUID for restoring in case of failure. 3766 * 1. saving original UUID for restoring in case of failure. 3767 3767 * 2. replacement of original UUID by new UUID in the current VM config (settings::MachineConfigFile). 3768 3768 */ -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r49778 r49795 1857 1857 { 1858 1858 Medium *pCached = *itCached; 1859 const Utf8Str strLocationCached = pCached-> getLocationFull();1859 const Utf8Str strLocationCached = pCached->i_getLocationFull(); 1860 1860 bool fFound = false; 1861 1861 for (MediaList::iterator itNew = llNew.begin(); … … 1864 1864 { 1865 1865 Medium *pNew = *itNew; 1866 const Utf8Str strLocationNew = pNew-> getLocationFull();1866 const Utf8Str strLocationNew = pNew->i_getLocationFull(); 1867 1867 if (strLocationNew == strLocationCached) 1868 1868 { … … 1883 1883 { 1884 1884 Medium *pNew = *itNew; 1885 const Utf8Str strLocationNew = pNew-> getLocationFull();1885 const Utf8Str strLocationNew = pNew->i_getLocationFull(); 1886 1886 bool fFound = false; 1887 1887 for (MediaList::iterator itCached = pllCached->begin(); … … 1890 1890 { 1891 1891 Medium *pCached = *itCached; 1892 const Utf8Str strLocationCached = pCached-> getLocationFull();1892 const Utf8Str strLocationCached = pCached->i_getLocationFull(); 1893 1893 if (strLocationNew == strLocationCached) 1894 1894 { … … 1939 1939 AutoCaller mediumCaller(pThis); 1940 1940 AutoReadLock mediumLock(pThis COMMA_LOCKVAL_SRC_POS); 1941 if (pThis-> getId() == uuid)1941 if (pThis->i_getId() == uuid) 1942 1942 { 1943 1943 pMedium = pThis; … … 1979 1979 AutoCaller mediumCaller(pThis); 1980 1980 AutoReadLock mediumLock(pThis COMMA_LOCKVAL_SRC_POS); 1981 if (pThis-> getLocationFull() == strLocationFull)1981 if (pThis->i_getLocationFull() == strLocationFull) 1982 1982 { 1983 1983 pMedium = pThis; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r49742 r49795 4086 4086 return setError(VBOX_E_OBJECT_IN_USE, 4087 4087 tr("Medium '%s' is already attached to port %d, device %d of controller '%ls' of this virtual machine"), 4088 pMedium-> getLocationFull().c_str(),4088 pMedium->i_getLocationFull().c_str(), 4089 4089 aControllerPort, 4090 4090 aDevice, … … 4111 4111 return setError(VBOX_E_OBJECT_IN_USE, 4112 4112 tr("Medium '%s' is already attached to this virtual machine"), 4113 medium-> getLocationFull().c_str());4113 medium->i_getLocationFull().c_str()); 4114 4114 4115 4115 if (!medium.isNull()) 4116 4116 { 4117 MediumType_T mtype = medium-> getType();4117 MediumType_T mtype = medium->i_getType(); 4118 4118 // MediumType_Readonly is also new, but only applies to DVDs and floppies. 4119 4119 // For DVDs it's not written to the config file, so needs no global config … … 4133 4133 // global registry: 4134 4134 const Guid &uuidGlobalRegistry = mParent->getGlobalRegistryId(); 4135 if ( medium->i sInRegistry(uuidGlobalRegistry)4135 if ( medium->i_isInRegistry(uuidGlobalRegistry) 4136 4136 || !mData->pMachineConfigFile->canHaveOwnMediaRegistry() 4137 4137 ) … … 4139 4139 tr("Cannot attach medium '%s': the media type 'MultiAttach' can only be attached " 4140 4140 "to machines that were created with VirtualBox 4.0 or later"), 4141 medium-> getLocationFull().c_str());4141 medium->i_getLocationFull().c_str()); 4142 4142 } 4143 4143 } … … 4145 4145 bool fIndirect = false; 4146 4146 if (!medium.isNull()) 4147 fIndirect = medium->i sReadOnly();4147 fIndirect = medium->i_isReadOnly(); 4148 4148 bool associate = true; 4149 4149 … … 4178 4178 MediumLockList *pMediumLockList(new MediumLockList()); 4179 4179 4180 rc = medium-> createMediumLockList(true /* fFailIfInaccessible */,4181 true /* fMediumLockWrite */,4182 NULL,4183 *pMediumLockList);4180 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4181 true /* fMediumLockWrite */, 4182 NULL, 4183 *pMediumLockList); 4184 4184 alock.acquire(); 4185 4185 if (FAILED(rc)) … … 4226 4226 * hard disks. */ 4227 4227 4228 if (medium-> getParent().isNull())4228 if (medium->i_getParent().isNull()) 4229 4229 { 4230 4230 /* first, investigate the backup copy of the current hard disk … … 4249 4249 continue; 4250 4250 4251 if (pMedium-> getBase(&level) == medium)4251 if (pMedium->i_getBase(&level) == medium) 4252 4252 { 4253 4253 /* skip the hard disk if its currently attached (we … … 4277 4277 MediumLockList *pMediumLockList(new MediumLockList()); 4278 4278 4279 rc = medium-> createMediumLockList(true /* fFailIfInaccessible */,4280 true /* fMediumLockWrite */,4281 NULL,4282 *pMediumLockList);4279 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4280 true /* fMediumLockWrite */, 4281 NULL, 4282 *pMediumLockList); 4283 4283 alock.acquire(); 4284 4284 if (FAILED(rc)) … … 4364 4364 4365 4365 uint32_t level = 0; 4366 if (pMedium-> getBase(&level) == medium)4366 if (pMedium->i_getBase(&level) == medium) 4367 4367 { 4368 4368 /* matched device, channel and bus (i.e. attached to the … … 4419 4419 // store this diff in the same registry as the parent 4420 4420 Guid uuidRegistryParent; 4421 if (!medium-> getFirstRegistryMachineId(uuidRegistryParent))4421 if (!medium->i_getFirstRegistryMachineId(uuidRegistryParent)) 4422 4422 { 4423 4423 // parent image has no registry: this can happen if we're attaching a new immutable … … 4432 4432 treeLock.acquire(); 4433 4433 mediumLock.acquire(); 4434 medium-> getFirstRegistryMachineId(uuidRegistryParent);4434 medium->i_getFirstRegistryMachineId(uuidRegistryParent); 4435 4435 } 4436 4436 rc = diff->init(mParent, 4437 medium-> getPreferredDiffFormat(),4437 medium->i_getPreferredDiffFormat(), 4438 4438 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 4439 4439 uuidRegistryParent); … … 4444 4444 mediumLock.release(); 4445 4445 treeLock.release(); 4446 rc = diff-> createMediumLockList(true /* fFailIfInaccessible */,4447 true /* fMediumLockWrite */,4448 medium,4449 *pMediumLockList);4446 rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, 4447 true /* fMediumLockWrite */, 4448 medium, 4449 *pMediumLockList); 4450 4450 treeLock.acquire(); 4451 4451 mediumLock.acquire(); … … 4460 4460 setError(rc, 4461 4461 tr("Could not lock medium when creating diff '%s'"), 4462 diff-> getLocationFull().c_str());4462 diff->i_getLocationFull().c_str()); 4463 4463 else 4464 4464 { … … 4472 4472 alock.release(); 4473 4473 4474 rc = medium-> createDiffStorage(diff,4475 MediumVariant_Standard,4476 pMediumLockList,4477 NULL /* aProgress */,4478 true /* aWait */);4474 rc = medium->i_createDiffStorage(diff, 4475 MediumVariant_Standard, 4476 pMediumLockList, 4477 NULL /* aProgress */, 4478 true /* aWait */); 4479 4479 4480 4480 alock.acquire(); … … 4519 4519 { 4520 4520 // as the last step, associate the medium to the VM 4521 rc = medium-> addBackReference(mData->mUuid);4521 rc = medium->i_addBackReference(mData->mUuid); 4522 4522 // here we can fail because of Deleting, or being in process of creating a Diff 4523 4523 if (FAILED(rc)) return rc; … … 4547 4547 MediumLockList *pMediumLockList(new MediumLockList()); 4548 4548 4549 rc = medium-> createMediumLockList(true /* fFailIfInaccessible */,4549 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4550 4550 true /* fMediumLockWrite */, 4551 4551 NULL, … … 5090 5090 aDevice); 5091 5091 if (!oldmedium.isNull()) 5092 oldmedium-> removeBackReference(mData->mUuid);5092 oldmedium->i_removeBackReference(mData->mUuid); 5093 5093 if (!pMedium.isNull()) 5094 5094 { 5095 pMedium-> addBackReference(mData->mUuid);5095 pMedium->i_addBackReference(mData->mUuid); 5096 5096 5097 5097 mediumLock.release(); … … 5118 5118 { 5119 5119 if (!pMedium.isNull()) 5120 pMedium-> removeBackReference(mData->mUuid);5120 pMedium->i_removeBackReference(mData->mUuid); 5121 5121 pAttach = findAttachment(mMediaData->mAttachments, 5122 5122 aControllerName, … … 5128 5128 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 5129 5129 if (!oldmedium.isNull()) 5130 oldmedium-> addBackReference(mData->mUuid);5130 oldmedium->i_addBackReference(mData->mUuid); 5131 5131 pAttach->updateMedium(oldmedium); 5132 5132 } … … 5697 5697 AutoCaller mac(pMedium); 5698 5698 if (FAILED(mac.rc())) throw mac.rc(); 5699 Utf8Str strLocation = pMedium-> getLocationFull();5699 Utf8Str strLocation = pMedium->i_getLocationFull(); 5700 5700 rc = task.pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), strLocation.c_str()).raw(), 1); 5701 5701 if (FAILED(rc)) throw rc; … … 5724 5724 pMedium->Close(); 5725 5725 } 5726 5727 5726 } 5728 5727 setMachineState(oldState); … … 8824 8823 if (pMedium.isNull()) 8825 8824 continue; 8826 HRESULT rc = pMedium-> removeBackReference(mData->mUuid, getSnapshotId());8825 HRESULT rc = pMedium->i_removeBackReference(mData->mUuid, getSnapshotId()); 8827 8826 AssertComRC(rc); 8828 8827 } … … 9702 9701 AutoWriteLock hdLock(medium COMMA_LOCKVAL_SRC_POS); 9703 9702 9704 if (medium-> getType() == MediumType_Immutable)9703 if (medium->i_getType() == MediumType_Immutable) 9705 9704 { 9706 9705 if (isSnapshotMachine()) … … 9708 9707 tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} " 9709 9708 "of the virtual machine '%s' ('%s')"), 9710 medium-> getLocationFull().c_str(),9709 medium->i_getLocationFull().c_str(), 9711 9710 dev.uuid.raw(), 9712 9711 puuidSnapshot->raw(), … … 9716 9715 return setError(E_FAIL, 9717 9716 tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"), 9718 medium-> getLocationFull().c_str(),9717 medium->i_getLocationFull().c_str(), 9719 9718 dev.uuid.raw(), 9720 9719 mUserData->s.strName.c_str(), … … 9722 9721 } 9723 9722 9724 if (medium-> getType() == MediumType_MultiAttach)9723 if (medium->i_getType() == MediumType_MultiAttach) 9725 9724 { 9726 9725 if (isSnapshotMachine()) … … 9728 9727 tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} " 9729 9728 "of the virtual machine '%s' ('%s')"), 9730 medium-> getLocationFull().c_str(),9729 medium->i_getLocationFull().c_str(), 9731 9730 dev.uuid.raw(), 9732 9731 puuidSnapshot->raw(), … … 9736 9735 return setError(E_FAIL, 9737 9736 tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"), 9738 medium-> getLocationFull().c_str(),9737 medium->i_getLocationFull().c_str(), 9739 9738 dev.uuid.raw(), 9740 9739 mUserData->s.strName.c_str(), … … 9743 9742 9744 9743 if ( !isSnapshotMachine() 9745 && medium-> getChildren().size() != 09744 && medium->i_getChildren().size() != 0 9746 9745 ) 9747 9746 return setError(E_FAIL, 9748 9747 tr("Hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s') " 9749 9748 "because it has %d differencing child hard disks"), 9750 medium-> getLocationFull().c_str(),9749 medium->i_getLocationFull().c_str(), 9751 9750 dev.uuid.raw(), 9752 9751 mUserData->s.strName.c_str(), 9753 9752 mData->m_strConfigFileFull.c_str(), 9754 medium-> getChildren().size());9753 medium->i_getChildren().size()); 9755 9754 9756 9755 if (findAttachment(mMediaData->mAttachments, … … 9758 9757 return setError(E_FAIL, 9759 9758 tr("Hard disk '%s' with UUID {%RTuuid} is already attached to the virtual machine '%s' ('%s')"), 9760 medium-> getLocationFull().c_str(),9759 medium->i_getLocationFull().c_str(), 9761 9760 dev.uuid.raw(), 9762 9761 mUserData->s.strName.c_str(), … … 9769 9768 return setError(E_FAIL, 9770 9769 tr("Device '%s' with unknown type is attached to the virtual machine '%s' ('%s')"), 9771 medium-> getLocationFull().c_str(),9770 medium->i_getLocationFull().c_str(), 9772 9771 mUserData->s.strName.c_str(), 9773 9772 mData->m_strConfigFileFull.c_str()); … … 9786 9785 return setError(E_FAIL, 9787 9786 tr("Device '%s' with unknown bandwidth group '%s' is attached to the virtual machine '%s' ('%s')"), 9788 medium-> getLocationFull().c_str(),9787 medium->i_getLocationFull().c_str(), 9789 9788 dev.strBwGroup.c_str(), 9790 9789 mUserData->s.strName.c_str(), … … 9819 9818 9820 9819 if (isSnapshotMachine()) 9821 rc = medium-> addBackReference(mData->mUuid, *puuidSnapshot);9820 rc = medium->i_addBackReference(mData->mUuid, *puuidSnapshot); 9822 9821 else 9823 rc = medium-> addBackReference(mData->mUuid);9822 rc = medium->i_addBackReference(mData->mUuid); 9824 9823 /* If the medium->addBackReference fails it sets an appropriate 9825 9824 * error message, so no need to do any guesswork here. */ … … 9827 9826 if (puuidRegistry) 9828 9827 // caller wants registry ID to be set on all attached media (OVF import case) 9829 medium-> addRegistry(*puuidRegistry, false /* fRecurse */);9828 medium->i_addRegistry(*puuidRegistry, false /* fRecurse */); 9830 9829 } 9831 9830 … … 10406 10405 * with it. 10407 10406 * 10408 *Caller must hold the machine lock!10407 Caller must hold the machine lock! 10409 10408 * 10410 10409 * This throws XML errors and HRESULT, so the caller must have a catch block! … … 10915 10914 if (pMedium) 10916 10915 { 10917 if (pMedium->i sHostDrive())10918 dev.strHostDriveSrc = pMedium-> getLocationFull();10916 if (pMedium->i_isHostDrive()) 10917 dev.strHostDriveSrc = pMedium->i_getLocationFull(); 10919 10918 else 10920 dev.uuid = pMedium-> getId();10919 dev.uuid = pMedium->i_getId(); 10921 10920 dev.fTempEject = pAttach->getTempEject(); 10922 10921 dev.fNonRotational = pAttach->getNonRotational(); … … 11009 11008 { 11010 11009 AutoReadLock treeLock(&mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 11011 pBase = pMedium-> getBase();11010 pBase = pMedium->i_getBase(); 11012 11011 } 11013 11012 … … 11024 11023 uuid = mParent->getGlobalRegistryId(); // VirtualBox global registry UUID 11025 11024 11026 if (pMedium-> addRegistry(uuid, false /* fRecurse */))11025 if (pMedium->i_addRegistry(uuid, false /* fRecurse */)) 11027 11026 mParent->markRegistryModified(uuid); 11028 11027 … … 11031 11030 if (pMedium != pBase) 11032 11031 { 11033 if (pBase-> addRegistry(uuid, true /* fRecurse */))11032 if (pBase->i_addRegistry(uuid, true /* fRecurse */)) 11034 11033 mParent->markRegistryModified(uuid); 11035 11034 } … … 11114 11113 MediumLockList *pMediumLockList(new MediumLockList()); 11115 11114 alock.release(); 11116 rc = pMedium-> createMediumLockList(true /* fFailIfInaccessible */,11117 false /* fMediumLockWrite */,11118 NULL,11119 *pMediumLockList);11115 rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */, 11116 false /* fMediumLockWrite */, 11117 NULL, 11118 *pMediumLockList); 11120 11119 alock.acquire(); 11121 11120 if (FAILED(rc)) … … 11164 11163 if ( devType != DeviceType_HardDisk 11165 11164 || pMedium == NULL 11166 || pMedium-> getType() != MediumType_Normal)11165 || pMedium->i_getType() != MediumType_Normal) 11167 11166 { 11168 11167 /* copy the attachment as is */ … … 11178 11177 else 11179 11178 aProgress->SetNextOperation(BstrFmt(tr("Skipping medium '%s'"), 11180 pMedium-> getBase()->getName().c_str()).raw(),11179 pMedium->i_getBase()->i_getName().c_str()).raw(), 11181 11180 aWeight); // weight 11182 11181 } … … 11188 11187 /* need a diff */ 11189 11188 aProgress->SetNextOperation(BstrFmt(tr("Creating differencing hard disk for '%s'"), 11190 pMedium-> getBase()->getName().c_str()).raw(),11189 pMedium->i_getBase()->i_getName().c_str()).raw(), 11191 11190 aWeight); // weight 11192 11191 … … 11200 11199 // unregistered images) 11201 11200 Guid uuidRegistryParent; 11202 bool fInRegistry = pMedium-> getFirstRegistryMachineId(uuidRegistryParent);11201 bool fInRegistry = pMedium->i_getFirstRegistryMachineId(uuidRegistryParent); 11203 11202 Assert(fInRegistry); NOREF(fInRegistry); 11204 11203 rc = diff->init(mParent, 11205 pMedium-> getPreferredDiffFormat(),11204 pMedium->i_getPreferredDiffFormat(), 11206 11205 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 11207 11206 uuidRegistryParent); … … 11229 11228 /* release the locks before the potentially lengthy operation */ 11230 11229 alock.release(); 11231 rc = pMedium-> createDiffStorage(diff, MediumVariant_Standard,11232 pMediumLockList,11233 NULL /* aProgress */,11234 true /* aWait */);11230 rc = pMedium->i_createDiffStorage(diff, MediumVariant_Standard, 11231 pMediumLockList, 11232 NULL /* aProgress */, 11233 true /* aWait */); 11235 11234 alock.acquire(); 11236 11235 if (FAILED(rc)) throw rc; … … 11238 11237 /* actual lock list update is done in Medium::commitMedia */ 11239 11238 11240 rc = diff-> addBackReference(mData->mUuid);11239 rc = diff->i_addBackReference(mData->mUuid); 11241 11240 AssertComRCThrowRC(rc); 11242 11241 … … 11364 11363 MediumLockList *pMediumLockList(new MediumLockList()); 11365 11364 alock.release(); 11366 rc = pMedium-> createMediumLockList(true /* fFailIfInaccessible */,11367 false /* fMediumLockWrite */,11368 NULL,11369 *pMediumLockList);11365 rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */, 11366 false /* fMediumLockWrite */, 11367 NULL, 11368 *pMediumLockList); 11370 11369 alock.acquire(); 11371 11370 … … 11406 11405 /* Deassociate and mark for deletion */ 11407 11406 LogFlowThisFunc(("Detaching '%s', pending deletion\n", pAtt->getLogName())); 11408 rc = pMedium-> removeBackReference(mData->mUuid);11407 rc = pMedium->i_removeBackReference(mData->mUuid); 11409 11408 if (FAILED(rc)) 11410 11409 throw rc; … … 11418 11417 /* no: de-associate */ 11419 11418 LogFlowThisFunc(("Detaching '%s', no deletion\n", pAtt->getLogName())); 11420 rc = pMedium-> removeBackReference(mData->mUuid);11419 rc = pMedium->i_removeBackReference(mData->mUuid); 11421 11420 if (FAILED(rc)) 11422 11421 throw rc; … … 11461 11460 Assert(pMedium); 11462 11461 11463 rc = pMedium-> deleteStorage(NULL /*aProgress*/, true /*aWait*/);11462 rc = pMedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/); 11464 11463 // continue on delete failure, just collect error messages 11465 AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->getLogName(), pMedium-> getLocationFull().c_str() ));11464 AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->getLogName(), pMedium->i_getLocationFull().c_str() )); 11466 11465 mrc = rc; 11467 11466 } … … 11579 11578 MediumAttachment *pAttach = *it; 11580 11579 ComObjPtr<Medium> pMediumThis = pAttach->getMedium(); 11581 if (pMediumThis-> getId() == id)11580 if (pMediumThis->i_getId() == id) 11582 11581 return pAttach; 11583 11582 } … … 11602 11601 DeviceType_T mediumType = pAttach->getType(); 11603 11602 11604 LogFlowThisFunc(("Entering, medium of attachment is %s\n", oldmedium ? oldmedium-> getLocationFull().c_str() : "NULL"));11603 LogFlowThisFunc(("Entering, medium of attachment is %s\n", oldmedium ? oldmedium->i_getLocationFull().c_str() : "NULL")); 11605 11604 11606 11605 if (pAttach->isImplicit()) … … 11621 11620 writeLock.release(); 11622 11621 11623 HRESULT rc = oldmedium-> deleteStorage(NULL /*aProgress*/,11624 true /*aWait*/);11622 HRESULT rc = oldmedium->i_deleteStorage(NULL /*aProgress*/, 11623 true /*aWait*/); 11625 11624 11626 11625 writeLock.acquire(); … … 11639 11638 // if this is from a snapshot, do not defer detachment to commitMedia() 11640 11639 if (pSnapshot) 11641 oldmedium-> removeBackReference(mData->mUuid, pSnapshot->getId());11640 oldmedium->i_removeBackReference(mData->mUuid, pSnapshot->getId()); 11642 11641 // else if non-hard disk media, do not defer detachment to commitMedia() either 11643 11642 else if (mediumType != DeviceType_HardDisk) 11644 oldmedium-> removeBackReference(mData->mUuid);11643 oldmedium->i_removeBackReference(mData->mUuid); 11645 11644 } 11646 11645 … … 11697 11696 if (FAILED(mac.rc())) return mac.rc(); 11698 11697 AutoReadLock lock(pMedium COMMA_LOCKVAL_SRC_POS); 11699 DeviceType_T devType = pMedium-> getDeviceType();11698 DeviceType_T devType = pMedium->i_getDeviceType(); 11700 11699 if ( ( cleanupMode == CleanupMode_DetachAllReturnHardDisksOnly 11701 11700 && devType == DeviceType_HardDisk) … … 11704 11703 { 11705 11704 llMedia.push_back(pMedium); 11706 ComObjPtr<Medium> pParent = pMedium-> getParent();11705 ComObjPtr<Medium> pParent = pMedium->i_getParent(); 11707 11706 /* 11708 11707 * Search for medias which are not attached to any machine, but … … 11718 11717 if (FAILED(mac1.rc())) return mac1.rc(); 11719 11718 AutoReadLock lock1(pParent COMMA_LOCKVAL_SRC_POS); 11720 if (pParent-> getChildren().size() == 1)11719 if (pParent->i_getChildren().size() == 1) 11721 11720 { 11722 if ( pParent-> getMachineBackRefCount() == 011723 && pParent-> getType() == MediumType_Normal11721 if ( pParent->i_getMachineBackRefCount() == 0 11722 && pParent->i_getType() == MediumType_Normal 11724 11723 && find(llMedia.begin(), llMedia.end(), pParent) == llMedia.end()) 11725 11724 llMedia.push_back(pParent); … … 11727 11726 else 11728 11727 break; 11729 pParent = pParent-> getParent();11728 pParent = pParent->i_getParent(); 11730 11729 } 11731 11730 } … … 11787 11786 11788 11787 LogFlowThisFunc(("Examining current medium '%s' (implicit: %d)\n", 11789 (pMedium) ? pMedium-> getName().c_str() : "NULL",11788 (pMedium) ? pMedium->i_getName().c_str() : "NULL", 11790 11789 fImplicit)); 11791 11790 … … 11802 11801 ) 11803 11802 { 11804 ComObjPtr<Medium> parent = pMedium-> getParent();11803 ComObjPtr<Medium> parent = pMedium->i_getParent(); 11805 11804 AutoWriteLock parentLock(parent COMMA_LOCKVAL_SRC_POS); 11806 11805 … … 11838 11837 if (pOldAttach->getMedium() == pMedium) 11839 11838 { 11840 LogFlowThisFunc(("--> medium '%s' was attached before, will not remove\n", pMedium-> getName().c_str()));11839 LogFlowThisFunc(("--> medium '%s' was attached before, will not remove\n", pMedium->i_getName().c_str())); 11841 11840 11842 11841 /* yes: remove from old to avoid de-association */ … … 11861 11860 if (pAttach->getType() == DeviceType_HardDisk && pMedium) 11862 11861 { 11863 LogFlowThisFunc(("detaching medium '%s' from machine\n", pMedium-> getName().c_str()));11862 LogFlowThisFunc(("detaching medium '%s' from machine\n", pMedium->i_getName().c_str())); 11864 11863 11865 11864 /* now de-associate from the current machine state */ 11866 rc = pMedium-> removeBackReference(mData->mUuid);11865 rc = pMedium->i_removeBackReference(mData->mUuid); 11867 11866 AssertComRC(rc); 11868 11867 … … 11964 11963 if (pMedium) 11965 11964 { 11966 rc = pMedium-> removeBackReference(mData->mUuid);11965 rc = pMedium->i_removeBackReference(mData->mUuid); 11967 11966 AssertComRC(rc); 11968 11967 } … … 11978 11977 if (pMedium) 11979 11978 { 11980 rc = pMedium-> addBackReference(mData->mUuid);11979 rc = pMedium->i_addBackReference(mData->mUuid); 11981 11980 AssertComRC(rc); 11982 11981 } … … 13994 13993 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 13995 13994 if (!oldmedium.isNull()) 13996 oldmedium-> removeBackReference(mData->mUuid);13995 oldmedium->i_removeBackReference(mData->mUuid); 13997 13996 13998 13997 pAttach->updateMedium(NULL); … … 14726 14725 if (pMedium != NULL) 14727 14726 { 14728 MediumType_T mediumType = pMedium-> getType();14727 MediumType_T mediumType = pMedium->i_getType(); 14729 14728 bool fIsReadOnlyLock = mediumType == MediumType_Readonly 14730 14729 || mediumType == MediumType_Shareable; … … 14732 14731 14733 14732 alock.release(); 14734 mrc = pMedium-> createMediumLockList(fIsVitalImage /* fFailIfInaccessible */,14735 !fIsReadOnlyLock /* fMediumLockWrite */,14736 NULL,14737 *pMediumLockList);14733 mrc = pMedium->i_createMediumLockList(fIsVitalImage /* fFailIfInaccessible */, 14734 !fIsReadOnlyLock /* fMediumLockWrite */, 14735 NULL, 14736 *pMediumLockList); 14738 14737 alock.acquire(); 14739 14738 if (FAILED(mrc)) -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r49742 r49795 659 659 diff.createObject(); 660 660 rc = diff->init(p->getVirtualBox(), 661 pParent-> getPreferredDiffFormat(),661 pParent->i_getPreferredDiffFormat(), 662 662 Utf8StrFmt("%s%c", strSnapshotFolder.c_str(), RTPATH_DELIMITER), 663 663 Guid::Empty /* empty media registry */); … … 665 665 666 666 MediumLockList *pMediumLockList(new MediumLockList()); 667 rc = diff-> createMediumLockList(true /* fFailIfInaccessible */,668 true /* fMediumLockWrite */,669 pParent,670 *pMediumLockList);667 rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, 668 true /* fMediumLockWrite */, 669 pParent, 670 *pMediumLockList); 671 671 if (FAILED(rc)) throw rc; 672 672 rc = pMediumLockList->Lock(); … … 674 674 675 675 /* this already registers the new diff image */ 676 rc = pParent-> createDiffStorage(diff, MediumVariant_Standard,677 pMediumLockList,678 NULL /* aProgress */,679 true /* aWait */);676 rc = pParent->i_createDiffStorage(diff, MediumVariant_Standard, 677 pMediumLockList, 678 NULL /* aProgress */, 679 true /* aWait */); 680 680 delete pMediumLockList; 681 681 if (FAILED(rc)) throw rc; … … 1054 1054 if (pLMedium.isNull()) 1055 1055 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); 1056 ComObjPtr<Medium> pBase = pLMedium-> getBase();1057 if (pBase->i sReadOnly())1056 ComObjPtr<Medium> pBase = pLMedium->i_getBase(); 1057 if (pBase->i_isReadOnly()) 1058 1058 { 1059 1059 ComObjPtr<Medium> pDiff; … … 1181 1181 1182 1182 /* Update the new uuid. */ 1183 pTarget-> updateId(newId);1183 pTarget->i_updateId(newId); 1184 1184 1185 1185 srcLock.release(); … … 1188 1188 1189 1189 ComObjPtr<Medium> pLMedium = static_cast<Medium*>((IMedium*)pMedium); 1190 rc = pLMedium-> cloneToEx(pTarget,1191 srcVar,1192 pNewParent,1193 progress2.asOutParam(),1194 uSrcParentIdx,1195 uTrgParentIdx);1190 rc = pLMedium->i_cloneToEx(pTarget, 1191 srcVar, 1192 pNewParent, 1193 progress2.asOutParam(), 1194 uSrcParentIdx, 1195 uTrgParentIdx); 1196 1196 if (FAILED(rc)) throw rc; 1197 1197 … … 1254 1254 if (pLMedium.isNull()) 1255 1255 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); 1256 ComObjPtr<Medium> pBase = pLMedium-> getBase();1257 if (pBase->i sReadOnly())1256 ComObjPtr<Medium> pBase = pLMedium->i_getBase(); 1257 if (pBase->i_isReadOnly()) 1258 1258 { 1259 1259 ComObjPtr<Medium> pDiff; … … 1292 1292 if (d->options.contains(CloneOptions_Link)) 1293 1293 { 1294 ComObjPtr<Medium> pParent = pMedium-> getParent();1294 ComObjPtr<Medium> pParent = pMedium->i_getParent(); 1295 1295 mlock.release(); 1296 1296 if (!pParent.isNull()) … … 1299 1299 if (FAILED(mac2.rc())) throw mac2.rc(); 1300 1300 AutoReadLock mlock2(pParent COMMA_LOCKVAL_SRC_POS); 1301 if (pParent-> getFirstRegistryMachineId(uuid))1301 if (pParent->i_getFirstRegistryMachineId(uuid)) 1302 1302 { 1303 1303 mlock2.release(); … … 1312 1312 mlock.acquire(); 1313 1313 } 1314 pMedium-> addRegistry(uuid, false /* fRecurse */);1314 pMedium->i_addRegistry(uuid, false /* fRecurse */); 1315 1315 } 1316 1316 /* Check if a snapshot folder is necessary and if so doesn't already … … 1407 1407 { 1408 1408 const ComObjPtr<Medium> &pMedium = newMedia.at(i - 1); 1409 mrc = pMedium-> deleteStorage(NULL /* aProgress */,1409 mrc = pMedium->i_deleteStorage(NULL /* aProgress */, 1410 1410 true /* aWait */); 1411 1411 pMedium->Close(); -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r48967 r49795 251 251 AutoCaller mMediumCaller; 252 252 253 friend HRESULT Medium:: runNow(Medium::Task*);253 friend HRESULT Medium::i_runNow(Medium::Task*); 254 254 255 255 protected: … … 729 729 HRESULT Medium::CreateBaseTask::handler() 730 730 { 731 return mMedium-> taskCreateBaseHandler(*this);731 return mMedium->i_taskCreateBaseHandler(*this); 732 732 } 733 733 … … 737 737 HRESULT Medium::CreateDiffTask::handler() 738 738 { 739 return mMedium-> taskCreateDiffHandler(*this);739 return mMedium->i_taskCreateDiffHandler(*this); 740 740 } 741 741 … … 745 745 HRESULT Medium::CloneTask::handler() 746 746 { 747 return mMedium-> taskCloneHandler(*this);747 return mMedium->i_taskCloneHandler(*this); 748 748 } 749 749 … … 753 753 HRESULT Medium::CompactTask::handler() 754 754 { 755 return mMedium-> taskCompactHandler(*this);755 return mMedium->i_taskCompactHandler(*this); 756 756 } 757 757 … … 761 761 HRESULT Medium::ResizeTask::handler() 762 762 { 763 return mMedium-> taskResizeHandler(*this);763 return mMedium->i_taskResizeHandler(*this); 764 764 } 765 765 … … 770 770 HRESULT Medium::ResetTask::handler() 771 771 { 772 return mMedium-> taskResetHandler(*this);772 return mMedium->i_taskResetHandler(*this); 773 773 } 774 774 … … 778 778 HRESULT Medium::DeleteTask::handler() 779 779 { 780 return mMedium-> taskDeleteHandler(*this);780 return mMedium->i_taskDeleteHandler(*this); 781 781 } 782 782 … … 786 786 HRESULT Medium::MergeTask::handler() 787 787 { 788 return mMedium-> taskMergeHandler(*this);788 return mMedium->i_taskMergeHandler(*this); 789 789 } 790 790 … … 794 794 HRESULT Medium::ExportTask::handler() 795 795 { 796 return mMedium-> taskExportHandler(*this);796 return mMedium->i_taskExportHandler(*this); 797 797 } 798 798 … … 802 802 HRESULT Medium::ImportTask::handler() 803 803 { 804 return mMedium-> taskImportHandler(*this);804 return mMedium->i_taskImportHandler(*this); 805 805 } 806 806 … … 818 818 819 819 /* Initialize the callbacks of the VD error interface */ 820 m->vdIfError.pfnError = vdErrorCall;820 m->vdIfError.pfnError = i_vdErrorCall; 821 821 m->vdIfError.pfnMessage = NULL; 822 822 823 823 /* Initialize the callbacks of the VD config interface */ 824 m->vdIfConfig.pfnAreKeysValid = vdConfigAreKeysValid;825 m->vdIfConfig.pfnQuerySize = vdConfigQuerySize;826 m->vdIfConfig.pfnQuery = vdConfigQuery;824 m->vdIfConfig.pfnAreKeysValid = i_vdConfigAreKeysValid; 825 m->vdIfConfig.pfnQuerySize = i_vdConfigQuerySize; 826 m->vdIfConfig.pfnQuery = i_vdConfigQuery; 827 827 828 828 /* Initialize the callbacks of the VD TCP interface (we always use the host 829 829 * IP stack for now) */ 830 m->vdIfTcpNet.pfnSocketCreate = vdTcpSocketCreate;831 m->vdIfTcpNet.pfnSocketDestroy = vdTcpSocketDestroy;832 m->vdIfTcpNet.pfnClientConnect = vdTcpClientConnect;833 m->vdIfTcpNet.pfnClientClose = vdTcpClientClose;834 m->vdIfTcpNet.pfnIsClientConnected = vdTcpIsClientConnected;835 m->vdIfTcpNet.pfnSelectOne = vdTcpSelectOne;836 m->vdIfTcpNet.pfnRead = vdTcpRead;837 m->vdIfTcpNet.pfnWrite = vdTcpWrite;838 m->vdIfTcpNet.pfnSgWrite = vdTcpSgWrite;839 m->vdIfTcpNet.pfnFlush = vdTcpFlush;840 m->vdIfTcpNet.pfnSetSendCoalescing = vdTcpSetSendCoalescing;841 m->vdIfTcpNet.pfnGetLocalAddress = vdTcpGetLocalAddress;842 m->vdIfTcpNet.pfnGetPeerAddress = vdTcpGetPeerAddress;830 m->vdIfTcpNet.pfnSocketCreate = i_vdTcpSocketCreate; 831 m->vdIfTcpNet.pfnSocketDestroy = i_vdTcpSocketDestroy; 832 m->vdIfTcpNet.pfnClientConnect = i_vdTcpClientConnect; 833 m->vdIfTcpNet.pfnClientClose = i_vdTcpClientClose; 834 m->vdIfTcpNet.pfnIsClientConnected = i_vdTcpIsClientConnected; 835 m->vdIfTcpNet.pfnSelectOne = i_vdTcpSelectOne; 836 m->vdIfTcpNet.pfnRead = i_vdTcpRead; 837 m->vdIfTcpNet.pfnWrite = i_vdTcpWrite; 838 m->vdIfTcpNet.pfnSgWrite = i_vdTcpSgWrite; 839 m->vdIfTcpNet.pfnFlush = i_vdTcpFlush; 840 m->vdIfTcpNet.pfnSetSendCoalescing = i_vdTcpSetSendCoalescing; 841 m->vdIfTcpNet.pfnGetLocalAddress = i_vdTcpGetLocalAddress; 842 m->vdIfTcpNet.pfnGetPeerAddress = i_vdTcpGetPeerAddress; 843 843 m->vdIfTcpNet.pfnSelectOneEx = NULL; 844 844 m->vdIfTcpNet.pfnPoke = NULL; … … 927 927 /* No storage unit is created yet, no need to call Medium::queryInfo */ 928 928 929 rc = setFormat(aFormat);929 rc = i_setFormat(aFormat); 930 930 if (FAILED(rc)) return rc; 931 931 932 rc = setLocation(aLocation);932 rc = i_setLocation(aLocation); 933 933 if (FAILED(rc)) return rc; 934 934 … … 1040 1040 m->type = MediumType_Writethrough; 1041 1041 1042 rc = setLocation(aLocation);1042 rc = i_setLocation(aLocation); 1043 1043 if (FAILED(rc)) return rc; 1044 1044 … … 1065 1065 /* need to call queryInfo immediately to correctly place the medium in 1066 1066 * the respective media tree and update other information such as uuid */ 1067 rc = queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */);1067 rc = i_queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */); 1068 1068 if (SUCCEEDED(rc)) 1069 1069 { … … 1168 1168 { 1169 1169 AssertReturn(!data.strFormat.isEmpty(), E_FAIL); 1170 rc = setFormat(data.strFormat);1170 rc = i_setFormat(data.strFormat); 1171 1171 if (FAILED(rc)) return rc; 1172 1172 } … … 1175 1175 /// @todo handle host drive settings here as well? 1176 1176 if (!data.strFormat.isEmpty()) 1177 rc = setFormat(data.strFormat);1177 rc = i_setFormat(data.strFormat); 1178 1178 else 1179 rc = setFormat("RAW");1179 rc = i_setFormat("RAW"); 1180 1180 if (FAILED(rc)) return rc; 1181 1181 } … … 1237 1237 strFull = data.strLocation; 1238 1238 1239 rc = setLocation(strFull);1239 rc = i_setLocation(strFull); 1240 1240 if (FAILED(rc)) return rc; 1241 1241 … … 1345 1345 m->state = MediumState_Created; 1346 1346 m->hostDrive = true; 1347 HRESULT rc = setFormat("RAW");1347 HRESULT rc = i_setFormat("RAW"); 1348 1348 if (FAILED(rc)) return rc; 1349 rc = setLocation(aLocation);1349 rc = i_setLocation(aLocation); 1350 1350 if (FAILED(rc)) return rc; 1351 1351 m->strDescription = aDescription; … … 1399 1399 { 1400 1400 // this is a differencing disk: then remove it from the parent's children list 1401 deparent();1401 i_deparent(); 1402 1402 } 1403 1403 } … … 1412 1412 * The caller must hold the medium tree lock! 1413 1413 */ 1414 void Medium:: deparent()1414 void Medium::i_deparent() 1415 1415 { 1416 1416 MediaList &llParent = m->pParent->m->llChildren; … … 1435 1435 * The caller must hold the medium tree lock! 1436 1436 */ 1437 void Medium:: setParent(const ComObjPtr<Medium> &pParent)1437 void Medium::i_setParent(const ComObjPtr<Medium> &pParent) 1438 1438 { 1439 1439 m->pParent = pParent; … … 1449 1449 //////////////////////////////////////////////////////////////////////////////// 1450 1450 1451 STDMETHODIMP Medium::COMGETTER(Id)(BSTR *aId) 1452 { 1453 CheckComArgOutPointerValid(aId); 1454 1455 AutoCaller autoCaller(this); 1456 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1457 1451 HRESULT Medium::getId(com::Guid &aId) 1452 { 1458 1453 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1459 1454 1460 m->id.toUtf16().cloneTo(aId);1455 aId = m->id; 1461 1456 1462 1457 return S_OK; 1463 1458 } 1464 1459 1465 STDMETHODIMP Medium::COMGETTER(Description)(BSTR *aDescription) 1466 { 1467 CheckComArgOutPointerValid(aDescription); 1468 1469 AutoCaller autoCaller(this); 1470 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1471 1460 HRESULT Medium::getDescription(com::Utf8Str &aDescription) 1461 { 1472 1462 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1473 1463 1474 m->strDescription.cloneTo(aDescription);1464 aDescription = m->strDescription; 1475 1465 1476 1466 return S_OK; 1477 1467 } 1478 1468 1479 STDMETHODIMP Medium::COMSETTER(Description)(IN_BSTR aDescription) 1480 { 1481 AutoCaller autoCaller(this); 1482 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1483 1469 HRESULT Medium::setDescription(const com::Utf8Str &aDescription) 1470 { 1484 1471 // AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1485 1472 … … 1488 1475 /// require to add the mRegistered flag to data 1489 1476 1490 NOREF(aDescription);1491 1492 1477 ReturnComNotImplemented(); 1493 1478 } 1494 1479 1495 STDMETHODIMP Medium::COMGETTER(State)(MediumState_T *aState) 1496 { 1497 CheckComArgOutPointerValid(aState); 1498 1499 AutoCaller autoCaller(this); 1500 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1501 1480 HRESULT Medium::getState(MediumState_T *aState) 1481 { 1502 1482 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1503 1483 *aState = m->state; … … 1506 1486 } 1507 1487 1508 STDMETHODIMP Medium::COMGETTER(Variant)(ComSafeArrayOut(MediumVariant_T, aVariant)) 1509 { 1510 CheckComArgOutSafeArrayPointerValid(aVariant); 1511 1512 AutoCaller autoCaller(this); 1513 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1514 1488 HRESULT Medium::getVariant(std::vector<MediumVariant_T> &aVariant) 1489 { 1515 1490 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1516 1491 1517 1492 SafeArray<MediumVariant_T> variants(sizeof(MediumVariant_T)*8); 1518 1493 1494 aVariant.resize(variants.size()); 1519 1495 for (ULONG i = 0; i < variants.size(); ++i) 1520 1496 { 1521 1497 ULONG temp = m->variant; 1522 1498 temp &= 1<<i; 1523 variants [i] = (MediumVariant_T)temp; 1524 } 1525 1526 variants.detachTo(ComSafeArrayOutArg(aVariant)); 1499 aVariant[i] = (MediumVariant_T)temp; 1500 } 1527 1501 1528 1502 return S_OK; 1529 1503 } 1530 1504 1531 STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation) 1532 { 1533 CheckComArgOutPointerValid(aLocation); 1534 1535 AutoCaller autoCaller(this); 1536 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1537 1505 HRESULT Medium::getLocation(com::Utf8Str &aLocation) 1506 { 1538 1507 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1539 1508 1540 m->strLocationFull.cloneTo(aLocation);1509 aLocation = m->strLocationFull; 1541 1510 1542 1511 return S_OK; 1543 1512 } 1544 1513 1545 STDMETHODIMP Medium::COMGETTER(Name)(BSTR *aName) 1546 { 1547 CheckComArgOutPointerValid(aName); 1548 1549 AutoCaller autoCaller(this); 1550 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1551 1514 HRESULT Medium::getName(com::Utf8Str &aName) 1515 { 1552 1516 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1553 1517 1554 getName().cloneTo(aName);1518 aName = i_getName(); 1555 1519 1556 1520 return S_OK; 1557 1521 } 1558 1522 1559 STDMETHODIMP Medium::COMGETTER(DeviceType)(DeviceType_T *aDeviceType) 1560 { 1561 CheckComArgOutPointerValid(aDeviceType); 1562 1563 AutoCaller autoCaller(this); 1564 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1565 1523 HRESULT Medium::getDeviceType(DeviceType_T *aDeviceType) 1524 { 1566 1525 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1567 1526 … … 1571 1530 } 1572 1531 1573 STDMETHODIMP Medium::COMGETTER(HostDrive)(BOOL *aHostDrive) 1574 { 1575 CheckComArgOutPointerValid(aHostDrive); 1576 1577 AutoCaller autoCaller(this); 1578 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1579 1532 HRESULT Medium::getHostDrive(BOOL *aHostDrive) 1533 { 1580 1534 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1581 1535 … … 1585 1539 } 1586 1540 1587 STDMETHODIMP Medium::COMGETTER(Size)(LONG64 *aSize) 1588 { 1589 CheckComArgOutPointerValid(aSize); 1590 1591 AutoCaller autoCaller(this); 1592 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1593 1541 HRESULT Medium::getSize(LONG64 *aSize) 1542 { 1594 1543 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1595 1544 … … 1599 1548 } 1600 1549 1601 STDMETHODIMP Medium::COMGETTER(Format)(BSTR *aFormat) 1602 { 1603 CheckComArgOutPointerValid(aFormat); 1604 1605 AutoCaller autoCaller(this); 1606 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1607 1550 HRESULT Medium::getFormat(com::Utf8Str &aFormat) 1551 { 1608 1552 /* no need to lock, m->strFormat is const */ 1609 m->strFormat.cloneTo(aFormat); 1610 1553 1554 aFormat = m->strFormat; 1611 1555 return S_OK; 1612 1556 } 1613 1557 1614 STDMETHODIMP Medium::COMGETTER(MediumFormat)(IMediumFormat **aMediumFormat) 1615 { 1616 CheckComArgOutPointerValid(aMediumFormat); 1617 1618 AutoCaller autoCaller(this); 1619 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1620 1558 HRESULT Medium::getMediumFormat(ComPtr<IMediumFormat> &aMediumFormat) 1559 { 1621 1560 /* no need to lock, m->formatObj is const */ 1622 m->formatObj.queryInterfaceTo(aMediumFormat );1561 m->formatObj.queryInterfaceTo(aMediumFormat.asOutParam()); 1623 1562 1624 1563 return S_OK; 1625 1564 } 1626 1565 1627 STDMETHODIMP Medium::COMGETTER(Type)(MediumType_T *aType) 1628 { 1629 CheckComArgOutPointerValid(aType); 1630 1631 AutoCaller autoCaller(this); 1632 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1633 1566 HRESULT Medium::getType(MediumType_T *aType) 1567 { 1634 1568 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1635 1569 … … 1639 1573 } 1640 1574 1641 STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType) 1642 { 1643 AutoCaller autoCaller(this); 1644 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1645 1575 HRESULT Medium::setType(MediumType_T aType) 1576 { 1646 1577 // we access mParent and members 1647 1578 AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); … … 1654 1585 break; 1655 1586 default: 1656 return setStateError();1587 return i_setStateError(); 1657 1588 } 1658 1589 … … 1663 1594 } 1664 1595 1665 DeviceType_T devType = getDeviceType();1596 DeviceType_T devType = i_getDeviceType(); 1666 1597 // DVD media can only be readonly. 1667 1598 if (devType == DeviceType_DVD && aType != MediumType_Readonly) … … 1714 1645 /* cannot change to writethrough, shareable or readonly 1715 1646 * if there are children */ 1716 if ( getChildren().size() != 0)1647 if (i_getChildren().size() != 0) 1717 1648 return setError(VBOX_E_OBJECT_IN_USE, 1718 1649 tr("Cannot change type for medium '%s' since it has %d child media"), 1719 m->strLocationFull.c_str(), getChildren().size());1650 m->strLocationFull.c_str(), i_getChildren().size()); 1720 1651 if (aType == MediumType_Shareable) 1721 1652 { 1722 MediumVariant_T variant = getVariant();1653 MediumVariant_T variant = i_getVariant(); 1723 1654 if (!(variant & MediumVariant_Fixed)) 1724 1655 return setError(VBOX_E_INVALID_OBJECT_STATE, … … 1753 1684 // global registry: 1754 1685 const Guid &uuidGlobalRegistry = m->pVirtualBox->getGlobalRegistryId(); 1755 if (i sInRegistry(uuidGlobalRegistry))1686 if (i_isInRegistry(uuidGlobalRegistry)) 1756 1687 return setError(VBOX_E_INVALID_OBJECT_STATE, 1757 1688 tr("Cannot change type for medium '%s': the media type 'MultiAttach' can only be used " … … 1765 1696 mlock.release(); 1766 1697 treeLock.release(); 1767 markRegistriesModified();1698 i_markRegistriesModified(); 1768 1699 m->pVirtualBox->saveModifiedRegistries(); 1769 1700 … … 1771 1702 } 1772 1703 1773 STDMETHODIMP Medium::COMGETTER(AllowedTypes)(ComSafeArrayOut(MediumType_T, aAllowedTypes)) 1774 { 1775 CheckComArgOutSafeArrayPointerValid(aAllowedTypes); 1776 NOREF(aAllowedTypes); 1777 #ifndef RT_OS_WINDOWS 1778 NOREF(aAllowedTypesSize); 1779 #endif 1780 1781 AutoCaller autoCaller(this); 1782 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1783 1704 HRESULT Medium::getAllowedTypes(std::vector<MediumType_T> &aAllowedTypes) 1705 { 1784 1706 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1785 1707 … … 1787 1709 } 1788 1710 1789 STDMETHODIMP Medium::COMGETTER(Parent)(IMedium **aParent) 1790 { 1791 CheckComArgOutPointerValid(aParent); 1792 1793 AutoCaller autoCaller(this); 1794 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1795 1711 HRESULT Medium::getParent(ComPtr<IMedium> &aParent) 1712 { 1796 1713 /* we access mParent */ 1797 1714 AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1798 1715 1799 m->pParent.queryInterfaceTo(aParent );1716 m->pParent.queryInterfaceTo(aParent.asOutParam()); 1800 1717 1801 1718 return S_OK; 1802 1719 } 1803 1720 1804 STDMETHODIMP Medium::COMGETTER(Children)(ComSafeArrayOut(IMedium *, aChildren)) 1805 { 1806 CheckComArgOutSafeArrayPointerValid(aChildren); 1807 1808 AutoCaller autoCaller(this); 1809 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1810 1721 HRESULT Medium::getChildren(std::vector<ComPtr<IMedium> > &aChildren) 1722 { 1811 1723 /* we access children */ 1812 1724 AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1813 1725 1814 SafeIfaceArray<IMedium> children(this->getChildren()); 1815 children.detachTo(ComSafeArrayOutArg(aChildren)); 1816 1726 MediaList children(this->i_getChildren()); 1727 aChildren.resize(children.size()); 1728 size_t i = 0; 1729 for (MediaList::const_iterator it = children.begin(); it != children.end(); ++it, ++i) 1730 (*it).queryInterfaceTo(aChildren[i].asOutParam()); 1817 1731 return S_OK; 1818 1732 } 1819 1733 1820 STDMETHODIMP Medium::COMGETTER(Base)(IMedium **aBase) 1821 { 1822 CheckComArgOutPointerValid(aBase); 1823 1824 /* base() will do callers/locking */ 1825 1826 getBase().queryInterfaceTo(aBase); 1734 HRESULT Medium::getBase(ComPtr<IMedium> &aBase) 1735 { 1736 /* i_getBase() will do callers/locking */ 1737 i_getBase().queryInterfaceTo(aBase.asOutParam()); 1827 1738 1828 1739 return S_OK; 1829 1740 } 1830 1741 1831 STDMETHODIMP Medium::COMGETTER(ReadOnly)(BOOL *aReadOnly) 1832 { 1833 CheckComArgOutPointerValid(aReadOnly); 1834 1835 AutoCaller autoCaller(this); 1836 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1837 1742 HRESULT Medium::getReadOnly(BOOL *aReadOnly) 1743 { 1838 1744 /* isReadOnly() will do locking */ 1839 1840 *aReadOnly = isReadOnly(); 1745 *aReadOnly = i_isReadOnly(); 1841 1746 1842 1747 return S_OK; 1843 1748 } 1844 1749 1845 STDMETHODIMP Medium::COMGETTER(LogicalSize)(LONG64 *aLogicalSize) 1846 { 1847 CheckComArgOutPointerValid(aLogicalSize); 1848 1849 AutoCaller autoCaller(this); 1850 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1851 1750 HRESULT Medium::getLogicalSize(LONG64 *aLogicalSize) 1751 { 1852 1752 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1853 1753 … … 1857 1757 } 1858 1758 1859 STDMETHODIMP Medium::COMGETTER(AutoReset)(BOOL *aAutoReset) 1860 { 1861 CheckComArgOutPointerValid(aAutoReset); 1862 1863 AutoCaller autoCaller(this); 1864 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1865 1759 HRESULT Medium::getAutoReset(BOOL *aAutoReset) 1760 { 1866 1761 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1867 1762 … … 1874 1769 } 1875 1770 1876 STDMETHODIMP Medium::COMSETTER(AutoReset)(BOOL aAutoReset) 1877 { 1878 AutoCaller autoCaller(this); 1879 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1880 1771 HRESULT Medium::setAutoReset(BOOL aAutoReset) 1772 { 1881 1773 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 1882 1774 … … 1892 1784 // save the settings 1893 1785 mlock.release(); 1894 markRegistriesModified();1786 i_markRegistriesModified(); 1895 1787 m->pVirtualBox->saveModifiedRegistries(); 1896 1788 } … … 1899 1791 } 1900 1792 1901 STDMETHODIMP Medium::COMGETTER(LastAccessError)(BSTR *aLastAccessError) 1902 { 1903 CheckComArgOutPointerValid(aLastAccessError); 1904 1905 AutoCaller autoCaller(this); 1906 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1907 1793 HRESULT Medium::getLastAccessError(com::Utf8Str &aLastAccessError) 1794 { 1908 1795 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1909 1796 1910 m->strLastAccessError.cloneTo(aLastAccessError);1797 aLastAccessError = m->strLastAccessError; 1911 1798 1912 1799 return S_OK; 1913 1800 } 1914 1801 1915 STDMETHODIMP Medium::COMGETTER(MachineIds)(ComSafeArrayOut(BSTR,aMachineIds)) 1916 { 1917 CheckComArgOutSafeArrayPointerValid(aMachineIds); 1918 1919 AutoCaller autoCaller(this); 1920 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1921 1802 HRESULT Medium::getMachineIds(std::vector<com::Guid> &aMachineIds) 1803 { 1922 1804 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1923 1805 1924 com::SafeArray<BSTR> machineIds;1925 1926 1806 if (m->backRefs.size() != 0) 1927 1807 { 1928 machineIds.reset(m->backRefs.size());1929 1808 BackRefList brlist(m->backRefs); 1809 aMachineIds.resize(brlist.size()); 1930 1810 size_t i = 0; 1931 for (BackRefList::const_iterator it = m->backRefs.begin(); 1932 it != m->backRefs.end(); ++it, ++i) 1933 { 1934 it->machineId.toUtf16().detachTo(&machineIds[i]); 1935 } 1936 } 1937 1938 machineIds.detachTo(ComSafeArrayOutArg(aMachineIds)); 1811 for (BackRefList::const_iterator it = brlist.begin(); it != brlist.end(); ++it, ++i) 1812 aMachineIds[i] = it->machineId; 1813 } 1939 1814 1940 1815 return S_OK; 1941 1816 } 1942 1817 1943 STDMETHODIMP Medium::SetIds(BOOL aSetImageId, 1944 IN_BSTR aImageId, 1945 BOOL aSetParentId, 1946 IN_BSTR aParentId) 1947 { 1948 AutoCaller autoCaller(this); 1949 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1950 1818 HRESULT Medium::setIds(BOOL aSetImageId, 1819 const com::Guid &aImageId, 1820 BOOL aSetParentId, 1821 const com::Guid &aParentId) 1822 { 1951 1823 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1952 1824 … … 1956 1828 break; 1957 1829 default: 1958 return setStateError();1830 return i_setStateError(); 1959 1831 } 1960 1832 … … 1962 1834 if (aSetImageId) 1963 1835 { 1964 if ( Bstr(aImageId).isEmpty())1836 if (aImageId.toUtf16().isEmpty()) 1965 1837 imageId.create(); 1966 1838 else 1967 1839 { 1968 imageId = Guid(aImageId);1840 imageId = aImageId; 1969 1841 if (!imageId.isValid()) 1970 1842 return setError(E_INVALIDARG, tr("Argument %s is invalid"), "aImageId"); … … 1973 1845 if (aSetParentId) 1974 1846 { 1975 if ( Bstr(aParentId).isEmpty())1847 if (aParentId.toUtf16().isEmpty()) 1976 1848 parentId.create(); 1977 1849 else 1978 parentId = Guid(aParentId);1850 parentId = aParentId; 1979 1851 } 1980 1852 … … 1985 1857 alock.release(); 1986 1858 1987 HRESULT rc = queryInfo(!!aSetImageId /* fSetImageId */,1859 HRESULT rc = i_queryInfo(!!aSetImageId /* fSetImageId */, 1988 1860 !!aSetParentId /* fSetParentId */); 1989 1861 … … 1991 1863 } 1992 1864 1993 STDMETHODIMP Medium::RefreshState(MediumState_T *aState) 1994 { 1995 CheckComArgOutPointerValid(aState); 1996 1997 AutoCaller autoCaller(this); 1998 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1999 1865 HRESULT Medium::refreshState(MediumState_T *aState) 1866 { 2000 1867 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2001 1868 … … 2011 1878 alock.release(); 2012 1879 2013 rc = queryInfo(false /* fSetImageId */, false /* fSetParentId */);1880 rc = i_queryInfo(false /* fSetImageId */, false /* fSetParentId */); 2014 1881 2015 1882 alock.acquire(); … … 2025 1892 } 2026 1893 2027 STDMETHODIMP Medium::GetSnapshotIds(IN_BSTR aMachineId, 2028 ComSafeArrayOut(BSTR, aSnapshotIds)) 2029 { 2030 CheckComArgExpr(aMachineId, Guid(aMachineId).isValid()); 2031 CheckComArgOutSafeArrayPointerValid(aSnapshotIds); 2032 2033 AutoCaller autoCaller(this); 2034 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2035 1894 HRESULT Medium::getSnapshotIds(const com::Guid &aMachineId, 1895 std::vector<com::Guid> &aSnapshotIds) 1896 { 2036 1897 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2037 1898 2038 com::SafeArray<BSTR> snapshotIds;2039 2040 Guid id(aMachineId);2041 1899 for (BackRefList::const_iterator it = m->backRefs.begin(); 2042 1900 it != m->backRefs.end(); ++it) 2043 1901 { 2044 if (it->machineId == id)1902 if (it->machineId == aMachineId) 2045 1903 { 2046 1904 size_t size = it->llSnapshotIds.size(); … … 2053 1911 if (size > 0) 2054 1912 { 2055 snapshotIds.reset(size);1913 aSnapshotIds.resize(size); 2056 1914 2057 1915 size_t j = 0; 2058 1916 if (it->fInCurState) 2059 it->machineId.toUtf16().detachTo(&snapshotIds[j++]); 2060 2061 for (GuidList::const_iterator jt = it->llSnapshotIds.begin(); 2062 jt != it->llSnapshotIds.end(); 2063 ++jt, ++j) 2064 { 2065 (*jt).toUtf16().detachTo(&snapshotIds[j]); 2066 } 1917 aSnapshotIds[j++] = it->machineId.toUtf16(); 1918 1919 for(GuidList::const_iterator jt = it->llSnapshotIds.begin(); jt != it->llSnapshotIds.end(); ++jt, ++j) 1920 aSnapshotIds[j] = (*jt); 2067 1921 } 2068 1922 … … 2071 1925 } 2072 1926 2073 snapshotIds.detachTo(ComSafeArrayOutArg(aSnapshotIds));2074 2075 1927 return S_OK; 2076 1928 } 2077 1929 2078 STDMETHODIMP Medium::LockRead(IToken **aToken) 2079 { 2080 CheckComArgNotNull(aToken); 2081 2082 AutoCaller autoCaller(this); 2083 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2084 1930 HRESULT Medium::lockRead(ComPtr<IToken> &aToken) 1931 { 2085 1932 /* Must not hold the object lock, as we need control over it below. */ 2086 1933 Assert(!isWriteLockOnCurrentThread()); … … 2134 1981 } 2135 1982 2136 pToken.queryInterfaceTo(aToken );1983 pToken.queryInterfaceTo(aToken.asOutParam()); 2137 1984 break; 2138 1985 } … … 2140 1987 { 2141 1988 LogFlowThisFunc(("Failing - state=%d\n", m->state)); 2142 rc = setStateError();1989 rc = i_setStateError(); 2143 1990 break; 2144 1991 } … … 2152 1999 * in-process calls). 2153 2000 */ 2154 HRESULT Medium:: unlockRead(MediumState_T *aState)2001 HRESULT Medium::i_unlockRead(MediumState_T *aState) 2155 2002 { 2156 2003 AutoCaller autoCaller(this); … … 2198 2045 return rc; 2199 2046 } 2200 2201 STDMETHODIMP Medium::LockWrite(IToken **aToken) 2202 { 2203 CheckComArgNotNull(aToken); 2204 2205 AutoCaller autoCaller(this); 2206 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2207 2047 HRESULT Medium::lockWrite(ComPtr<IToken> &aToken) 2048 { 2208 2049 /* Must not hold the object lock, as we need control over it below. */ 2209 2050 Assert(!isWriteLockOnCurrentThread()); … … 2235 2076 m->preLockState = m->state; 2236 2077 2237 LogFlowThisFunc(("Okay - prev state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));2078 LogFlowThisFunc(("Okay - prev state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str())); 2238 2079 m->state = MediumState_LockedWrite; 2239 2080 … … 2248 2089 } 2249 2090 2250 pToken.queryInterfaceTo(aToken );2091 pToken.queryInterfaceTo(aToken.asOutParam()); 2251 2092 break; 2252 2093 } 2253 2094 default: 2254 2095 { 2255 LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));2256 rc = setStateError();2096 LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str())); 2097 rc = i_setStateError(); 2257 2098 break; 2258 2099 } … … 2266 2107 * in-process calls). 2267 2108 */ 2268 HRESULT Medium:: unlockWrite(MediumState_T *aState)2109 HRESULT Medium::i_unlockWrite(MediumState_T *aState) 2269 2110 { 2270 2111 AutoCaller autoCaller(this); … … 2285 2126 if (m->preLockState == MediumState_Deleting) 2286 2127 m->preLockState = MediumState_Created; 2287 LogFlowThisFunc(("new state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));2128 LogFlowThisFunc(("new state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str())); 2288 2129 break; 2289 2130 } 2290 2131 default: 2291 2132 { 2292 LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));2133 LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str())); 2293 2134 rc = setError(VBOX_E_INVALID_OBJECT_STATE, 2294 2135 tr("Medium '%s' is not locked for writing"), … … 2305 2146 } 2306 2147 2307 STDMETHODIMP Medium::Close()2148 HRESULT Medium::close() 2308 2149 { 2309 2150 AutoCaller autoCaller(this); … … 2313 2154 ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox); 2314 2155 2315 MultiResult mrc = close(autoCaller);2156 MultiResult mrc = i_close(autoCaller); 2316 2157 2317 2158 pVirtualBox->saveModifiedRegistries(); … … 2320 2161 } 2321 2162 2322 STDMETHODIMP Medium::GetProperty(IN_BSTR aName, BSTR *aValue) 2323 { 2324 CheckComArgStrNotEmptyOrNull(aName); 2325 CheckComArgOutPointerValid(aValue); 2326 2327 AutoCaller autoCaller(this); 2328 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2329 2163 HRESULT Medium::getProperty(const com::Utf8Str &aName, 2164 com::Utf8Str &aValue) 2165 { 2330 2166 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2331 2167 2332 settings::StringsMap::const_iterator it = m->mapProperties.find( Utf8Str(aName));2168 settings::StringsMap::const_iterator it = m->mapProperties.find(aName); 2333 2169 if (it == m->mapProperties.end()) 2334 2170 { 2335 if (! Utf8Str(aName).startsWith("Special/"))2171 if (!aName.startsWith("Special/")) 2336 2172 return setError(VBOX_E_OBJECT_NOT_FOUND, 2337 tr("Property '%ls' does not exist"), aName);2173 tr("Property '%ls' does not exist"), Bstr(aName).raw()); 2338 2174 else 2339 2175 /* be more silent here */ … … 2341 2177 } 2342 2178 2343 it->second.cloneTo(aValue);2179 aValue = it->second; 2344 2180 2345 2181 return S_OK; 2346 2182 } 2347 2183 2348 STDMETHODIMP Medium::SetProperty(IN_BSTR aName, IN_BSTR aValue) 2349 { 2350 CheckComArgStrNotEmptyOrNull(aName); 2351 2352 AutoCaller autoCaller(this); 2353 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2354 2184 HRESULT Medium::setProperty(const com::Utf8Str &aName, 2185 const com::Utf8Str &aValue) 2186 { 2355 2187 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 2356 2188 … … 2361 2193 break; 2362 2194 default: 2363 return setStateError(); 2364 } 2365 2366 Utf8Str strName(aName); 2367 Utf8Str strValue(aValue); 2368 settings::StringsMap::iterator it = m->mapProperties.find(strName); 2369 if (!strName.startsWith("Special/")) 2195 return i_setStateError(); 2196 } 2197 2198 settings::StringsMap::iterator it = m->mapProperties.find(aName); 2199 if (!aName.startsWith("Special/")) 2370 2200 { 2371 2201 if (it == m->mapProperties.end()) 2372 2202 return setError(VBOX_E_OBJECT_NOT_FOUND, 2373 2203 tr("Property '%s' does not exist"), 2374 strName.c_str());2375 it->second = strValue;2204 aName.c_str()); 2205 it->second = aValue; 2376 2206 } 2377 2207 else … … 2379 2209 if (it == m->mapProperties.end()) 2380 2210 { 2381 if (! strValue.isEmpty())2382 m->mapProperties[ strName] = strValue;2211 if (!aValue.isEmpty()) 2212 m->mapProperties[aName] = aValue; 2383 2213 } 2384 2214 else 2385 2215 { 2386 if (! strValue.isEmpty())2216 if (!aValue.isEmpty()) 2387 2217 it->second = aValue; 2388 2218 else … … 2393 2223 // save the settings 2394 2224 mlock.release(); 2395 markRegistriesModified();2225 i_markRegistriesModified(); 2396 2226 m->pVirtualBox->saveModifiedRegistries(); 2397 2227 … … 2399 2229 } 2400 2230 2401 STDMETHODIMP Medium::GetProperties(IN_BSTR aNames, 2402 ComSafeArrayOut(BSTR, aReturnNames), 2403 ComSafeArrayOut(BSTR, aReturnValues)) 2404 { 2405 CheckComArgOutSafeArrayPointerValid(aReturnNames); 2406 CheckComArgOutSafeArrayPointerValid(aReturnValues); 2407 2408 AutoCaller autoCaller(this); 2409 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2410 2231 HRESULT Medium::getProperties(const com::Utf8Str &aNames, 2232 std::vector<com::Utf8Str> &aReturnNames, 2233 std::vector<com::Utf8Str> &aReturnValues) 2234 { 2411 2235 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2412 2236 … … 2414 2238 NOREF(aNames); 2415 2239 2416 com::SafeArray<BSTR> names(m->mapProperties.size());2417 com::SafeArray<BSTR> values(m->mapProperties.size());2240 aReturnNames.resize(m->mapProperties.size()); 2241 aReturnValues.resize(m->mapProperties.size()); 2418 2242 size_t i = 0; 2419 2420 2243 for (settings::StringsMap::const_iterator it = m->mapProperties.begin(); 2421 2244 it != m->mapProperties.end(); 2422 ++it) 2423 { 2424 it->first.cloneTo(&names[i]); 2425 it->second.cloneTo(&values[i]); 2426 ++i; 2427 } 2428 2429 names.detachTo(ComSafeArrayOutArg(aReturnNames)); 2430 values.detachTo(ComSafeArrayOutArg(aReturnValues)); 2431 2245 ++it, ++i) 2246 { 2247 aReturnNames[i] = it->first; 2248 aReturnValues[i] = it->second; 2249 } 2432 2250 return S_OK; 2433 2251 } 2434 2252 2435 STDMETHODIMP Medium::SetProperties(ComSafeArrayIn(IN_BSTR, aNames), 2436 ComSafeArrayIn(IN_BSTR, aValues)) 2437 { 2438 CheckComArgSafeArrayNotNull(aNames); 2439 CheckComArgSafeArrayNotNull(aValues); 2440 2441 AutoCaller autoCaller(this); 2442 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2443 2253 HRESULT Medium::setProperties(const std::vector<com::Utf8Str> &aNames, 2254 const std::vector<com::Utf8Str> &aValues) 2255 { 2444 2256 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 2445 2446 com::SafeArray<IN_BSTR> names(ComSafeArrayInArg(aNames));2447 com::SafeArray<IN_BSTR> values(ComSafeArrayInArg(aValues));2448 2257 2449 2258 /* first pass: validate names */ 2450 2259 for (size_t i = 0; 2451 i < names.size();2260 i < aNames.size(); 2452 2261 ++i) 2453 2262 { 2454 Utf8Str strName( names[i]);2263 Utf8Str strName(aNames[i]); 2455 2264 if ( !strName.startsWith("Special/") 2456 2265 && m->mapProperties.find(strName) == m->mapProperties.end()) … … 2461 2270 /* second pass: assign */ 2462 2271 for (size_t i = 0; 2463 i < names.size();2272 i < aNames.size(); 2464 2273 ++i) 2465 2274 { 2466 Utf8Str strName( names[i]);2467 Utf8Str strValue( values[i]);2275 Utf8Str strName(aNames[i]); 2276 Utf8Str strValue(aValues[i]); 2468 2277 settings::StringsMap::iterator it = m->mapProperties.find(strName); 2469 2278 if (!strName.startsWith("Special/")) … … 2491 2300 // save the settings 2492 2301 mlock.release(); 2493 markRegistriesModified();2302 i_markRegistriesModified(); 2494 2303 m->pVirtualBox->saveModifiedRegistries(); 2495 2304 2496 2305 return S_OK; 2497 2306 } 2498 2499 STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize, 2500 ComSafeArrayIn(MediumVariant_T, aVariant), 2501 IProgress **aProgress) 2502 { 2503 CheckComArgSafeArrayNotNull(aVariant); 2504 CheckComArgOutPointerValid(aProgress); 2307 HRESULT Medium::createBaseStorage(LONG64 aLogicalSize, 2308 const std::vector<MediumVariant_T> &aVariant, 2309 ComPtr<IProgress> &aProgress) 2310 { 2505 2311 if (aLogicalSize < 0) 2506 2312 return setError(E_INVALIDARG, tr("The medium size argument (%lld) is negative"), aLogicalSize); 2507 2508 AutoCaller autoCaller(this);2509 if (FAILED(autoCaller.rc())) return autoCaller.rc();2510 2313 2511 2314 HRESULT rc = S_OK; … … 2519 2322 ULONG mediumVariantFlags = 0; 2520 2323 2521 if (aVariant )2522 { 2523 com::SafeArray<MediumVariant_T> variants( ComSafeArrayInArg(aVariant));2324 if (aVariant.size()) 2325 { 2326 com::SafeArray<MediumVariant_T> variants(aVariant); 2524 2327 for (size_t i = 0; i < variants.size(); i++) 2525 2328 mediumVariantFlags |= variants[i]; … … 2541 2344 2542 2345 if (m->state != MediumState_NotCreated) 2543 throw setStateError();2346 throw i_setStateError(); 2544 2347 2545 2348 pProgress.createObject(); … … 2568 2371 if (SUCCEEDED(rc)) 2569 2372 { 2570 rc = startThread(pTask);2373 rc = i_startThread(pTask); 2571 2374 2572 2375 if (SUCCEEDED(rc)) 2573 pProgress.queryInterfaceTo(aProgress );2376 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2574 2377 } 2575 2378 else if (pTask != NULL) … … 2579 2382 } 2580 2383 2581 STDMETHODIMP Medium::DeleteStorage(IProgress **aProgress) 2582 { 2583 CheckComArgOutPointerValid(aProgress); 2584 2585 AutoCaller autoCaller(this); 2586 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2587 2384 HRESULT Medium::deleteStorage(ComPtr<IProgress> &aProgress) 2385 { 2588 2386 ComObjPtr<Progress> pProgress; 2589 2387 2590 MultiResult mrc = deleteStorage(&pProgress,2591 false /* aWait */);2388 MultiResult mrc = i_deleteStorage(&pProgress, 2389 false /* aWait */); 2592 2390 /* Must save the registries in any case, since an entry was removed. */ 2593 2391 m->pVirtualBox->saveModifiedRegistries(); 2594 2392 2595 2393 if (SUCCEEDED(mrc)) 2596 pProgress.queryInterfaceTo(aProgress );2394 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2597 2395 2598 2396 return mrc; 2599 2397 } 2600 2398 2601 STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget, 2602 ComSafeArrayIn(MediumVariant_T, aVariant), 2603 IProgress **aProgress) 2604 { 2605 CheckComArgNotNull(aTarget); 2606 CheckComArgOutPointerValid(aProgress); 2607 CheckComArgSafeArrayNotNull(aVariant); 2608 2609 AutoCaller autoCaller(this); 2610 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2611 2612 ComObjPtr<Medium> diff = static_cast<Medium*>(aTarget); 2399 HRESULT Medium::createDiffStorage(const ComPtr<IMedium> &aTarget, 2400 const std::vector<MediumVariant_T> &aVariant, 2401 ComPtr<IProgress> &aProgress) 2402 { 2403 IMedium *aT = aTarget; 2404 ComObjPtr<Medium> diff = static_cast<Medium*>(aT); 2613 2405 2614 2406 // locking: we need the tree lock first because we access parent pointers … … 2632 2424 MediumLockList *pMediumLockList(new MediumLockList()); 2633 2425 alock.release(); 2634 HRESULT rc = diff-> createMediumLockList(true /* fFailIfInaccessible */,2426 HRESULT rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, 2635 2427 true /* fMediumLockWrite */, 2636 2428 this, … … 2651 2443 2652 2444 return setError(rc, tr("Could not lock medium when creating diff '%s'"), 2653 diff-> getLocationFull().c_str());2445 diff->i_getLocationFull().c_str()); 2654 2446 } 2655 2447 2656 2448 Guid parentMachineRegistry; 2657 if ( getFirstRegistryMachineId(parentMachineRegistry))2449 if (i_getFirstRegistryMachineId(parentMachineRegistry)) 2658 2450 { 2659 2451 /* since this medium has been just created it isn't associated yet */ 2660 2452 diff->m->llRegistryIDs.push_back(parentMachineRegistry); 2661 2453 alock.release(); 2662 diff-> markRegistriesModified();2454 diff->i_markRegistriesModified(); 2663 2455 alock.acquire(); 2664 2456 } … … 2670 2462 ULONG mediumVariantFlags = 0; 2671 2463 2672 if (aVariant )2673 { 2674 com::SafeArray<MediumVariant_T> variants( ComSafeArrayInArg(aVariant));2464 if (aVariant.size()) 2465 { 2466 com::SafeArray<MediumVariant_T> variants(aVariant); 2675 2467 for (size_t i = 0; i < variants.size(); i++) 2676 2468 mediumVariantFlags |= variants[i]; 2677 2469 } 2678 2470 2679 rc = createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList,2680 &pProgress, false /* aWait */);2471 rc = i_createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList, 2472 &pProgress, false /* aWait */); 2681 2473 if (FAILED(rc)) 2682 2474 delete pMediumLockList; 2683 2475 else 2684 pProgress.queryInterfaceTo(aProgress );2476 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2685 2477 2686 2478 return rc; 2687 2479 } 2688 2480 2689 STDMETHODIMP Medium::MergeTo(IMedium *aTarget, IProgress **aProgress) 2690 { 2691 CheckComArgNotNull(aTarget); 2692 CheckComArgOutPointerValid(aProgress); 2693 ComAssertRet(aTarget != this, E_INVALIDARG); 2694 2695 AutoCaller autoCaller(this); 2696 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2697 2698 ComObjPtr<Medium> pTarget = static_cast<Medium*>(aTarget); 2481 HRESULT Medium::mergeTo(const ComPtr<IMedium> &aTarget, 2482 ComPtr<IProgress> &aProgress) 2483 { 2484 2485 IMedium *aT = aTarget; 2486 2487 ComAssertRet(aT != this, E_INVALIDARG); 2488 2489 ComObjPtr<Medium> pTarget = static_cast<Medium*>(aT); 2699 2490 2700 2491 bool fMergeForward = false; … … 2705 2496 HRESULT rc = S_OK; 2706 2497 2707 rc = prepareMergeTo(pTarget, NULL, NULL, true, fMergeForward,2708 pParentForTarget, pChildrenToReparent, pMediumLockList);2498 rc = i_prepareMergeTo(pTarget, NULL, NULL, true, fMergeForward, 2499 pParentForTarget, pChildrenToReparent, pMediumLockList); 2709 2500 if (FAILED(rc)) return rc; 2710 2501 2711 2502 ComObjPtr<Progress> pProgress; 2712 2503 2713 rc = mergeTo(pTarget, fMergeForward, pParentForTarget, pChildrenToReparent,2714 pMediumLockList, &pProgress, false /* aWait */);2504 rc = i_mergeTo(pTarget, fMergeForward, pParentForTarget, pChildrenToReparent, 2505 pMediumLockList, &pProgress, false /* aWait */); 2715 2506 if (FAILED(rc)) 2716 cancelMergeTo(pChildrenToReparent, pMediumLockList);2507 i_cancelMergeTo(pChildrenToReparent, pMediumLockList); 2717 2508 else 2718 pProgress.queryInterfaceTo(aProgress );2509 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2719 2510 2720 2511 return rc; 2721 2512 } 2722 2513 2723 STDMETHODIMP Medium::CloneToBase(IMedium *aTarget,2724 ComSafeArrayIn(MediumVariant_T, aVariant),2725 IProgress **aProgress)2514 HRESULT Medium::cloneToBase(const ComPtr<IMedium> &aTarget, 2515 const std::vector<MediumVariant_T> &aVariant, 2516 ComPtr<IProgress> &aProgress) 2726 2517 { 2727 2518 int rc = S_OK; 2728 CheckComArgNotNull(aTarget); 2729 CheckComArgOutPointerValid(aProgress); 2730 CheckComArgSafeArrayNotNull(aVariant); 2731 2732 com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant)); 2733 2734 rc = CloneTo(aTarget, ComSafeArrayAsInParam(variants), NULL, aProgress); 2519 2520 rc = cloneTo(aTarget, aVariant, NULL, aProgress); 2735 2521 return rc; 2736 2522 } 2737 2523 2738 STDMETHODIMP Medium::CloneTo(IMedium *aTarget, 2739 ComSafeArrayIn(MediumVariant_T, aVariant), 2740 IMedium *aParent, 2741 IProgress **aProgress) 2742 { 2743 CheckComArgNotNull(aTarget); 2744 CheckComArgOutPointerValid(aProgress); 2745 CheckComArgSafeArrayNotNull(aVariant); 2746 2524 HRESULT Medium::cloneTo(const ComPtr<IMedium> &aTarget, 2525 const std::vector<MediumVariant_T> &aVariant, 2526 const ComPtr<IMedium> &aParent, 2527 ComPtr<IProgress> &aProgress) 2528 { 2747 2529 ComAssertRet(aTarget != this, E_INVALIDARG); 2748 2530 2749 AutoCaller autoCaller(this); 2750 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2751 2752 ComObjPtr<Medium> pTarget = static_cast<Medium*>(aTarget); 2531 IMedium *aT = aTarget; 2532 ComObjPtr<Medium> pTarget = static_cast<Medium*>(aT); 2753 2533 ComObjPtr<Medium> pParent; 2754 2534 if (aParent) 2755 pParent = static_cast<Medium*>(aParent); 2535 { 2536 IMedium *aP = aParent; 2537 pParent = static_cast<Medium*>(aP); 2538 } 2756 2539 2757 2540 HRESULT rc = S_OK; … … 2776 2559 if ( pTarget->m->state != MediumState_NotCreated 2777 2560 && pTarget->m->state != MediumState_Created) 2778 throw pTarget-> setStateError();2561 throw pTarget->i_setStateError(); 2779 2562 2780 2563 /* Build the source lock list. */ 2781 2564 MediumLockList *pSourceMediumLockList(new MediumLockList()); 2782 2565 alock.release(); 2783 rc = createMediumLockList(true /* fFailIfInaccessible */,2784 false /* fMediumLockWrite */,2785 NULL,2786 *pSourceMediumLockList);2566 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 2567 false /* fMediumLockWrite */, 2568 NULL, 2569 *pSourceMediumLockList); 2787 2570 alock.acquire(); 2788 2571 if (FAILED(rc)) … … 2795 2578 MediumLockList *pTargetMediumLockList(new MediumLockList()); 2796 2579 alock.release(); 2797 rc = pTarget-> createMediumLockList(true /* fFailIfInaccessible */,2798 true /* fMediumLockWrite */,2799 pParent,2800 *pTargetMediumLockList);2580 rc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */, 2581 true /* fMediumLockWrite */, 2582 pParent, 2583 *pTargetMediumLockList); 2801 2584 alock.acquire(); 2802 2585 if (FAILED(rc)) … … 2816 2599 throw setError(rc, 2817 2600 tr("Failed to lock source media '%s'"), 2818 getLocationFull().c_str());2601 i_getLocationFull().c_str()); 2819 2602 } 2820 2603 alock.release(); … … 2827 2610 throw setError(rc, 2828 2611 tr("Failed to lock target media '%s'"), 2829 pTarget-> getLocationFull().c_str());2612 pTarget->i_getLocationFull().c_str()); 2830 2613 } 2831 2614 … … 2844 2627 ULONG mediumVariantFlags = 0; 2845 2628 2846 if (aVariant )2847 { 2848 com::SafeArray<MediumVariant_T> variants( ComSafeArrayInArg(aVariant));2629 if (aVariant.size()) 2630 { 2631 com::SafeArray<MediumVariant_T> variants(aVariant); 2849 2632 for (size_t i = 0; i < variants.size(); i++) 2850 2633 mediumVariantFlags |= variants[i]; … … 2868 2651 if (SUCCEEDED(rc)) 2869 2652 { 2870 rc = startThread(pTask);2653 rc = i_startThread(pTask); 2871 2654 2872 2655 if (SUCCEEDED(rc)) 2873 pProgress.queryInterfaceTo(aProgress );2656 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2874 2657 } 2875 2658 else if (pTask != NULL) … … 2879 2662 } 2880 2663 2881 STDMETHODIMP Medium::SetLocation(IN_BSTR aLocation, IProgress **aProgress) 2882 { 2883 CheckComArgStrNotEmptyOrNull(aLocation); 2884 CheckComArgOutPointerValid(aProgress); 2885 2886 AutoCaller autoCaller(this); 2887 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2888 2664 HRESULT Medium::setLocation(const com::Utf8Str &aLocation, ComPtr<IProgress> &aProgress) 2665 { 2889 2666 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2890 2667 … … 2898 2675 /// this medium), this will also require to add the mRegistered flag to data 2899 2676 2900 *aProgress = NULL;2901 2677 ReturnComNotImplemented(); 2902 2678 } 2903 2679 2904 STDMETHODIMP Medium::Compact(IProgress **aProgress) 2905 { 2906 CheckComArgOutPointerValid(aProgress); 2907 2908 AutoCaller autoCaller(this); 2909 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2910 2680 HRESULT Medium::compact(ComPtr<IProgress> &aProgress) 2681 { 2911 2682 HRESULT rc = S_OK; 2912 2683 ComObjPtr<Progress> pProgress; … … 2920 2691 MediumLockList *pMediumLockList(new MediumLockList()); 2921 2692 alock.release(); 2922 rc = createMediumLockList(true /* fFailIfInaccessible */ ,2923 true /* fMediumLockWrite */,2924 NULL,2925 *pMediumLockList);2693 rc = i_createMediumLockList(true /* fFailIfInaccessible */ , 2694 true /* fMediumLockWrite */, 2695 NULL, 2696 *pMediumLockList); 2926 2697 alock.acquire(); 2927 2698 if (FAILED(rc)) … … 2939 2710 throw setError(rc, 2940 2711 tr("Failed to lock media when compacting '%s'"), 2941 getLocationFull().c_str());2712 i_getLocationFull().c_str()); 2942 2713 } 2943 2714 … … 2964 2735 if (SUCCEEDED(rc)) 2965 2736 { 2966 rc = startThread(pTask);2737 rc = i_startThread(pTask); 2967 2738 2968 2739 if (SUCCEEDED(rc)) 2969 pProgress.queryInterfaceTo(aProgress );2740 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2970 2741 } 2971 2742 else if (pTask != NULL) … … 2975 2746 } 2976 2747 2977 STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress) 2978 { 2979 CheckComArgOutPointerValid(aProgress); 2980 2981 AutoCaller autoCaller(this); 2982 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2983 2748 HRESULT Medium::resize(LONG64 aLogicalSize, 2749 ComPtr<IProgress> &aProgress) 2750 { 2984 2751 HRESULT rc = S_OK; 2985 2752 ComObjPtr<Progress> pProgress; … … 2993 2760 MediumLockList *pMediumLockList(new MediumLockList()); 2994 2761 alock.release(); 2995 rc = createMediumLockList(true /* fFailIfInaccessible */ ,2996 true /* fMediumLockWrite */,2997 NULL,2998 *pMediumLockList);2762 rc = i_createMediumLockList(true /* fFailIfInaccessible */ , 2763 true /* fMediumLockWrite */, 2764 NULL, 2765 *pMediumLockList); 2999 2766 alock.acquire(); 3000 2767 if (FAILED(rc)) … … 3012 2779 throw setError(rc, 3013 2780 tr("Failed to lock media when compacting '%s'"), 3014 getLocationFull().c_str());2781 i_getLocationFull().c_str()); 3015 2782 } 3016 2783 … … 3037 2804 if (SUCCEEDED(rc)) 3038 2805 { 3039 rc = startThread(pTask);2806 rc = i_startThread(pTask); 3040 2807 3041 2808 if (SUCCEEDED(rc)) 3042 pProgress.queryInterfaceTo(aProgress );2809 pProgress.queryInterfaceTo(aProgress.asOutParam()); 3043 2810 } 3044 2811 else if (pTask != NULL) … … 3048 2815 } 3049 2816 3050 STDMETHODIMP Medium::Reset(IProgress **aProgress) 3051 { 3052 CheckComArgOutPointerValid(aProgress); 3053 3054 AutoCaller autoCaller(this); 3055 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3056 2817 HRESULT Medium::reset(ComPtr<IProgress> &aProgress) 2818 { 3057 2819 HRESULT rc = S_OK; 3058 2820 ComObjPtr<Progress> pProgress; … … 3073 2835 m->strLocationFull.c_str()); 3074 2836 3075 rc = canClose();2837 rc = i_canClose(); 3076 2838 if (FAILED(rc)) 3077 2839 throw rc; … … 3080 2842 MediumLockList *pMediumLockList(new MediumLockList()); 3081 2843 multilock.release(); 3082 rc = createMediumLockList(true /* fFailIfInaccessible */,3083 true /* fMediumLockWrite */,3084 NULL,3085 *pMediumLockList);2844 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 2845 true /* fMediumLockWrite */, 2846 NULL, 2847 *pMediumLockList); 3086 2848 multilock.acquire(); 3087 2849 if (FAILED(rc)) … … 3099 2861 throw setError(rc, 3100 2862 tr("Failed to lock media when resetting '%s'"), 3101 getLocationFull().c_str());2863 i_getLocationFull().c_str()); 3102 2864 } 3103 2865 … … 3121 2883 if (SUCCEEDED(rc)) 3122 2884 { 3123 rc = startThread(pTask);2885 rc = i_startThread(pTask); 3124 2886 3125 2887 if (SUCCEEDED(rc)) 3126 pProgress.queryInterfaceTo(aProgress );2888 pProgress.queryInterfaceTo(aProgress.asOutParam()); 3127 2889 } 3128 2890 else if (pTask != NULL) … … 3144 2906 * @return 3145 2907 */ 3146 const ComObjPtr<Medium>& Medium:: getParent() const2908 const ComObjPtr<Medium>& Medium::i_getParent() const 3147 2909 { 3148 2910 return m->pParent; … … 3153 2915 * @return 3154 2916 */ 3155 const MediaList& Medium:: getChildren() const2917 const MediaList& Medium::i_getChildren() const 3156 2918 { 3157 2919 return m->llChildren; … … 3162 2924 * @return 3163 2925 */ 3164 const Guid& Medium:: getId() const2926 const Guid& Medium::i_getId() const 3165 2927 { 3166 2928 return m->id; … … 3171 2933 * @return 3172 2934 */ 3173 MediumState_T Medium:: getState() const2935 MediumState_T Medium::i_getState() const 3174 2936 { 3175 2937 return m->state; … … 3180 2942 * @return 3181 2943 */ 3182 MediumVariant_T Medium:: getVariant() const2944 MediumVariant_T Medium::i_getVariant() const 3183 2945 { 3184 2946 return m->variant; … … 3189 2951 * @return 3190 2952 */ 3191 bool Medium::i sHostDrive() const2953 bool Medium::i_isHostDrive() const 3192 2954 { 3193 2955 return m->hostDrive; … … 3198 2960 * @return 3199 2961 */ 3200 const Utf8Str& Medium:: getLocationFull() const2962 const Utf8Str& Medium::i_getLocationFull() const 3201 2963 { 3202 2964 return m->strLocationFull; … … 3207 2969 * @return 3208 2970 */ 3209 const Utf8Str& Medium:: getFormat() const2971 const Utf8Str& Medium::i_getFormat() const 3210 2972 { 3211 2973 return m->strFormat; … … 3216 2978 * @return 3217 2979 */ 3218 const ComObjPtr<MediumFormat>& Medium:: getMediumFormat() const2980 const ComObjPtr<MediumFormat>& Medium::i_getMediumFormat() const 3219 2981 { 3220 2982 return m->formatObj; … … 3226 2988 * @return 3227 2989 */ 3228 bool Medium::i sMediumFormatFile() const2990 bool Medium::i_isMediumFormatFile() const 3229 2991 { 3230 2992 if ( m->formatObj … … 3239 3001 * @return 3240 3002 */ 3241 uint64_t Medium:: getSize() const3003 uint64_t Medium::i_getSize() const 3242 3004 { 3243 3005 return m->size; … … 3248 3010 * @return 3249 3011 */ 3250 DeviceType_T Medium:: getDeviceType() const3012 DeviceType_T Medium::i_getDeviceType() const 3251 3013 { 3252 3014 return m->devType; … … 3257 3019 * @return 3258 3020 */ 3259 MediumType_T Medium:: getType() const3021 MediumType_T Medium::i_getType() const 3260 3022 { 3261 3023 return m->type; … … 3267 3029 * @note Must be called from under this object's read or write lock. 3268 3030 */ 3269 Utf8Str Medium:: getName()3031 Utf8Str Medium::i_getName() 3270 3032 { 3271 3033 Utf8Str name = RTPathFilename(m->strLocationFull.c_str()); … … 3290 3052 * @return true if the registry was added; false if the given id was already on the list. 3291 3053 */ 3292 bool Medium:: addRegistry(const Guid& id, bool fRecurse)3054 bool Medium::i_addRegistry(const Guid& id, bool fRecurse) 3293 3055 { 3294 3056 AutoCaller autoCaller(this); … … 3333 3095 { 3334 3096 Medium *pChild = *it; 3335 fAdd |= pChild-> addRegistry(id, true);3097 fAdd |= pChild->i_addRegistry(id, true); 3336 3098 } 3337 3099 } … … 3350 3112 * @return 3351 3113 */ 3352 bool Medium:: removeRegistry(const Guid& id, bool fRecurse)3114 bool Medium::i_removeRegistry(const Guid& id, bool fRecurse) 3353 3115 { 3354 3116 AutoCaller autoCaller(this); … … 3382 3144 { 3383 3145 Medium *pChild = *it; 3384 fRemove |= pChild-> removeRegistry(id, true);3146 fRemove |= pChild->i_removeRegistry(id, true); 3385 3147 } 3386 3148 } … … 3397 3159 * @return 3398 3160 */ 3399 bool Medium::i sInRegistry(const Guid& id)3161 bool Medium::i_isInRegistry(const Guid& id) 3400 3162 { 3401 3163 for (GuidList::const_iterator it = m->llRegistryIDs.begin(); … … 3435 3197 * @return true if uuid was set. 3436 3198 */ 3437 bool Medium:: getFirstRegistryMachineId(Guid &uuid) const3199 bool Medium::i_getFirstRegistryMachineId(Guid &uuid) const 3438 3200 { 3439 3201 if (m->llRegistryIDs.size()) … … 3448 3210 * Marks all the registries in which this medium is registered as modified. 3449 3211 */ 3450 void Medium:: markRegistriesModified()3212 void Medium::i_markRegistriesModified() 3451 3213 { 3452 3214 AutoCaller autoCaller(this); … … 3479 3241 * @param aSnapshotId Snapshot ID; when non-empty, adds a snapshot attachment. 3480 3242 */ 3481 HRESULT Medium:: addBackReference(const Guid &aMachineId,3482 const Guid &aSnapshotId /*= Guid::Empty*/)3243 HRESULT Medium::i_addBackReference(const Guid &aMachineId, 3244 const Guid &aSnapshotId /*= Guid::Empty*/) 3483 3245 { 3484 3246 AssertReturn(aMachineId.isValid(), E_FAIL); … … 3500 3262 3501 3263 default: 3502 return setStateError();3264 return i_setStateError(); 3503 3265 } 3504 3266 … … 3551 3313 { 3552 3314 #ifdef DEBUG 3553 dumpBackRefs();3315 i_dumpBackRefs(); 3554 3316 #endif 3555 3317 return setError(VBOX_E_OBJECT_IN_USE, … … 3578 3340 * attachment. 3579 3341 */ 3580 HRESULT Medium:: removeBackReference(const Guid &aMachineId,3581 const Guid &aSnapshotId /*= Guid::Empty*/)3342 HRESULT Medium::i_removeBackReference(const Guid &aMachineId, 3343 const Guid &aSnapshotId /*= Guid::Empty*/) 3582 3344 { 3583 3345 AssertReturn(aMachineId.isValid(), E_FAIL); … … 3620 3382 * @return 3621 3383 */ 3622 const Guid* Medium:: getFirstMachineBackrefId() const3384 const Guid* Medium::i_getFirstMachineBackrefId() const 3623 3385 { 3624 3386 if (!m->backRefs.size()) … … 3636 3398 * @return 3637 3399 */ 3638 const Guid* Medium:: getAnyMachineBackref() const3400 const Guid* Medium::i_getAnyMachineBackref() const 3639 3401 { 3640 3402 if (m->backRefs.size()) … … 3648 3410 // recurse for this child 3649 3411 const Guid* puuid; 3650 if ((puuid = pChild-> getAnyMachineBackref()))3412 if ((puuid = pChild->i_getAnyMachineBackref())) 3651 3413 return puuid; 3652 3414 } … … 3655 3417 } 3656 3418 3657 const Guid* Medium:: getFirstMachineBackrefSnapshotId() const3419 const Guid* Medium::i_getFirstMachineBackrefSnapshotId() const 3658 3420 { 3659 3421 if (!m->backRefs.size()) … … 3667 3429 } 3668 3430 3669 size_t Medium:: getMachineBackRefCount() const3431 size_t Medium::i_getMachineBackRefCount() const 3670 3432 { 3671 3433 return m->backRefs.size(); … … 3677 3439 * machine backreferences to the debug log. 3678 3440 */ 3679 void Medium:: dumpBackRefs()3441 void Medium::i_dumpBackRefs() 3680 3442 { 3681 3443 AutoCaller autoCaller(this); … … 3711 3473 * @note Locks this object for writing. 3712 3474 */ 3713 HRESULT Medium:: updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath)3475 HRESULT Medium::i_updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath) 3714 3476 { 3715 3477 AssertReturn(!strOldPath.isEmpty(), E_FAIL); … … 3752 3514 * @note Locks medium tree for reading. 3753 3515 */ 3754 ComObjPtr<Medium> Medium:: getBase(uint32_t *aLevel /*= NULL*/)3516 ComObjPtr<Medium> Medium::i_getBase(uint32_t *aLevel /*= NULL*/) 3755 3517 { 3756 3518 ComObjPtr<Medium> pBase; … … 3794 3556 * @note Locks this object and medium tree for reading. 3795 3557 */ 3796 bool Medium::i sReadOnly()3558 bool Medium::i_isReadOnly() 3797 3559 { 3798 3560 AutoCaller autoCaller(this); … … 3808 3570 case MediumType_Normal: 3809 3571 { 3810 if ( getChildren().size() != 0)3572 if (i_getChildren().size() != 0) 3811 3573 return true; 3812 3574 … … 3839 3601 * @return 3840 3602 */ 3841 void Medium:: updateId(const Guid &id)3603 void Medium::i_updateId(const Guid &id) 3842 3604 { 3843 3605 unconst(m->id) = id; … … 3853 3615 * @note Locks this object, medium tree and children for reading. 3854 3616 */ 3855 HRESULT Medium:: saveSettings(settings::Medium &data,3856 const Utf8Str &strHardDiskFolder)3617 HRESULT Medium::i_saveSettings(settings::Medium &data, 3618 const Utf8Str &strHardDiskFolder) 3857 3619 { 3858 3620 AutoCaller autoCaller(this); … … 3923 3685 3924 3686 /* save all children */ 3925 for (MediaList::const_iterator it = getChildren().begin();3926 it != getChildren().end();3687 for (MediaList::const_iterator it = i_getChildren().begin(); 3688 it != i_getChildren().end(); 3927 3689 ++it) 3928 3690 { 3929 3691 settings::Medium med; 3930 HRESULT rc = (*it)-> saveSettings(med, strHardDiskFolder);3692 HRESULT rc = (*it)->i_saveSettings(med, strHardDiskFolder); 3931 3693 AssertComRCReturnRC(rc); 3932 3694 data.llChildren.push_back(med); … … 3948 3710 * @param mediumLockList Where to store the resulting list. 3949 3711 */ 3950 HRESULT Medium:: createMediumLockList(bool fFailIfInaccessible,3951 bool fMediumLockWrite,3952 Medium *pToBeParent,3953 MediumLockList &mediumLockList)3712 HRESULT Medium::i_createMediumLockList(bool fFailIfInaccessible, 3713 bool fMediumLockWrite, 3714 Medium *pToBeParent, 3715 MediumLockList &mediumLockList) 3954 3716 { 3955 3717 Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread()); … … 3965 3727 { 3966 3728 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 3967 ComAssertRet( getParent().isNull(), E_FAIL);3968 ComAssertRet( getChildren().size() == 0, E_FAIL);3729 ComAssertRet(i_getParent().isNull(), E_FAIL); 3730 ComAssertRet(i_getChildren().size() == 0, E_FAIL); 3969 3731 } 3970 3732 … … 3980 3742 * with getting the medium state. Lock lists are not created for 3981 3743 * fun, and thus getting the medium status is no luxury. */ 3982 MediumState_T mediumState = pMedium-> getState();3744 MediumState_T mediumState = pMedium->i_getState(); 3983 3745 if (mediumState == MediumState_Inaccessible) 3984 3746 { 3985 3747 alock.release(); 3986 rc = pMedium-> queryInfo(false /* fSetImageId */, false /* fSetParentId */);3748 rc = pMedium->i_queryInfo(false /* fSetImageId */, false /* fSetParentId */); 3987 3749 alock.acquire(); 3988 3750 if (FAILED(rc)) return rc; 3989 3751 3990 mediumState = pMedium-> getState();3752 mediumState = pMedium->i_getState(); 3991 3753 if (mediumState == MediumState_Inaccessible) 3992 3754 { … … 4018 3780 mediumLockList.Prepend(pMedium, false); 4019 3781 4020 pMedium = pMedium-> getParent();3782 pMedium = pMedium->i_getParent(); 4021 3783 if (pMedium.isNull() && pToBeParent) 4022 3784 { … … 4058 3820 * @note Locks this object and @a aTarget for writing. 4059 3821 */ 4060 HRESULT Medium:: createDiffStorage(ComObjPtr<Medium> &aTarget,4061 MediumVariant_T aVariant,4062 MediumLockList *aMediumLockList,4063 ComObjPtr<Progress> *aProgress,4064 bool aWait)3822 HRESULT Medium::i_createDiffStorage(ComObjPtr<Medium> &aTarget, 3823 MediumVariant_T aVariant, 3824 MediumLockList *aMediumLockList, 3825 ComObjPtr<Progress> *aProgress, 3826 bool aWait) 4065 3827 { 4066 3828 AssertReturn(!aTarget.isNull(), E_FAIL); … … 4088 3850 4089 3851 if (aTarget->m->state != MediumState_NotCreated) 4090 throw aTarget-> setStateError();3852 throw aTarget->i_setStateError(); 4091 3853 4092 3854 /* Check that the medium is not attached to the current state of … … 4153 3915 { 4154 3916 if (aWait) 4155 rc = runNow(pTask);3917 rc = i_runNow(pTask); 4156 3918 else 4157 rc = startThread(pTask);3919 rc = i_startThread(pTask); 4158 3920 4159 3921 if (SUCCEEDED(rc) && aProgress != NULL) … … 4169 3931 * Returns a preferred format for differencing media. 4170 3932 */ 4171 Utf8Str Medium:: getPreferredDiffFormat()3933 Utf8Str Medium::i_getPreferredDiffFormat() 4172 3934 { 4173 3935 AutoCaller autoCaller(this); … … 4199 3961 * @return 4200 3962 */ 4201 HRESULT Medium:: close(AutoCaller &autoCaller)3963 HRESULT Medium::i_close(AutoCaller &autoCaller) 4202 3964 { 4203 3965 // we're accessing parent/child and backrefs, so lock the tree first, then ourselves … … 4206 3968 COMMA_LOCKVAL_SRC_POS); 4207 3969 4208 LogFlowFunc(("ENTER for %s\n", getLocationFull().c_str()));3970 LogFlowFunc(("ENTER for %s\n", i_getLocationFull().c_str())); 4209 3971 4210 3972 bool wasCreated = true; … … 4219 3981 break; 4220 3982 default: 4221 return setStateError();3983 return i_setStateError(); 4222 3984 } 4223 3985 … … 4228 3990 4229 3991 // perform extra media-dependent close checks 4230 HRESULT rc = canClose();3992 HRESULT rc = i_canClose(); 4231 3993 if (FAILED(rc)) return rc; 4232 3994 … … 4236 3998 // uninitialization (to keep the media registry consistent on 4237 3999 // failure to do so) 4238 rc = unregisterWithVirtualBox();4000 rc = i_unregisterWithVirtualBox(); 4239 4001 if (FAILED(rc)) return rc; 4240 4002 4241 4003 multilock.release(); 4242 markRegistriesModified();4004 i_markRegistriesModified(); 4243 4005 // Release the AutoCalleri now, as otherwise uninit() will simply hang. 4244 4006 // Needs to be done before saving the registry, as otherwise there … … 4288 4050 * writing. 4289 4051 */ 4290 HRESULT Medium:: deleteStorage(ComObjPtr<Progress> *aProgress,4052 HRESULT Medium::i_deleteStorage(ComObjPtr<Progress> *aProgress, 4291 4053 bool aWait) 4292 4054 { … … 4306 4068 this->lockHandle() 4307 4069 COMMA_LOCKVAL_SRC_POS); 4308 LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, getLocationFull().c_str() ));4070 LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, i_getLocationFull().c_str() )); 4309 4071 4310 4072 if ( !(m->formatObj->i_getCapabilities() & ( MediumFormatCapabilities_CreateDynamic … … 4329 4091 break; 4330 4092 default: 4331 throw setStateError();4093 throw i_setStateError(); 4332 4094 } 4333 4095 … … 4345 4107 } 4346 4108 #ifdef DEBUG 4347 dumpBackRefs();4109 i_dumpBackRefs(); 4348 4110 #endif 4349 4111 throw setError(VBOX_E_OBJECT_IN_USE, … … 4354 4116 } 4355 4117 4356 rc = canClose();4118 rc = i_canClose(); 4357 4119 if (FAILED(rc)) 4358 4120 throw rc; … … 4361 4123 if (m->state != MediumState_Deleting) 4362 4124 { 4363 rc = markForDeletion();4125 rc = i_markForDeletion(); 4364 4126 if (FAILED(rc)) 4365 4127 throw rc; … … 4369 4131 MediumLockList *pMediumLockList(new MediumLockList()); 4370 4132 multilock.release(); 4371 rc = createMediumLockList(true /* fFailIfInaccessible */,4372 true /* fMediumLockWrite */,4373 NULL,4374 *pMediumLockList);4133 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 4134 true /* fMediumLockWrite */, 4135 NULL, 4136 *pMediumLockList); 4375 4137 multilock.acquire(); 4376 4138 if (FAILED(rc)) … … 4388 4150 throw setError(rc, 4389 4151 tr("Failed to lock media when deleting '%s'"), 4390 getLocationFull().c_str());4152 i_getLocationFull().c_str()); 4391 4153 } 4392 4154 … … 4395 4157 * which would have been broken if unregisterWithVirtualBox() failed 4396 4158 * after we successfully deleted the storage) */ 4397 rc = unregisterWithVirtualBox();4159 rc = i_unregisterWithVirtualBox(); 4398 4160 if (FAILED(rc)) 4399 4161 throw rc; 4400 4162 // no longer need lock 4401 4163 multilock.release(); 4402 markRegistriesModified();4164 i_markRegistriesModified(); 4403 4165 4404 4166 if (aProgress != NULL) … … 4432 4194 { 4433 4195 if (aWait) 4434 rc = runNow(pTask);4196 rc = i_runNow(pTask); 4435 4197 else 4436 rc = startThread(pTask);4198 rc = i_startThread(pTask); 4437 4199 4438 4200 if (SUCCEEDED(rc) && aProgress != NULL) … … 4452 4214 * for deletion when the error was thrown above. */ 4453 4215 ErrorInfoKeeper eik; 4454 unmarkForDeletion();4216 i_unmarkForDeletion(); 4455 4217 } 4456 4218 … … 4463 4225 * @note Caller must hold the write lock on this medium! 4464 4226 */ 4465 HRESULT Medium:: markForDeletion()4227 HRESULT Medium::i_markForDeletion() 4466 4228 { 4467 4229 ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL); … … 4474 4236 return S_OK; 4475 4237 default: 4476 return setStateError();4238 return i_setStateError(); 4477 4239 } 4478 4240 } … … 4483 4245 * @note Caller must hold the write lock on this medium! 4484 4246 */ 4485 HRESULT Medium:: unmarkForDeletion()4247 HRESULT Medium::i_unmarkForDeletion() 4486 4248 { 4487 4249 ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL); … … 4492 4254 return S_OK; 4493 4255 default: 4494 return setStateError();4256 return i_setStateError(); 4495 4257 } 4496 4258 } … … 4501 4263 * @note Caller must hold the write lock on this medium! 4502 4264 */ 4503 HRESULT Medium:: markLockedForDeletion()4265 HRESULT Medium::i_markLockedForDeletion() 4504 4266 { 4505 4267 ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL); … … 4512 4274 } 4513 4275 else 4514 return setStateError();4276 return i_setStateError(); 4515 4277 } 4516 4278 … … 4520 4282 * @note Caller must hold the write lock on this medium! 4521 4283 */ 4522 HRESULT Medium:: unmarkLockedForDeletion()4284 HRESULT Medium::i_unmarkLockedForDeletion() 4523 4285 { 4524 4286 ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL); … … 4531 4293 } 4532 4294 else 4533 return setStateError();4295 return i_setStateError(); 4534 4296 } 4535 4297 … … 4549 4311 * @param fMergeForward Resulting preferred merge direction (out). 4550 4312 */ 4551 HRESULT Medium:: queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,4552 bool &fMergeForward)4313 HRESULT Medium::i_queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther, 4314 bool &fMergeForward) 4553 4315 { 4554 4316 AssertReturn(pOther != NULL, E_FAIL); … … 4570 4332 4571 4333 /* more sanity checking and figuring out the current merge direction */ 4572 ComObjPtr<Medium> pMedium = getParent();4334 ComObjPtr<Medium> pMedium = i_getParent(); 4573 4335 while (!pMedium.isNull() && pMedium != pOther) 4574 pMedium = pMedium-> getParent();4336 pMedium = pMedium->i_getParent(); 4575 4337 if (pMedium == pOther) 4576 4338 fThisParent = false; 4577 4339 else 4578 4340 { 4579 pMedium = pOther-> getParent();4341 pMedium = pOther->i_getParent(); 4580 4342 while (!pMedium.isNull() && pMedium != this) 4581 pMedium = pMedium-> getParent();4343 pMedium = pMedium->i_getParent(); 4582 4344 if (pMedium == this) 4583 4345 fThisParent = true; … … 4587 4349 { 4588 4350 AutoReadLock alock(pOther COMMA_LOCKVAL_SRC_POS); 4589 tgtLoc = pOther-> getLocationFull();4351 tgtLoc = pOther->i_getLocationFull(); 4590 4352 } 4591 4353 … … 4609 4371 uint64_t cbMediumOther = 0; 4610 4372 4611 if (i sMediumFormatFile() && pOther->isMediumFormatFile())4612 { 4613 vrc = RTFileQuerySize(this-> getLocationFull().c_str(), &cbMediumThis);4373 if (i_isMediumFormatFile() && pOther->i_isMediumFormatFile()) 4374 { 4375 vrc = RTFileQuerySize(this->i_getLocationFull().c_str(), &cbMediumThis); 4614 4376 if (RT_SUCCESS(vrc)) 4615 4377 { 4616 vrc = RTFileQuerySize(pOther-> getLocationFull().c_str(),4378 vrc = RTFileQuerySize(pOther->i_getLocationFull().c_str(), 4617 4379 &cbMediumOther); 4618 4380 } … … 4668 4430 * intermediate media for writing. 4669 4431 */ 4670 HRESULT Medium:: prepareMergeTo(const ComObjPtr<Medium> &pTarget,4671 const Guid *aMachineId,4672 const Guid *aSnapshotId,4673 bool fLockMedia,4674 bool &fMergeForward,4675 ComObjPtr<Medium> &pParentForTarget,4676 MediumLockList * &aChildrenToReparent,4677 MediumLockList * &aMediumLockList)4432 HRESULT Medium::i_prepareMergeTo(const ComObjPtr<Medium> &pTarget, 4433 const Guid *aMachineId, 4434 const Guid *aSnapshotId, 4435 bool fLockMedia, 4436 bool &fMergeForward, 4437 ComObjPtr<Medium> &pParentForTarget, 4438 MediumLockList * &aChildrenToReparent, 4439 MediumLockList * &aMediumLockList) 4678 4440 { 4679 4441 AssertReturn(pTarget != NULL, E_FAIL); … … 4700 4462 4701 4463 /* more sanity checking and figuring out the merge direction */ 4702 ComObjPtr<Medium> pMedium = getParent();4464 ComObjPtr<Medium> pMedium = i_getParent(); 4703 4465 while (!pMedium.isNull() && pMedium != pTarget) 4704 pMedium = pMedium-> getParent();4466 pMedium = pMedium->i_getParent(); 4705 4467 if (pMedium == pTarget) 4706 4468 fMergeForward = false; 4707 4469 else 4708 4470 { 4709 pMedium = pTarget-> getParent();4471 pMedium = pTarget->i_getParent(); 4710 4472 while (!pMedium.isNull() && pMedium != this) 4711 pMedium = pMedium-> getParent();4473 pMedium = pMedium->i_getParent(); 4712 4474 if (pMedium == this) 4713 4475 fMergeForward = true; … … 4717 4479 { 4718 4480 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS); 4719 tgtLoc = pTarget-> getLocationFull();4481 tgtLoc = pTarget->i_getLocationFull(); 4720 4482 } 4721 4483 … … 4731 4493 treeLock.release(); 4732 4494 if (fMergeForward) 4733 rc = pTarget-> createMediumLockList(true /* fFailIfInaccessible */,4734 true /* fMediumLockWrite */,4735 NULL,4736 *aMediumLockList);4495 rc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */, 4496 true /* fMediumLockWrite */, 4497 NULL, 4498 *aMediumLockList); 4737 4499 else 4738 rc = createMediumLockList(true /* fFailIfInaccessible */,4739 false /* fMediumLockWrite */,4740 NULL,4741 *aMediumLockList);4500 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 4501 false /* fMediumLockWrite */, 4502 NULL, 4503 *aMediumLockList); 4742 4504 treeLock.acquire(); 4743 4505 if (FAILED(rc)) … … 4754 4516 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4755 4517 if (m->state != MediumState_Created) 4756 throw setStateError();4518 throw i_setStateError(); 4757 4519 } 4758 4520 { 4759 4521 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS); 4760 4522 if (pTarget->m->state != MediumState_Created) 4761 throw pTarget-> setStateError();4523 throw pTarget->i_setStateError(); 4762 4524 } 4763 4525 } … … 4767 4529 { 4768 4530 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 4769 if ( getChildren().size() > 1)4531 if (i_getChildren().size() > 1) 4770 4532 { 4771 4533 throw setError(VBOX_E_INVALID_OBJECT_STATE, 4772 4534 tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"), 4773 m->strLocationFull.c_str(), getChildren().size());4535 m->strLocationFull.c_str(), i_getChildren().size()); 4774 4536 } 4775 4537 /* One backreference is only allowed if the machine ID is not empty … … 4780 4542 || m->backRefs.size() != 1 4781 4543 || aMachineId->isZero() 4782 || * getFirstMachineBackrefId() != *aMachineId4544 || *i_getFirstMachineBackrefId() != *aMachineId 4783 4545 || ( (!aSnapshotId || !aSnapshotId->isZero()) 4784 && * getFirstMachineBackrefSnapshotId() != *aSnapshotId)))4546 && *i_getFirstMachineBackrefSnapshotId() != *aSnapshotId))) 4785 4547 throw setError(VBOX_E_OBJECT_IN_USE, 4786 4548 tr("Medium '%s' is attached to %d virtual machines"), … … 4798 4560 { 4799 4561 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS); 4800 if (pTarget-> getChildren().size() > 1)4562 if (pTarget->i_getChildren().size() > 1) 4801 4563 { 4802 4564 throw setError(VBOX_E_OBJECT_IN_USE, 4803 4565 tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"), 4804 4566 pTarget->m->strLocationFull.c_str(), 4805 pTarget-> getChildren().size());4567 pTarget->i_getChildren().size()); 4806 4568 } 4807 4569 if (pTarget->m->type == MediumType_Immutable) … … 4815 4577 } 4816 4578 ComObjPtr<Medium> pLast(fMergeForward ? (Medium *)pTarget : this); 4817 ComObjPtr<Medium> pLastIntermediate = pLast-> getParent();4579 ComObjPtr<Medium> pLastIntermediate = pLast->i_getParent(); 4818 4580 for (pLast = pLastIntermediate; 4819 4581 !pLast.isNull() && pLast != pTarget && pLast != this; 4820 pLast = pLast-> getParent())4582 pLast = pLast->i_getParent()) 4821 4583 { 4822 4584 AutoReadLock alock(pLast COMMA_LOCKVAL_SRC_POS); 4823 if (pLast-> getChildren().size() > 1)4585 if (pLast->i_getChildren().size() > 1) 4824 4586 { 4825 4587 throw setError(VBOX_E_OBJECT_IN_USE, 4826 4588 tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"), 4827 4589 pLast->m->strLocationFull.c_str(), 4828 pLast-> getChildren().size());4590 pLast->i_getChildren().size()); 4829 4591 } 4830 4592 if (pLast->m->backRefs.size() != 0) … … 4842 4604 if (m->state == MediumState_Created) 4843 4605 { 4844 rc = markForDeletion();4606 rc = i_markForDeletion(); 4845 4607 if (FAILED(rc)) 4846 4608 throw rc; … … 4849 4611 { 4850 4612 if (fLockMedia) 4851 throw setStateError();4613 throw i_setStateError(); 4852 4614 else if ( m->state == MediumState_LockedWrite 4853 4615 || m->state == MediumState_LockedRead) … … 4856 4618 * others to have done so. */ 4857 4619 if (m->preLockState == MediumState_Created) 4858 markLockedForDeletion();4620 i_markLockedForDeletion(); 4859 4621 else if (m->preLockState != MediumState_Deleting) 4860 throw setStateError();4622 throw i_setStateError(); 4861 4623 } 4862 4624 else 4863 throw setStateError();4625 throw i_setStateError(); 4864 4626 } 4865 4627 } … … 4868 4630 { 4869 4631 /* we will need parent to reparent target */ 4870 pParentForTarget = getParent();4632 pParentForTarget = i_getParent(); 4871 4633 } 4872 4634 else … … 4874 4636 /* we will need to reparent children of the source */ 4875 4637 aChildrenToReparent = new MediumLockList(); 4876 for (MediaList::const_iterator it = getChildren().begin();4877 it != getChildren().end();4638 for (MediaList::const_iterator it = i_getChildren().begin(); 4639 it != i_getChildren().end(); 4878 4640 ++it) 4879 4641 { … … 4892 4654 for (pLast = pLastIntermediate; 4893 4655 !pLast.isNull() && pLast != pTarget && pLast != this; 4894 pLast = pLast-> getParent())4656 pLast = pLast->i_getParent()) 4895 4657 { 4896 4658 AutoWriteLock alock(pLast COMMA_LOCKVAL_SRC_POS); 4897 4659 if (pLast->m->state == MediumState_Created) 4898 4660 { 4899 rc = pLast-> markForDeletion();4661 rc = pLast->i_markForDeletion(); 4900 4662 if (FAILED(rc)) 4901 4663 throw rc; 4902 4664 } 4903 4665 else 4904 throw pLast-> setStateError();4666 throw pLast->i_setStateError(); 4905 4667 } 4906 4668 … … 4938 4700 throw setError(rc, 4939 4701 tr("Failed to lock media when merging to '%s'"), 4940 pTarget-> getLocationFull().c_str());4702 pTarget->i_getLocationFull().c_str()); 4941 4703 } 4942 4704 } … … 5037 4799 * for writing. 5038 4800 */ 5039 HRESULT Medium:: mergeTo(const ComObjPtr<Medium> &pTarget,5040 bool fMergeForward,5041 const ComObjPtr<Medium> &pParentForTarget,5042 MediumLockList *aChildrenToReparent,5043 MediumLockList *aMediumLockList,5044 ComObjPtr<Progress> *aProgress,5045 bool aWait)4801 HRESULT Medium::i_mergeTo(const ComObjPtr<Medium> &pTarget, 4802 bool fMergeForward, 4803 const ComObjPtr<Medium> &pParentForTarget, 4804 MediumLockList *aChildrenToReparent, 4805 MediumLockList *aMediumLockList, 4806 ComObjPtr<Progress> *aProgress, 4807 bool aWait) 5046 4808 { 5047 4809 AssertReturn(pTarget != NULL, E_FAIL); … … 5073 4835 { 5074 4836 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS); 5075 tgtName = pTarget-> getName();4837 tgtName = pTarget->i_getName(); 5076 4838 } 5077 4839 … … 5082 4844 static_cast<IMedium*>(this), 5083 4845 BstrFmt(tr("Merging medium '%s' to '%s'"), 5084 getName().c_str(),4846 i_getName().c_str(), 5085 4847 tgtName.c_str()).raw(), 5086 4848 TRUE /* aCancelable */); … … 5105 4867 { 5106 4868 if (aWait) 5107 rc = runNow(pTask);4869 rc = i_runNow(pTask); 5108 4870 else 5109 rc = startThread(pTask);4871 rc = i_startThread(pTask); 5110 4872 5111 4873 if (SUCCEEDED(rc) && aProgress != NULL) … … 5129 4891 * @note Locks the media from the chain for writing. 5130 4892 */ 5131 void Medium:: cancelMergeTo(MediumLockList *aChildrenToReparent,5132 MediumLockList *aMediumLockList)4893 void Medium::i_cancelMergeTo(MediumLockList *aChildrenToReparent, 4894 MediumLockList *aMediumLockList) 5133 4895 { 5134 4896 AutoCaller autoCaller(this); … … 5153 4915 if (pMedium->m->state == MediumState_Deleting) 5154 4916 { 5155 rc = pMedium-> unmarkForDeletion();4917 rc = pMedium->i_unmarkForDeletion(); 5156 4918 AssertComRC(rc); 5157 4919 } … … 5171 4933 * parent. 5172 4934 */ 5173 HRESULT Medium:: fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)4935 HRESULT Medium::i_fixParentUuidOfChildren(MediumLockList *pChildrenToReparent) 5174 4936 { 5175 4937 Assert(!isWriteLockOnCurrentThread()); 5176 4938 Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5177 4939 MediumLockList mediumLockList; 5178 HRESULT rc = createMediumLockList(true /* fFailIfInaccessible */,5179 false /* fMediumLockWrite */,5180 this,5181 mediumLockList);4940 HRESULT rc = i_createMediumLockList(true /* fFailIfInaccessible */, 4941 false /* fMediumLockWrite */, 4942 this, 4943 mediumLockList); 5182 4944 AssertComRCReturnRC(rc); 5183 4945 … … 5185 4947 { 5186 4948 PVBOXHDD hdd; 5187 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);4949 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 5188 4950 ComAssertRCThrow(vrc, E_FAIL); 5189 4951 … … 5243 5005 tr("Could not update medium UUID references to parent '%s' (%s)"), 5244 5006 m->strLocationFull.c_str(), 5245 vdError(aVRC).c_str());5007 i_vdError(aVRC).c_str()); 5246 5008 } 5247 5009 … … 5267 5029 * @note The source format is defined by the Medium instance. 5268 5030 */ 5269 HRESULT Medium:: exportFile(const char *aFilename,5270 const ComObjPtr<MediumFormat> &aFormat,5271 MediumVariant_T aVariant,5272 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,5273 const ComObjPtr<Progress> &aProgress)5031 HRESULT Medium::i_exportFile(const char *aFilename, 5032 const ComObjPtr<MediumFormat> &aFormat, 5033 MediumVariant_T aVariant, 5034 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser, 5035 const ComObjPtr<Progress> &aProgress) 5274 5036 { 5275 5037 AssertPtrReturn(aFilename, E_INVALIDARG); … … 5289 5051 /* Build the source lock list. */ 5290 5052 MediumLockList *pSourceMediumLockList(new MediumLockList()); 5291 rc = createMediumLockList(true /* fFailIfInaccessible */,5292 false /* fMediumLockWrite */,5293 NULL,5294 *pSourceMediumLockList);5053 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 5054 false /* fMediumLockWrite */, 5055 NULL, 5056 *pSourceMediumLockList); 5295 5057 if (FAILED(rc)) 5296 5058 { … … 5305 5067 throw setError(rc, 5306 5068 tr("Failed to lock source media '%s'"), 5307 getLocationFull().c_str());5069 i_getLocationFull().c_str()); 5308 5070 } 5309 5071 … … 5320 5082 5321 5083 if (SUCCEEDED(rc)) 5322 rc = startThread(pTask);5084 rc = i_startThread(pTask); 5323 5085 else if (pTask != NULL) 5324 5086 delete pTask; … … 5342 5104 * @note The destination format is defined by the Medium instance. 5343 5105 */ 5344 HRESULT Medium::i mportFile(const char *aFilename,5345 const ComObjPtr<MediumFormat> &aFormat,5346 MediumVariant_T aVariant,5347 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,5348 const ComObjPtr<Medium> &aParent,5349 const ComObjPtr<Progress> &aProgress)5106 HRESULT Medium::i_importFile(const char *aFilename, 5107 const ComObjPtr<MediumFormat> &aFormat, 5108 MediumVariant_T aVariant, 5109 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser, 5110 const ComObjPtr<Medium> &aParent, 5111 const ComObjPtr<Progress> &aProgress) 5350 5112 { 5351 5113 AssertPtrReturn(aFilename, E_INVALIDARG); … … 5375 5137 if ( m->state != MediumState_NotCreated 5376 5138 && m->state != MediumState_Created) 5377 throw setStateError();5139 throw i_setStateError(); 5378 5140 5379 5141 /* Build the target lock list. */ 5380 5142 MediumLockList *pTargetMediumLockList(new MediumLockList()); 5381 5143 alock.release(); 5382 rc = createMediumLockList(true /* fFailIfInaccessible */,5383 true /* fMediumLockWrite */,5384 aParent,5385 *pTargetMediumLockList);5144 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 5145 true /* fMediumLockWrite */, 5146 aParent, 5147 *pTargetMediumLockList); 5386 5148 alock.acquire(); 5387 5149 if (FAILED(rc)) … … 5399 5161 throw setError(rc, 5400 5162 tr("Failed to lock target media '%s'"), 5401 getLocationFull().c_str());5163 i_getLocationFull().c_str()); 5402 5164 } 5403 5165 … … 5418 5180 5419 5181 if (SUCCEEDED(rc)) 5420 rc = startThread(pTask);5182 rc = i_startThread(pTask); 5421 5183 else if (pTask != NULL) 5422 5184 delete pTask; … … 5442 5204 * @return 5443 5205 */ 5444 HRESULT Medium:: cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,5445 const ComObjPtr<Medium> &aParent, IProgress **aProgress,5446 uint32_t idxSrcImageSame, uint32_t idxDstImageSame)5206 HRESULT Medium::i_cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant, 5207 const ComObjPtr<Medium> &aParent, IProgress **aProgress, 5208 uint32_t idxSrcImageSame, uint32_t idxDstImageSame) 5447 5209 { 5448 5210 CheckComArgNotNull(aTarget); … … 5474 5236 if ( aTarget->m->state != MediumState_NotCreated 5475 5237 && aTarget->m->state != MediumState_Created) 5476 throw aTarget-> setStateError();5238 throw aTarget->i_setStateError(); 5477 5239 5478 5240 /* Build the source lock list. */ 5479 5241 MediumLockList *pSourceMediumLockList(new MediumLockList()); 5480 5242 alock.release(); 5481 rc = createMediumLockList(true /* fFailIfInaccessible */,5482 false /* fMediumLockWrite */,5483 NULL,5484 *pSourceMediumLockList);5243 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 5244 false /* fMediumLockWrite */, 5245 NULL, 5246 *pSourceMediumLockList); 5485 5247 alock.acquire(); 5486 5248 if (FAILED(rc)) … … 5493 5255 MediumLockList *pTargetMediumLockList(new MediumLockList()); 5494 5256 alock.release(); 5495 rc = aTarget-> createMediumLockList(true /* fFailIfInaccessible */,5496 true /* fMediumLockWrite */,5497 aParent,5498 *pTargetMediumLockList);5257 rc = aTarget->i_createMediumLockList(true /* fFailIfInaccessible */, 5258 true /* fMediumLockWrite */, 5259 aParent, 5260 *pTargetMediumLockList); 5499 5261 alock.acquire(); 5500 5262 if (FAILED(rc)) … … 5514 5276 throw setError(rc, 5515 5277 tr("Failed to lock source media '%s'"), 5516 getLocationFull().c_str());5278 i_getLocationFull().c_str()); 5517 5279 } 5518 5280 alock.release(); … … 5525 5287 throw setError(rc, 5526 5288 tr("Failed to lock target media '%s'"), 5527 aTarget-> getLocationFull().c_str());5289 aTarget->i_getLocationFull().c_str()); 5528 5290 } 5529 5291 … … 5558 5320 if (SUCCEEDED(rc)) 5559 5321 { 5560 rc = startThread(pTask);5322 rc = i_startThread(pTask); 5561 5323 5562 5324 if (SUCCEEDED(rc)) … … 5592 5354 * @return 5593 5355 */ 5594 HRESULT Medium:: queryInfo(bool fSetImageId, bool fSetParentId)5356 HRESULT Medium::i_queryInfo(bool fSetImageId, bool fSetParentId) 5595 5357 { 5596 5358 Assert(!isWriteLockOnCurrentThread()); … … 5702 5464 5703 5465 PVBOXHDD hdd; 5704 vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);5466 vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 5705 5467 ComAssertRCThrow(vrc, E_FAIL); 5706 5468 … … 5718 5480 { 5719 5481 lastAccessError = Utf8StrFmt(tr("Could not open the medium '%s'%s"), 5720 location.c_str(), vdError(vrc).c_str());5482 location.c_str(), i_vdError(vrc).c_str()); 5721 5483 throw S_OK; 5722 5484 } … … 5734 5496 { 5735 5497 lastAccessError = Utf8StrFmt(tr("Could not update the UUID of medium '%s'%s"), 5736 location.c_str(), vdError(vrc).c_str());5498 location.c_str(), i_vdError(vrc).c_str()); 5737 5499 throw S_OK; 5738 5500 } … … 5747 5509 { 5748 5510 lastAccessError = Utf8StrFmt(tr("Could not update the parent UUID of medium '%s'%s"), 5749 location.c_str(), vdError(vrc).c_str());5511 location.c_str(), i_vdError(vrc).c_str()); 5750 5512 throw S_OK; 5751 5513 } … … 5879 5641 5880 5642 if (m->pParent) 5881 deparent();5882 setParent(pParent);5643 i_deparent(); 5644 i_setParent(pParent); 5883 5645 5884 5646 treeLock.release(); … … 5918 5680 AutoReadLock parentLock(m->pParent COMMA_LOCKVAL_SRC_POS); 5919 5681 if ( !fRepairImageZeroParentUuid 5920 && m->pParent-> getState() != MediumState_Inaccessible5921 && m->pParent-> getId() != parentId)5682 && m->pParent->i_getState() != MediumState_Inaccessible 5683 && m->pParent->i_getId() != parentId) 5922 5684 { 5923 5685 /** @todo r=klaus this always refers to VirtualBox.xml as the medium registry, even for new VMs */ … … 5925 5687 tr("Parent UUID {%RTuuid} of the medium '%s' does not match UUID {%RTuuid} of its parent medium stored in the media registry ('%s')"), 5926 5688 &parentId, location.c_str(), 5927 m->pParent-> getId().raw(),5689 m->pParent->i_getId().raw(), 5928 5690 m->pVirtualBox->settingsFilePath().c_str()); 5929 5691 parentLock.release(); … … 5955 5717 { 5956 5718 lastAccessError = Utf8StrFmt(tr("Could not update and close the medium '%s'%s"), 5957 location.c_str(), vdError(vrc).c_str());5719 location.c_str(), i_vdError(vrc).c_str()); 5958 5720 success = false; 5959 5721 throw S_OK; … … 6013 5775 { 6014 5776 PVBOXHDD hdd; 6015 vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);5777 vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 6016 5778 ComAssertRCThrow(vrc, E_FAIL); 6017 5779 … … 6060 5822 * @note Caller must hold the media tree write lock! 6061 5823 */ 6062 HRESULT Medium:: canClose()5824 HRESULT Medium::i_canClose() 6063 5825 { 6064 5826 Assert(m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 6065 5827 6066 if ( getChildren().size() != 0)5828 if (i_getChildren().size() != 0) 6067 5829 return setError(VBOX_E_OBJECT_IN_USE, 6068 5830 tr("Cannot close medium '%s' because it has %d child media"), 6069 m->strLocationFull.c_str(), getChildren().size());5831 m->strLocationFull.c_str(), i_getChildren().size()); 6070 5832 6071 5833 return S_OK; … … 6077 5839 * @note Caller must have locked the media tree lock for writing! 6078 5840 */ 6079 HRESULT Medium:: unregisterWithVirtualBox()5841 HRESULT Medium::i_unregisterWithVirtualBox() 6080 5842 { 6081 5843 /* Note that we need to de-associate ourselves from the parent to let … … 6086 5848 6087 5849 Medium *pParentBackup = m->pParent; 6088 AssertReturn( getChildren().size() == 0, E_FAIL);5850 AssertReturn(i_getChildren().size() == 0, E_FAIL); 6089 5851 if (m->pParent) 6090 deparent();5852 i_deparent(); 6091 5853 6092 5854 HRESULT rc = m->pVirtualBox->unregisterMedium(this); … … 6107 5869 * Like SetProperty but do not trigger a settings store. Only for internal use! 6108 5870 */ 6109 HRESULT Medium:: setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue)5871 HRESULT Medium::i_setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue) 6110 5872 { 6111 5873 AutoCaller autoCaller(this); … … 6120 5882 break; 6121 5883 default: 6122 return setStateError();5884 return i_setStateError(); 6123 5885 } 6124 5886 … … 6133 5895 * @note Must be called from under this object's write or read lock. 6134 5896 */ 6135 HRESULT Medium:: setStateError()5897 HRESULT Medium::i_setStateError() 6136 5898 { 6137 5899 HRESULT rc = E_FAIL; … … 6222 5984 * @note Must be called from under this object's write lock. 6223 5985 */ 6224 HRESULT Medium:: setLocation(const Utf8Str &aLocation,5986 HRESULT Medium::i_setLocation(const Utf8Str &aLocation, 6225 5987 const Utf8Str &aFormat /* = Utf8Str::Empty */) 6226 5988 { … … 6334 6096 else 6335 6097 { 6336 HRESULT rc = setFormat(aFormat);6098 HRESULT rc = i_setFormat(aFormat); 6337 6099 /* setFormat() must not fail since we've just used the backend so 6338 6100 * the format object must be there */ … … 6341 6103 } 6342 6104 else if ( enmType == VDTYPE_INVALID 6343 || m->devType != convertToDeviceType(enmType))6105 || m->devType != i_convertToDeviceType(enmType)) 6344 6106 { 6345 6107 /* … … 6355 6117 ComAssertRet(backendName != NULL && *backendName != '\0', E_FAIL); 6356 6118 6357 HRESULT rc = setFormat(backendName);6119 HRESULT rc = i_setFormat(backendName); 6358 6120 RTStrFree(backendName); 6359 6121 … … 6391 6153 * @note Must be called from under this object's write lock. 6392 6154 */ 6393 HRESULT Medium:: setFormat(const Utf8Str &aFormat)6155 HRESULT Medium::i_setFormat(const Utf8Str &aFormat) 6394 6156 { 6395 6157 /* get the format object first */ … … 6431 6193 * Converts the Medium device type to the VD type. 6432 6194 */ 6433 VDTYPE Medium:: convertDeviceType()6195 VDTYPE Medium::i_convertDeviceType() 6434 6196 { 6435 6197 VDTYPE enmType; … … 6456 6218 * Converts from the VD type to the medium type. 6457 6219 */ 6458 DeviceType_T Medium:: convertToDeviceType(VDTYPE enmType)6220 DeviceType_T Medium::i_convertToDeviceType(VDTYPE enmType) 6459 6221 { 6460 6222 DeviceType_T devType; … … 6479 6241 6480 6242 /** 6481 * Returns the last error message collected by the vdErrorCall callback and6243 * Returns the last error message collected by the i_vdErrorCall callback and 6482 6244 * resets it. 6483 6245 * … … 6489 6251 * format string is given @a aVRC as an argument. 6490 6252 * 6491 * If there is no last error message collected by vdErrorCall or if it is a6253 * If there is no last error message collected by i_vdErrorCall or if it is a 6492 6254 * null or empty string, then this function returns the following text: 6493 6255 * <code> … … 6500 6262 * @param aVRC VBox error code to use when no error message is provided. 6501 6263 */ 6502 Utf8Str Medium:: vdError(int aVRC)6264 Utf8Str Medium::i_vdError(int aVRC) 6503 6265 { 6504 6266 Utf8Str error; … … 6529 6291 */ 6530 6292 /*static*/ 6531 DECLCALLBACK(void) Medium:: vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,6532 const char *pszFormat, va_list va)6293 DECLCALLBACK(void) Medium::i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL, 6294 const char *pszFormat, va_list va) 6533 6295 { 6534 6296 NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); /* RT_SRC_POS_DECL */ … … 6547 6309 6548 6310 /* static */ 6549 DECLCALLBACK(bool) Medium:: vdConfigAreKeysValid(void *pvUser,6550 const char * /* pszzValid */)6311 DECLCALLBACK(bool) Medium::i_vdConfigAreKeysValid(void *pvUser, 6312 const char * /* pszzValid */) 6551 6313 { 6552 6314 Medium *that = static_cast<Medium*>(pvUser); … … 6559 6321 6560 6322 /* static */ 6561 DECLCALLBACK(int) Medium:: vdConfigQuerySize(void *pvUser,6562 const char *pszName,6563 size_t *pcbValue)6323 DECLCALLBACK(int) Medium::i_vdConfigQuerySize(void *pvUser, 6324 const char *pszName, 6325 size_t *pcbValue) 6564 6326 { 6565 6327 AssertReturn(VALID_PTR(pcbValue), VERR_INVALID_POINTER); … … 6582 6344 6583 6345 /* static */ 6584 DECLCALLBACK(int) Medium:: vdConfigQuery(void *pvUser,6585 const char *pszName,6586 char *pszValue,6587 size_t cchValue)6346 DECLCALLBACK(int) Medium::i_vdConfigQuery(void *pvUser, 6347 const char *pszName, 6348 char *pszValue, 6349 size_t cchValue) 6588 6350 { 6589 6351 AssertReturn(VALID_PTR(pszValue), VERR_INVALID_POINTER); … … 6609 6371 } 6610 6372 6611 DECLCALLBACK(int) Medium:: vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock)6373 DECLCALLBACK(int) Medium::i_vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock) 6612 6374 { 6613 6375 PVDSOCKETINT pSocketInt = NULL; … … 6625 6387 } 6626 6388 6627 DECLCALLBACK(int) Medium:: vdTcpSocketDestroy(VDSOCKET Sock)6389 DECLCALLBACK(int) Medium::i_vdTcpSocketDestroy(VDSOCKET Sock) 6628 6390 { 6629 6391 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6637 6399 } 6638 6400 6639 DECLCALLBACK(int) Medium:: vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort)6401 DECLCALLBACK(int) Medium::i_vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort) 6640 6402 { 6641 6403 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6644 6406 } 6645 6407 6646 DECLCALLBACK(int) Medium:: vdTcpClientClose(VDSOCKET Sock)6408 DECLCALLBACK(int) Medium::i_vdTcpClientClose(VDSOCKET Sock) 6647 6409 { 6648 6410 int rc = VINF_SUCCESS; … … 6654 6416 } 6655 6417 6656 DECLCALLBACK(bool) Medium:: vdTcpIsClientConnected(VDSOCKET Sock)6418 DECLCALLBACK(bool) Medium::i_vdTcpIsClientConnected(VDSOCKET Sock) 6657 6419 { 6658 6420 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6660 6422 } 6661 6423 6662 DECLCALLBACK(int) Medium:: vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies)6424 DECLCALLBACK(int) Medium::i_vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies) 6663 6425 { 6664 6426 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6666 6428 } 6667 6429 6668 DECLCALLBACK(int) Medium:: vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead)6430 DECLCALLBACK(int) Medium::i_vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead) 6669 6431 { 6670 6432 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6672 6434 } 6673 6435 6674 DECLCALLBACK(int) Medium:: vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer)6436 DECLCALLBACK(int) Medium::i_vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer) 6675 6437 { 6676 6438 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6678 6440 } 6679 6441 6680 DECLCALLBACK(int) Medium:: vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf)6442 DECLCALLBACK(int) Medium::i_vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf) 6681 6443 { 6682 6444 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6684 6446 } 6685 6447 6686 DECLCALLBACK(int) Medium:: vdTcpFlush(VDSOCKET Sock)6448 DECLCALLBACK(int) Medium::i_vdTcpFlush(VDSOCKET Sock) 6687 6449 { 6688 6450 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6690 6452 } 6691 6453 6692 DECLCALLBACK(int) Medium:: vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable)6454 DECLCALLBACK(int) Medium::i_vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable) 6693 6455 { 6694 6456 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6696 6458 } 6697 6459 6698 DECLCALLBACK(int) Medium:: vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr)6460 DECLCALLBACK(int) Medium::i_vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr) 6699 6461 { 6700 6462 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6702 6464 } 6703 6465 6704 DECLCALLBACK(int) Medium:: vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr)6466 DECLCALLBACK(int) Medium::i_vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr) 6705 6467 { 6706 6468 PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock; … … 6716 6478 * other threads asynchronously waiting for it. 6717 6479 */ 6718 HRESULT Medium:: startThread(Medium::Task *pTask)6480 HRESULT Medium::i_startThread(Medium::Task *pTask) 6719 6481 { 6720 6482 #ifdef VBOX_WITH_MAIN_LOCK_VALIDATION … … 6754 6516 * complete the progress object in this case. 6755 6517 */ 6756 HRESULT Medium:: runNow(Medium::Task *pTask)6518 HRESULT Medium::i_runNow(Medium::Task *pTask) 6757 6519 { 6758 6520 #ifdef VBOX_WITH_MAIN_LOCK_VALIDATION … … 6778 6540 * @return 6779 6541 */ 6780 HRESULT Medium:: taskCreateBaseHandler(Medium::CreateBaseTask &task)6542 HRESULT Medium::i_taskCreateBaseHandler(Medium::CreateBaseTask &task) 6781 6543 { 6782 6544 HRESULT rc = S_OK; … … 6811 6573 6812 6574 PVBOXHDD hdd; 6813 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);6575 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 6814 6576 ComAssertRCThrow(vrc, E_FAIL); 6815 6577 … … 6844 6606 throw setError(VBOX_E_FILE_ERROR, 6845 6607 tr("Could not create the medium storage unit '%s'%s"), 6846 location.c_str(), vdError(vrc).c_str());6608 location.c_str(), i_vdError(vrc).c_str()); 6847 6609 6848 6610 size = VDGetFileSize(hdd, 0); … … 6882 6644 6883 6645 thisLock.release(); 6884 markRegistriesModified();6646 i_markRegistriesModified(); 6885 6647 if (task.isAsync()) 6886 6648 { … … 6914 6676 * @return 6915 6677 */ 6916 HRESULT Medium:: taskCreateDiffHandler(Medium::CreateDiffTask &task)6678 HRESULT Medium::i_taskCreateDiffHandler(Medium::CreateDiffTask &task) 6917 6679 { 6918 6680 HRESULT rcTmp = S_OK; … … 6952 6714 6953 6715 PVBOXHDD hdd; 6954 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);6716 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 6955 6717 ComAssertRCThrow(vrc, E_FAIL); 6956 6718 … … 6992 6754 tr("Could not open the medium storage unit '%s'%s"), 6993 6755 pMedium->m->strLocationFull.c_str(), 6994 vdError(vrc).c_str());6756 i_vdError(vrc).c_str()); 6995 6757 } 6996 6758 … … 7016 6778 throw setError(VBOX_E_FILE_ERROR, 7017 6779 tr("Could not create the differencing medium storage unit '%s'%s"), 7018 targetLocation.c_str(), vdError(vrc).c_str());6780 targetLocation.c_str(), i_vdError(vrc).c_str()); 7019 6781 7020 6782 size = VDGetFileSize(hdd, VD_LAST_IMAGE); … … 7046 6808 * potential race! */ 7047 6809 /* diffs for immutable media are auto-reset by default */ 7048 pTarget->m->autoReset = ( getBase()->m->type == MediumType_Immutable);6810 pTarget->m->autoReset = (i_getBase()->m->type == MediumType_Immutable); 7049 6811 7050 6812 /* register with mVirtualBox as the last step and move to … … 7057 6819 if (FAILED(mrc)) 7058 6820 /* break the parent association on failure to register */ 7059 deparent();6821 i_deparent(); 7060 6822 } 7061 6823 … … 7087 6849 7088 6850 mediaLock.release(); 7089 markRegistriesModified();6851 i_markRegistriesModified(); 7090 6852 if (task.isAsync()) 7091 6853 { … … 7112 6874 * @return 7113 6875 */ 7114 HRESULT Medium:: taskMergeHandler(Medium::MergeTask &task)6876 HRESULT Medium::i_taskMergeHandler(Medium::MergeTask &task) 7115 6877 { 7116 6878 HRESULT rcTmp = S_OK; … … 7121 6883 { 7122 6884 PVBOXHDD hdd; 7123 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);6885 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 7124 6886 ComAssertRCThrow(vrc, E_FAIL); 7125 6887 … … 7249 7011 m->strLocationFull.c_str(), 7250 7012 pTarget->m->strLocationFull.c_str(), 7251 vdError(aVRC).c_str());7013 i_vdError(aVRC).c_str()); 7252 7014 } 7253 7015 … … 7276 7038 /* then, reparent it and disconnect the deleted branch at 7277 7039 * both ends (chain->parent() is source's parent) */ 7278 pTarget-> deparent();7040 pTarget->i_deparent(); 7279 7041 pTarget->m->pParent = task.mParentForTarget; 7280 7042 if (pTarget->m->pParent) 7281 7043 { 7282 7044 pTarget->m->pParent->m->llChildren.push_back(pTarget); 7283 deparent();7045 i_deparent(); 7284 7046 } 7285 7047 … … 7292 7054 else 7293 7055 { 7294 Assert(pTarget-> getChildren().size() == 1);7295 Medium *targetChild = pTarget-> getChildren().front();7056 Assert(pTarget->i_getChildren().size() == 1); 7057 Medium *targetChild = pTarget->i_getChildren().front(); 7296 7058 7297 7059 /* disconnect the deleted branch at the elder end */ 7298 targetChild-> deparent();7060 targetChild->i_deparent(); 7299 7061 7300 7062 /* reparent source's children and disconnect the deleted … … 7314 7076 AutoWriteLock childLock(pMedium COMMA_LOCKVAL_SRC_POS); 7315 7077 7316 pMedium-> deparent(); // removes pMedium from source7317 pMedium-> setParent(pTarget);7078 pMedium->i_deparent(); // removes pMedium from source 7079 pMedium->i_setParent(pTarget); 7318 7080 } 7319 7081 } … … 7359 7121 if (pMedium == this) 7360 7122 { 7361 Assert( getChildren().size() == 0);7123 Assert(i_getChildren().size() == 0); 7362 7124 Assert(m->backRefs.size() == 0); 7363 7125 task.mMediumCaller.release(); … … 7375 7137 } 7376 7138 7377 markRegistriesModified();7139 i_markRegistriesModified(); 7378 7140 if (task.isAsync()) 7379 7141 { … … 7397 7159 * don't own the merge chain, so release it in this case. */ 7398 7160 if (task.isAsync()) 7399 cancelMergeTo(task.mpChildrenToReparent, task.mpMediumLockList);7161 i_cancelMergeTo(task.mpChildrenToReparent, task.mpMediumLockList); 7400 7162 } 7401 7163 … … 7412 7174 * @return 7413 7175 */ 7414 HRESULT Medium:: taskCloneHandler(Medium::CloneTask &task)7176 HRESULT Medium::i_taskCloneHandler(Medium::CloneTask &task) 7415 7177 { 7416 7178 HRESULT rcTmp = S_OK; … … 7447 7209 7448 7210 PVBOXHDD hdd; 7449 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7211 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 7450 7212 ComAssertRCThrow(vrc, E_FAIL); 7451 7213 … … 7478 7240 tr("Could not open the medium storage unit '%s'%s"), 7479 7241 pMedium->m->strLocationFull.c_str(), 7480 vdError(vrc).c_str());7242 i_vdError(vrc).c_str()); 7481 7243 } 7482 7244 … … 7503 7265 7504 7266 PVBOXHDD targetHdd; 7505 vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);7267 vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd); 7506 7268 ComAssertRCThrow(vrc, E_FAIL); 7507 7269 … … 7547 7309 tr("Could not open the medium storage unit '%s'%s"), 7548 7310 pMedium->m->strLocationFull.c_str(), 7549 vdError(vrc).c_str());7311 i_vdError(vrc).c_str()); 7550 7312 } 7551 7313 … … 7588 7350 throw setError(VBOX_E_FILE_ERROR, 7589 7351 tr("Could not create the clone medium '%s'%s"), 7590 targetLocation.c_str(), vdError(vrc).c_str());7352 targetLocation.c_str(), i_vdError(vrc).c_str()); 7591 7353 7592 7354 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 7638 7400 if (FAILED(mrc)) 7639 7401 /* break parent association on failure to register */ 7640 pTarget-> deparent(); // removes target from parent7402 pTarget->i_deparent(); // removes target from parent 7641 7403 } 7642 7404 else … … 7680 7442 { 7681 7443 // save the settings 7682 markRegistriesModified();7444 i_markRegistriesModified(); 7683 7445 /* collect multiple errors */ 7684 7446 eik.restore(); … … 7708 7470 * @return 7709 7471 */ 7710 HRESULT Medium:: taskDeleteHandler(Medium::DeleteTask &task)7472 HRESULT Medium::i_taskDeleteHandler(Medium::DeleteTask &task) 7711 7473 { 7712 7474 NOREF(task); … … 7720 7482 7721 7483 PVBOXHDD hdd; 7722 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7484 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 7723 7485 ComAssertRCThrow(vrc, E_FAIL); 7724 7486 … … 7743 7505 throw setError(VBOX_E_FILE_ERROR, 7744 7506 tr("Could not delete the medium storage unit '%s'%s"), 7745 location.c_str(), vdError(vrc).c_str());7507 location.c_str(), i_vdError(vrc).c_str()); 7746 7508 7747 7509 } … … 7774 7536 * @return 7775 7537 */ 7776 HRESULT Medium:: taskResetHandler(Medium::ResetTask &task)7538 HRESULT Medium::i_taskResetHandler(Medium::ResetTask &task) 7777 7539 { 7778 7540 HRESULT rc = S_OK; … … 7792 7554 7793 7555 PVBOXHDD hdd; 7794 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7556 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 7795 7557 ComAssertRCThrow(vrc, E_FAIL); 7796 7558 … … 7839 7601 tr("Could not open the medium storage unit '%s'%s"), 7840 7602 pMedium->m->strLocationFull.c_str(), 7841 vdError(vrc).c_str());7603 i_vdError(vrc).c_str()); 7842 7604 7843 7605 /* Done when we hit the media which should be reset */ … … 7851 7613 throw setError(VBOX_E_FILE_ERROR, 7852 7614 tr("Could not delete the medium storage unit '%s'%s"), 7853 location.c_str(), vdError(vrc).c_str());7615 location.c_str(), i_vdError(vrc).c_str()); 7854 7616 7855 7617 /* next, create it again */ … … 7862 7624 throw setError(VBOX_E_FILE_ERROR, 7863 7625 tr("Could not open the medium storage unit '%s'%s"), 7864 parentLocation.c_str(), vdError(vrc).c_str());7626 parentLocation.c_str(), i_vdError(vrc).c_str()); 7865 7627 7866 7628 vrc = VDCreateDiff(hdd, … … 7878 7640 throw setError(VBOX_E_FILE_ERROR, 7879 7641 tr("Could not create the differencing medium storage unit '%s'%s"), 7880 location.c_str(), vdError(vrc).c_str());7642 location.c_str(), i_vdError(vrc).c_str()); 7881 7643 7882 7644 size = VDGetFileSize(hdd, VD_LAST_IMAGE); … … 7911 7673 * @return 7912 7674 */ 7913 HRESULT Medium:: taskCompactHandler(Medium::CompactTask &task)7675 HRESULT Medium::i_taskCompactHandler(Medium::CompactTask &task) 7914 7676 { 7915 7677 HRESULT rc = S_OK; … … 7923 7685 { 7924 7686 PVBOXHDD hdd; 7925 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7687 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 7926 7688 ComAssertRCThrow(vrc, E_FAIL); 7927 7689 … … 7962 7724 tr("Could not open the medium storage unit '%s'%s"), 7963 7725 pMedium->m->strLocationFull.c_str(), 7964 vdError(vrc).c_str());7726 i_vdError(vrc).c_str()); 7965 7727 } 7966 7728 … … 7987 7749 tr("Could not compact medium '%s'%s"), 7988 7750 location.c_str(), 7989 vdError(vrc).c_str());7751 i_vdError(vrc).c_str()); 7990 7752 } 7991 7753 } … … 8008 7770 * @return 8009 7771 */ 8010 HRESULT Medium:: taskResizeHandler(Medium::ResizeTask &task)7772 HRESULT Medium::i_taskResizeHandler(Medium::ResizeTask &task) 8011 7773 { 8012 7774 HRESULT rc = S_OK; … … 8021 7783 8022 7784 PVBOXHDD hdd; 8023 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7785 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 8024 7786 ComAssertRCThrow(vrc, E_FAIL); 8025 7787 … … 8060 7822 tr("Could not open the medium storage unit '%s'%s"), 8061 7823 pMedium->m->strLocationFull.c_str(), 8062 vdError(vrc).c_str());7824 i_vdError(vrc).c_str()); 8063 7825 } 8064 7826 … … 8086 7848 tr("Could not resize medium '%s'%s"), 8087 7849 location.c_str(), 8088 vdError(vrc).c_str());7850 i_vdError(vrc).c_str()); 8089 7851 } 8090 7852 size = VDGetFileSize(hdd, VD_LAST_IMAGE); … … 8120 7882 * @return 8121 7883 */ 8122 HRESULT Medium:: taskExportHandler(Medium::ExportTask &task)7884 HRESULT Medium::i_taskExportHandler(Medium::ExportTask &task) 8123 7885 { 8124 7886 HRESULT rc = S_OK; … … 8132 7894 8133 7895 PVBOXHDD hdd; 8134 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);7896 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 8135 7897 ComAssertRCThrow(vrc, E_FAIL); 8136 7898 … … 8163 7925 tr("Could not open the medium storage unit '%s'%s"), 8164 7926 pMedium->m->strLocationFull.c_str(), 8165 vdError(vrc).c_str());7927 i_vdError(vrc).c_str()); 8166 7928 } 8167 7929 … … 8184 7946 8185 7947 PVBOXHDD targetHdd; 8186 vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);7948 vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd); 8187 7949 ComAssertRCThrow(vrc, E_FAIL); 8188 7950 … … 8205 7967 throw setError(VBOX_E_FILE_ERROR, 8206 7968 tr("Could not create the clone medium '%s'%s"), 8207 targetLocation.c_str(), vdError(vrc).c_str());7969 targetLocation.c_str(), i_vdError(vrc).c_str()); 8208 7970 } 8209 7971 catch (HRESULT aRC) { rc = aRC; } … … 8237 7999 * @return 8238 8000 */ 8239 HRESULT Medium:: taskImportHandler(Medium::ImportTask &task)8001 HRESULT Medium::i_taskImportHandler(Medium::ImportTask &task) 8240 8002 { 8241 8003 HRESULT rcTmp = S_OK; … … 8272 8034 8273 8035 PVBOXHDD hdd; 8274 int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);8036 int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd); 8275 8037 ComAssertRCThrow(vrc, E_FAIL); 8276 8038 … … 8287 8049 tr("Could not open the medium storage unit '%s'%s"), 8288 8050 task.mFilename.c_str(), 8289 vdError(vrc).c_str());8051 i_vdError(vrc).c_str()); 8290 8052 8291 8053 Utf8Str targetFormat(m->strFormat); … … 8310 8072 8311 8073 PVBOXHDD targetHdd; 8312 vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);8074 vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd); 8313 8075 ComAssertRCThrow(vrc, E_FAIL); 8314 8076 … … 8354 8116 tr("Could not open the medium storage unit '%s'%s"), 8355 8117 pMedium->m->strLocationFull.c_str(), 8356 vdError(vrc).c_str());8118 i_vdError(vrc).c_str()); 8357 8119 } 8358 8120 … … 8374 8136 throw setError(VBOX_E_FILE_ERROR, 8375 8137 tr("Could not create the clone medium '%s'%s"), 8376 targetLocation.c_str(), vdError(vrc).c_str());8138 targetLocation.c_str(), i_vdError(vrc).c_str()); 8377 8139 8378 8140 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 8423 8185 if (FAILED(mrc)) 8424 8186 /* break parent association on failure to register */ 8425 this-> deparent(); // removes target from parent8187 this->i_deparent(); // removes target from parent 8426 8188 } 8427 8189 else … … 8462 8224 { 8463 8225 // save the settings 8464 markRegistriesModified();8226 i_markRegistriesModified(); 8465 8227 /* collect multiple errors */ 8466 8228 eik.restore(); -
trunk/src/VBox/Main/src-server/MediumLock.cpp
r48297 r49795 96 96 { 97 97 AutoReadLock alock(mMedium COMMA_LOCKVAL_SRC_POS); 98 state = mMedium-> getState();98 state = mMedium->i_getState(); 99 99 } 100 100 switch (state) -
trunk/src/VBox/Main/src-server/Performance.cpp
r48955 r49795 1101 1101 AutoReadLock local_alock(pMedium COMMA_LOCKVAL_SRC_POS); 1102 1102 1103 used += (ULONG)(pMedium-> getSize() / _1M);1103 used += (ULONG)(pMedium->i_getSize() / _1M); 1104 1104 } 1105 1105 -
trunk/src/VBox/Main/src-server/SerialPortImpl.cpp
r49730 r49795 400 400 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 401 401 402 if (aPath != m->bd->strPath) 403 { 404 HRESULT rc = i_checkSetPath(aPath); 402 com::Utf8Str strPath = aPath; 403 404 /* we treat empty as null when e.g. saving to XML, do the same here */ 405 if (!strPath.isEmpty()) 406 strPath = ""; 407 408 if (strPath != m->bd->strPath) 409 { 410 HRESULT rc = i_checkSetPath(strPath); 405 411 if (FAILED(rc)) return rc; 406 412 407 413 m->bd.backup(); 408 m->bd->strPath = aPath;414 m->bd->strPath = strPath; 409 415 410 416 m->fModified = true; -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r49687 r49795 1048 1048 if (pMedium) // can be NULL for non-harddisk 1049 1049 { 1050 rc = pMedium-> addBackReference(mData->mUuid, mSnapshotId);1050 rc = pMedium->i_addBackReference(mData->mUuid, mSnapshotId); 1051 1051 AssertComRC(rc); 1052 1052 } … … 1782 1782 ++ulTotalWeight; // assume one MB weight for each differencing hard disk to manage 1783 1783 Assert(pAttach->getMedium()); 1784 LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pAttach->getMedium()-> getName().c_str()));1784 LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pAttach->getMedium()->i_getName().c_str())); 1785 1785 } 1786 1786 } … … 1970 1970 if ( !pMedium.isNull() 1971 1971 && pAttach->getType() == DeviceType_HardDisk 1972 && !pMedium-> getParent().isNull()1973 && pMedium-> getChildren().size() == 01972 && !pMedium->i_getParent().isNull() 1973 && pMedium->i_getChildren().size() == 0 1974 1974 ) 1975 1975 { 1976 LogFlowThisFunc(("Picked differencing image '%s' for deletion\n", pMedium-> getName().c_str()));1976 LogFlowThisFunc(("Picked differencing image '%s' for deletion\n", pMedium->i_getName().c_str())); 1977 1977 1978 1978 llDiffAttachmentsToDelete.push_back(pAttach); … … 2012 2012 AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 2013 2013 2014 LogFlowThisFunc(("Detaching old current state in differencing image '%s'\n", pMedium-> getName().c_str()));2014 LogFlowThisFunc(("Detaching old current state in differencing image '%s'\n", pMedium->i_getName().c_str())); 2015 2015 2016 2016 // Normally we "detach" the medium by removing the attachment object … … 2028 2028 mMediaData.backedUpData()->mAttachments.remove(pAttach); 2029 2029 // then clean up backrefs 2030 pMedium-> removeBackReference(mData->mUuid);2030 pMedium->i_removeBackReference(mData->mUuid); 2031 2031 2032 2032 llDiffsToDelete.push_back(pMedium); … … 2054 2054 { 2055 2055 ComObjPtr<Medium> &pMedium = *it; 2056 LogFlowThisFunc(("Deleting old current state in differencing image '%s'\n", pMedium-> getName().c_str()));2057 2058 HRESULT rc2 = pMedium-> deleteStorage(NULL /* aProgress */,2059 true /* aWait */);2056 LogFlowThisFunc(("Deleting old current state in differencing image '%s'\n", pMedium->i_getName().c_str())); 2057 2058 HRESULT rc2 = pMedium->i_deleteStorage(NULL /* aProgress */, 2059 true /* aWait */); 2060 2060 // ignore errors here because we cannot roll back after saveSettings() above 2061 2061 if (SUCCEEDED(rc2)) … … 2169 2169 mUserData->s.strName.c_str(), 2170 2170 childrenCount); 2171 2171 2172 if (pSnapshot == mData->mCurrentSnapshot && childrenCount >= 1) 2172 2173 return setError(VBOX_E_INVALID_OBJECT_STATE, … … 2175 2176 mUserData->s.strName.c_str()); 2176 2177 2178 2177 2179 /* If the snapshot being deleted is the current one, ensure current 2178 2180 * settings are committed and saved. … … 2218 2220 AutoReadLock mlock(pHD COMMA_LOCKVAL_SRC_POS); 2219 2221 2220 MediumType_T type = pHD-> getType();2222 MediumType_T type = pHD->i_getType(); 2221 2223 // writethrough and shareable images are unaffected by snapshots, 2222 2224 // so do nothing for them … … 2227 2229 // normal or immutable media need attention 2228 2230 ++ulOpCount; 2229 ulTotalWeight += (ULONG)(pHD-> getSize() / _1M);2231 ulTotalWeight += (ULONG)(pHD->i_getSize() / _1M); 2230 2232 } 2231 LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pHD-> getName().c_str()));2233 LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pHD->i_getName().c_str())); 2232 2234 } 2233 2235 } … … 2445 2447 // unaffected by snapshots, skip them 2446 2448 AutoReadLock medlock(pHD COMMA_LOCKVAL_SRC_POS); 2447 MediumType_T type = pHD-> getType();2449 MediumType_T type = pHD->i_getType(); 2448 2450 if ( type == MediumType_Writethrough 2449 2451 || type == MediumType_Shareable … … 2453 2455 2454 2456 #ifdef DEBUG 2455 pHD-> dumpBackRefs();2457 pHD->i_dumpBackRefs(); 2456 2458 #endif 2457 2459 … … 2525 2527 // base disk. Here we need then to update the attachment that 2526 2528 // refers to the child and have it point to the parent instead 2527 Assert(pHD-> getChildren().size() == 1);2528 2529 ComObjPtr<Medium> pReplaceHD = pHD-> getChildren().front();2529 Assert(pHD->i_getChildren().size() == 1); 2530 2531 ComObjPtr<Medium> pReplaceHD = pHD->i_getChildren().front(); 2530 2532 2531 2533 ComAssertThrow(pReplaceHD == pSource, E_FAIL); … … 2535 2537 Guid replaceSnapshotId; 2536 2538 2537 const Guid *pReplaceMachineId = pSource-> getFirstMachineBackrefId();2539 const Guid *pReplaceMachineId = pSource->i_getFirstMachineBackrefId(); 2538 2540 // minimal sanity checking 2539 2541 Assert(!pReplaceMachineId || *pReplaceMachineId == mData->mUuid); … … 2541 2543 replaceMachineId = *pReplaceMachineId; 2542 2544 2543 const Guid *pSnapshotId = pSource-> getFirstMachineBackrefSnapshotId();2545 const Guid *pSnapshotId = pSource->i_getFirstMachineBackrefSnapshotId(); 2544 2546 if (pSnapshotId) 2545 2547 replaceSnapshotId = *pSnapshotId; … … 2551 2553 // with the snapshot until the merge was successful. 2552 2554 HRESULT rc2 = S_OK; 2553 rc2 = pSource-> removeBackReference(replaceMachineId, replaceSnapshotId);2555 rc2 = pSource->i_removeBackReference(replaceMachineId, replaceSnapshotId); 2554 2556 AssertComRC(rc2); 2555 2557 … … 2608 2610 throw rc; 2609 2611 2610 if(pTarget_local->i sMediumFormatFile())2612 if(pTarget_local->i_isMediumFormatFile()) 2611 2613 { 2612 int vrc = RTFsQuerySerial(pTarget_local-> getLocationFull().c_str(), &pu32Serial);2614 int vrc = RTFsQuerySerial(pTarget_local->i_getLocationFull().c_str(), &pu32Serial); 2613 2615 if (RT_FAILURE(vrc)) 2614 2616 { 2615 2617 rc = setError(E_FAIL, 2616 2618 tr(" Unable to merge storage '%s'. Can't get storage UID "), 2617 pTarget_local-> getLocationFull().c_str());2619 pTarget_local->i_getLocationFull().c_str()); 2618 2620 throw rc; 2619 2621 } … … 2624 2626 neededStorageFreeSpace.insert(std::make_pair(pu32Serial,diskSize)); 2625 2627 /* linking storage UID with snapshot path, it is a helper container (just for easy finding needed path) */ 2626 serialMapToStoragePath.insert(std::make_pair(pu32Serial,pTarget_local-> getLocationFull().c_str()));2628 serialMapToStoragePath.insert(std::make_pair(pu32Serial,pTarget_local->i_getLocationFull().c_str())); 2627 2629 } 2628 2630 … … 2729 2731 { 2730 2732 AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS); 2731 ulWeight = (ULONG)(pMedium-> getSize() / _1M);2733 ulWeight = (ULONG)(pMedium->i_getSize() / _1M); 2732 2734 } 2733 2735 2734 2736 aTask.pProgress->SetNextOperation(BstrFmt(tr("Merging differencing image '%s'"), 2735 pMedium-> getName().c_str()).raw(),2737 pMedium->i_getName().c_str()).raw(), 2736 2738 ulWeight); 2737 2739 … … 2745 2747 2746 2748 Assert( !it->mfMergeForward 2747 || pMedium-> getChildren().size() == 0);2749 || pMedium->i_getChildren().size() == 0); 2748 2750 2749 2751 /* Delete the differencing hard disk (has no children). Two … … 2752 2754 * In both cases leave the image in place. If it's the first 2753 2755 * exception the user can delete it later if he wants. */ 2754 if (!pMedium-> getParent().isNull())2756 if (!pMedium->i_getParent().isNull()) 2755 2757 { 2756 Assert(pMedium-> getState() == MediumState_Deleting);2758 Assert(pMedium->i_getState() == MediumState_Deleting); 2757 2759 /* No need to hold the lock any longer. */ 2758 2760 mLock.release(); 2759 rc = pMedium-> deleteStorage(&aTask.pProgress,2760 true /* aWait */);2761 rc = pMedium->i_deleteStorage(&aTask.pProgress, 2762 true /* aWait */); 2761 2763 if (FAILED(rc)) 2762 2764 throw rc; … … 2791 2793 { 2792 2794 // normal medium merge, in the direction decided earlier 2793 rc = it->mpSource-> mergeTo(it->mpTarget,2794 it->mfMergeForward,2795 it->mpParentForTarget,2796 it->mpChildrenToReparent,2797 it->mpMediumLockList,2798 &aTask.pProgress,2799 true /* aWait */);2795 rc = it->mpSource->i_mergeTo(it->mpTarget, 2796 it->mfMergeForward, 2797 it->mpParentForTarget, 2798 it->mpChildrenToReparent, 2799 it->mpMediumLockList, 2800 &aTask.pProgress, 2801 true /* aWait */); 2800 2802 } 2801 2803 … … 2809 2811 { 2810 2812 AutoReadLock mlock(it->mpSource COMMA_LOCKVAL_SRC_POS); 2811 if (!it->mpSource->i sMediumFormatFile())2813 if (!it->mpSource->i_isMediumFormatFile()) 2812 2814 // Diff medium not backed by a file - cannot get status so 2813 2815 // be pessimistic. 2814 2816 throw rc; 2815 const Utf8Str &loc = it->mpSource-> getLocationFull();2817 const Utf8Str &loc = it->mpSource->i_getLocationFull(); 2816 2818 // Source medium is still there, so merge failed early. 2817 2819 if (RTFileExists(loc.c_str())) … … 2848 2850 pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments, 2849 2851 it->mpTarget); 2850 it->mpTarget-> removeBackReference(machineId, snapshotId);2852 it->mpTarget->i_removeBackReference(machineId, snapshotId); 2851 2853 } 2852 2854 else … … 2872 2874 AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS); 2873 2875 pAtt->updateMedium(it->mpTarget); 2874 it->mpTarget-> addBackReference(pMachine->mData->mUuid, childSnapshotId);2876 it->mpTarget->i_addBackReference(pMachine->mData->mUuid, childSnapshotId); 2875 2877 } 2876 2878 else … … 2882 2884 // Needs a bit of special treatment due to this difference. 2883 2885 if (it->mfNeedsOnlineMerge) 2884 it->mpTarget-> addBackReference(pMachine->mData->mUuid, childSnapshotId);2886 it->mpTarget->i_addBackReference(pMachine->mData->mUuid, childSnapshotId); 2885 2887 } 2886 2888 } … … 3021 3023 3022 3024 // Medium must not be writethrough/shareable/readonly at this point 3023 MediumType_T type = aHD-> getType();3025 MediumType_T type = aHD->i_getType(); 3024 3026 AssertReturn( type != MediumType_Writethrough 3025 3027 && type != MediumType_Shareable … … 3030 3032 fNeedsOnlineMerge = false; 3031 3033 3032 if (aHD-> getChildren().size() == 0)3034 if (aHD->i_getChildren().size() == 0) 3033 3035 { 3034 3036 /* This technically is no merge, set those values nevertheless. … … 3038 3040 3039 3041 /* special treatment of the last hard disk in the chain: */ 3040 if (aHD-> getParent().isNull())3042 if (aHD->i_getParent().isNull()) 3041 3043 { 3042 3044 /* lock only, to prevent any usage until the snapshot deletion … … 3048 3050 /* the differencing hard disk w/o children will be deleted, protect it 3049 3051 * from attaching to other VMs (this is why Deleting) */ 3050 return aHD-> markForDeletion();3052 return aHD->i_markForDeletion(); 3051 3053 } 3052 3054 3053 3055 /* not going multi-merge as it's too expensive */ 3054 if (aHD-> getChildren().size() > 1)3056 if (aHD->i_getChildren().size() > 1) 3055 3057 return setError(E_FAIL, 3056 3058 tr("Hard disk '%s' has more than one child hard disk (%d)"), 3057 aHD-> getLocationFull().c_str(),3058 aHD-> getChildren().size());3059 3060 ComObjPtr<Medium> pChild = aHD-> getChildren().front();3059 aHD->i_getLocationFull().c_str(), 3060 aHD->i_getChildren().size()); 3061 3062 ComObjPtr<Medium> pChild = aHD->i_getChildren().front(); 3061 3063 3062 3064 AutoWriteLock childLock(pChild COMMA_LOCKVAL_SRC_POS); 3063 3065 3064 3066 /* the rest is a normal merge setup */ 3065 if (aHD-> getParent().isNull())3067 if (aHD->i_getParent().isNull()) 3066 3068 { 3067 3069 /* base hard disk, backward merge */ 3068 const Guid *pMachineId1 = pChild-> getFirstMachineBackrefId();3069 const Guid *pMachineId2 = aHD-> getFirstMachineBackrefId();3070 const Guid *pMachineId1 = pChild->i_getFirstMachineBackrefId(); 3071 const Guid *pMachineId2 = aHD->i_getFirstMachineBackrefId(); 3070 3072 if (pMachineId1 && pMachineId2 && *pMachineId1 != *pMachineId2) 3071 3073 { … … 3087 3089 childLock.release(); 3088 3090 alock.release(); 3089 HRESULT rc = aHD-> queryPreferredMergeDirection(pChild, fMergeForward);3091 HRESULT rc = aHD->i_queryPreferredMergeDirection(pChild, fMergeForward); 3090 3092 alock.acquire(); 3091 3093 childLock.acquire(); … … 3111 3113 childLock.release(); 3112 3114 alock.release(); 3113 rc = aSource-> prepareMergeTo(aTarget, &aMachineId, &aSnapshotId,3115 rc = aSource->i_prepareMergeTo(aTarget, &aMachineId, &aSnapshotId, 3114 3116 !fOnlineMergePossible /* fLockMedia */, 3115 3117 aMergeForward, aParentForTarget, … … 3221 3223 if (FAILED(rc)) 3222 3224 { 3223 aSource-> cancelMergeTo(aChildrenToReparent, aMediumLockList);3225 aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList); 3224 3226 rc = setError(rc, 3225 3227 tr("Cannot lock hard disk '%s' for a live merge"), 3226 aHD-> getLocationFull().c_str());3228 aHD->i_getLocationFull().c_str()); 3227 3229 } 3228 3230 else … … 3235 3237 else 3236 3238 { 3237 aSource-> cancelMergeTo(aChildrenToReparent, aMediumLockList);3239 aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList); 3238 3240 rc = setError(rc, 3239 3241 tr("Failed to construct lock list for a live merge of hard disk '%s'"), 3240 aHD-> getLocationFull().c_str());3242 aHD->i_getLocationFull().c_str()); 3241 3243 } 3242 3244 … … 3261 3263 // blindly apply this, only needed for medium objects which 3262 3264 // would be deleted as part of the merge 3263 pMedium-> unmarkLockedForDeletion();3265 pMedium->i_unmarkLockedForDeletion(); 3264 3266 } 3265 3267 } … … 3268 3270 else 3269 3271 { 3270 aSource-> cancelMergeTo(aChildrenToReparent, aMediumLockList);3272 aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList); 3271 3273 rc = setError(rc, 3272 3274 tr("Cannot lock hard disk '%s' for an offline merge"), 3273 aHD-> getLocationFull().c_str());3275 aHD->i_getLocationFull().c_str()); 3274 3276 } 3275 3277 } … … 3307 3309 AutoMultiWriteLock2 mLock(&mParent->getMediaTreeLockHandle(), aHD->lockHandle() COMMA_LOCKVAL_SRC_POS); 3308 3310 3309 Assert(aHD-> getChildren().size() == 0);3310 3311 if (aHD-> getParent().isNull())3311 Assert(aHD->i_getChildren().size() == 0); 3312 3313 if (aHD->i_getParent().isNull()) 3312 3314 { 3313 3315 Assert(!aHDLockToken.isNull()); … … 3320 3322 else 3321 3323 { 3322 HRESULT rc = aHD-> unmarkForDeletion();3324 HRESULT rc = aHD->i_unmarkForDeletion(); 3323 3325 AssertComRC(rc); 3324 3326 } … … 3330 3332 // Online merge uses the medium lock list of the VM, so give 3331 3333 // an empty list to cancelMergeTo so that it works as designed. 3332 aSource-> cancelMergeTo(aChildrenToReparent, new MediumLockList());3334 aSource->i_cancelMergeTo(aChildrenToReparent, new MediumLockList()); 3333 3335 3334 3336 // clean up the VM medium lock list ourselves … … 3345 3347 ComObjPtr<Medium> pMedium = it->GetMedium(); 3346 3348 AutoWriteLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS); 3347 if (pMedium-> getState() == MediumState_Deleting)3348 pMedium-> unmarkForDeletion();3349 if (pMedium->i_getState() == MediumState_Deleting) 3350 pMedium->i_unmarkForDeletion(); 3349 3351 else 3350 3352 { 3351 3353 // blindly apply this, only needed for medium objects which 3352 3354 // would be deleted as part of the merge 3353 pMedium-> unmarkLockedForDeletion();3355 pMedium->i_unmarkLockedForDeletion(); 3354 3356 } 3355 3357 mediumLock.release(); … … 3360 3362 else 3361 3363 { 3362 aSource-> cancelMergeTo(aChildrenToReparent, aMediumLockList);3364 aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList); 3363 3365 } 3364 3366 } … … 3367 3369 { 3368 3370 // reattach the source media to the snapshot 3369 HRESULT rc = aSource-> addBackReference(aMachineId, aSnapshotId);3371 HRESULT rc = aSource->i_addBackReference(aMachineId, aSnapshotId); 3370 3372 AssertComRC(rc); 3371 3373 } … … 3512 3514 // then, reparent it and disconnect the deleted branch at 3513 3515 // both ends (chain->parent() is source's parent) 3514 pDeleteRec->mpTarget-> deparent();3515 pDeleteRec->mpTarget-> setParent(pDeleteRec->mpParentForTarget);3516 pDeleteRec->mpTarget->i_deparent(); 3517 pDeleteRec->mpTarget->i_setParent(pDeleteRec->mpParentForTarget); 3516 3518 if (pDeleteRec->mpParentForTarget) 3517 pDeleteRec->mpSource-> deparent();3519 pDeleteRec->mpSource->i_deparent(); 3518 3520 3519 3521 // then, register again … … 3523 3525 else 3524 3526 { 3525 Assert(pDeleteRec->mpTarget-> getChildren().size() == 1);3526 targetChild = pDeleteRec->mpTarget-> getChildren().front();3527 Assert(pDeleteRec->mpTarget->i_getChildren().size() == 1); 3528 targetChild = pDeleteRec->mpTarget->i_getChildren().front(); 3527 3529 3528 3530 // disconnect the deleted branch at the elder end 3529 targetChild-> deparent();3531 targetChild->i_deparent(); 3530 3532 3531 3533 // Update parent UUIDs of the source's children, reparent them and … … 3540 3542 // need manual fixing via VBoxManage to adjust the parent UUID. 3541 3543 treeLock.release(); 3542 pDeleteRec->mpTarget-> fixParentUuidOfChildren(pDeleteRec->mpChildrenToReparent);3544 pDeleteRec->mpTarget->i_fixParentUuidOfChildren(pDeleteRec->mpChildrenToReparent); 3543 3545 // The childen are still write locked, unlock them now and don't 3544 3546 // rely on the destructor doing it very late. … … 3558 3560 AutoWriteLock childLock(pMedium COMMA_LOCKVAL_SRC_POS); 3559 3561 3560 pMedium-> deparent(); // removes pMedium from source3561 pMedium-> setParent(pDeleteRec->mpTarget);3562 pMedium->i_deparent(); // removes pMedium from source 3563 pMedium->i_setParent(pDeleteRec->mpTarget); 3562 3564 } 3563 3565 } … … 3584 3586 /* The target and all images not merged (readonly) are skipped */ 3585 3587 if ( pMedium == pDeleteRec->mpTarget 3586 || pMedium-> getState() == MediumState_LockedRead)3588 || pMedium->i_getState() == MediumState_LockedRead) 3587 3589 { 3588 3590 ++it; … … 3607 3609 if (pMedium == pDeleteRec->mpSource) 3608 3610 { 3609 Assert(pDeleteRec->mpSource-> getChildren().size() == 0);3610 Assert(pDeleteRec->mpSource-> getFirstMachineBackrefId() == NULL);3611 Assert(pDeleteRec->mpSource->i_getChildren().size() == 0); 3612 Assert(pDeleteRec->mpSource->i_getFirstMachineBackrefId() == NULL); 3611 3613 } 3612 3614 -
trunk/src/VBox/Main/src-server/TokenImpl.cpp
r48431 r49795 177 177 if (m.fWrite) 178 178 { 179 HRESULT rc = m.pMedium-> unlockWrite(NULL);179 HRESULT rc = m.pMedium->i_unlockWrite(NULL); 180 180 AssertComRC(rc); 181 181 } 182 182 else 183 183 { 184 HRESULT rc = m.pMedium-> unlockRead(NULL);184 HRESULT rc = m.pMedium->i_unlockRead(NULL); 185 185 AssertComRC(rc); 186 186 } -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r49742 r49795 69 69 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 70 70 #include "EventImpl.h" 71 // #include "VBoxEvents.h" 71 72 #ifdef VBOX_WITH_EXTPACK 72 73 # include "ExtPackManagerImpl.h" … … 2235 2236 int rc = decryptSetting(&strPlaintext, bstrCipher); 2236 2237 if (RT_SUCCESS(rc)) 2237 pMedium-> setPropertyDirect("InitiatorSecret", strPlaintext);2238 pMedium->i_setPropertyDirect("InitiatorSecret", strPlaintext); 2238 2239 else 2239 2240 return rc; … … 2442 2443 { 2443 2444 ComObjPtr<Medium> pMedium = *mt; 2444 pMedium-> dumpBackRefs();2445 pMedium->i_dumpBackRefs(); 2445 2446 } 2446 2447 } … … 2452 2453 { 2453 2454 ComObjPtr<Medium> pMedium = *mt; 2454 pMedium-> dumpBackRefs();2455 pMedium->i_dumpBackRefs(); 2455 2456 } 2456 2457 } … … 3523 3524 AutoWriteLock mlock(pHD COMMA_LOCKVAL_SRC_POS); 3524 3525 3525 Utf8Str strLocationFull = pHD-> getLocationFull();3526 Utf8Str strLocationFull = pHD->i_getLocationFull(); 3526 3527 3527 3528 if (0 == RTPathCompare(strLocationFull.c_str(), strLocation.c_str())) … … 3604 3605 Medium *pMedium = *it; 3605 3606 AutoReadLock imageLock(pMedium COMMA_LOCKVAL_SRC_POS); 3606 const Utf8Str &strLocationFull = pMedium-> getLocationFull();3607 const Utf8Str &strLocationFull = pMedium->i_getLocationFull(); 3607 3608 3608 3609 found = ( aId 3609 && pMedium-> getId() == *aId)3610 && pMedium->i_getId() == *aId) 3610 3611 || ( !aLocation.isEmpty() 3611 3612 && RTPathCompare(location.c_str(), … … 3613 3614 if (found) 3614 3615 { 3615 if (pMedium-> getDeviceType() != mediumType)3616 if (pMedium->i_getDeviceType() != mediumType) 3616 3617 { 3617 3618 if (mediumType == DeviceType_DVD) … … 3927 3928 AutoReadLock mlock(pMediumFound COMMA_LOCKVAL_SRC_POS); 3928 3929 3929 Utf8Str strLocFound = pMediumFound-> getLocationFull();3930 Guid idFound = pMediumFound-> getId();3930 Utf8Str strLocFound = pMediumFound->i_getLocationFull(); 3931 Guid idFound = pMediumFound->i_getId(); 3931 3932 3932 3933 if ( (RTPathCompare(strLocFound.c_str(), aLocation.c_str()) == 0) … … 4033 4034 { 4034 4035 Medium *pMedium = *it; 4035 pMedium-> markRegistriesModified();4036 pMedium->i_markRegistriesModified(); 4036 4037 } 4037 4038 … … 4106 4107 { 4107 4108 const Data::PendingMachineRename &pmr = *it2; 4108 HRESULT rc = pMedium-> updatePath(pmr.strConfigDirOld,4109 pmr.strConfigDirNew);4109 HRESULT rc = pMedium->i_updatePath(pmr.strConfigDirOld, 4110 pmr.strConfigDirNew); 4110 4111 if (SUCCEEDED(rc)) 4111 4112 { … … 4178 4179 AutoReadLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 4179 4180 4180 if (pMedium->i sInRegistry(uuidRegistry))4181 if (pMedium->i_isInRegistry(uuidRegistry)) 4181 4182 { 4182 4183 settings::Medium med; 4183 rc = pMedium-> saveSettings(med, strMachineFolder); // this recurses into child hard disks4184 rc = pMedium->i_saveSettings(med, strMachineFolder); // this recurses into child hard disks 4184 4185 if (FAILED(rc)) throw rc; 4185 4186 llTarget.push_back(med); … … 4404 4405 { 4405 4406 AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS); 4406 id = pMedium-> getId();4407 strLocationFull = pMedium-> getLocationFull();4408 pParent = pMedium-> getParent();4407 id = pMedium->i_getId(); 4408 strLocationFull = pMedium->i_getLocationFull(); 4409 pParent = pMedium->i_getParent(); 4409 4410 } 4410 4411 … … 4478 4479 { 4479 4480 AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS); 4480 id = pMedium-> getId();4481 pParent = pMedium-> getParent();4482 devType = pMedium-> getDeviceType();4481 id = pMedium->i_getId(); 4482 pParent = pMedium->i_getParent(); 4483 devType = pMedium->i_getDeviceType(); 4483 4484 } 4484 4485 … … 4525 4526 // list before their parents 4526 4527 4527 const MediaList &llChildren = pMedium-> getChildren();4528 const MediaList &llChildren = pMedium->i_getChildren(); 4528 4529 for (MediaList::const_iterator it = llChildren.begin(); 4529 4530 it != llChildren.end(); … … 4534 4535 } 4535 4536 4536 Log(("Pushing medium %RTuuid\n", pMedium-> getId().raw()));4537 Log(("Pushing medium %RTuuid\n", pMedium->i_getId().raw())); 4537 4538 llMedia.push_back(pMedium); 4538 4539 } … … 4571 4572 AutoReadLock medlock(pMedium COMMA_LOCKVAL_SRC_POS); 4572 4573 4573 if (pMedium->i sInRegistry(uuidMachine))4574 if (pMedium->i_isInRegistry(uuidMachine)) 4574 4575 // recursively with children first 4575 4576 pushMediumToListWithChildren(llMedia2Close, pMedium); … … 4582 4583 { 4583 4584 ComObjPtr<Medium> pMedium = *it; 4584 Log(("Closing medium %RTuuid\n", pMedium-> getId().raw()));4585 Log(("Closing medium %RTuuid\n", pMedium->i_getId().raw())); 4585 4586 AutoCaller mac(pMedium); 4586 pMedium-> close(mac);4587 pMedium->i_close(mac); 4587 4588 } 4588 4589 … … 4632 4633 AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 4633 4634 4634 if (pMedium-> removeRegistry(id, true /* fRecurse */))4635 if (pMedium->i_removeRegistry(id, true /* fRecurse */)) 4635 4636 { 4636 4637 // machine ID was found in base medium's registry list: 4637 4638 // move this base image and all its children to another registry then 4638 4639 // 1) first, find a better registry to add things to 4639 const Guid *puuidBetter = pMedium-> getAnyMachineBackref();4640 const Guid *puuidBetter = pMedium->i_getAnyMachineBackref(); 4640 4641 if (puuidBetter) 4641 4642 { 4642 4643 // 2) better registry found: then use that 4643 pMedium-> addRegistry(*puuidBetter, true /* fRecurse */);4644 pMedium->i_addRegistry(*puuidBetter, true /* fRecurse */); 4644 4645 // 3) and make sure the registry is saved below 4645 4646 mlock.release(); -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r49742 r49795 113 113 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Snapshot, ISnapshot) 114 114 115 NS_DECL_CLASSINFO(Medium)116 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Medium, IMedium)117 118 115 NS_DECL_CLASSINFO(MediumAttachment) 119 116 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumAttachment, IMediumAttachment)
Note:
See TracChangeset
for help on using the changeset viewer.