Changeset 23394 in vbox for trunk/src/VBox/Main/MediumAttachmentImpl.cpp
- Timestamp:
- Sep 28, 2009 5:24:04 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 52924
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r23269 r23394 32 32 HRESULT MediumAttachment::FinalConstruct() 33 33 { 34 LogFlowThisFunc(("\n")); 34 35 return S_OK; 35 36 } … … 37 38 void MediumAttachment::FinalRelease() 38 39 { 40 LogFlowThisFuncEnter(); 39 41 uninit(); 42 LogFlowThisFuncLeave(); 40 43 } 41 44 … … 46 49 * Initializes the medium attachment object. 47 50 * 48 * @param a MachineMachine object.51 * @param aParent Machine object. 49 52 * @param aMedium Medium object. 50 53 * @param aController Controller the hard disk is attached to. … … 53 56 * @param aImplicit Wether the attachment contains an implicitly created diff. 54 57 */ 55 HRESULT MediumAttachment::init(Machine *a Machine,58 HRESULT MediumAttachment::init(Machine *aParent, 56 59 Medium *aMedium, 57 60 CBSTR aController, … … 61 64 bool aImplicit /*= false*/) 62 65 { 66 LogFlowThisFuncEnter(); 67 LogFlowThisFunc(("aParent=%p aMedium=%p aController=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d\n", aParent, aMedium, aController, aPort, aDevice, aType, aImplicit)); 68 63 69 if (aType == DeviceType_HardDisk) 64 70 AssertReturn(aMedium, E_INVALIDARG); … … 68 74 AssertReturn(autoInitSpan.isOk(), E_FAIL); 69 75 70 unconst(mMachine) = aMachine; 76 unconst(mParent) = aParent; 77 71 78 m.allocate(); 72 79 m->medium = aMedium; … … 82 89 autoInitSpan.setSucceeded(); 83 90 91 LogFlowThisFuncLeave(); 84 92 return S_OK; 85 93 } … … 91 99 void MediumAttachment::uninit() 92 100 { 101 LogFlowThisFuncEnter(); 102 93 103 /* Enclose the state transition Ready->InUninit->NotReady */ 94 104 AutoUninitSpan autoUninitSpan(this); 95 105 if (autoUninitSpan.uninitDone()) 96 106 return; 107 108 m.free(); 109 110 unconst(mParent).setNull(); 111 112 LogFlowThisFuncLeave(); 97 113 } 98 114 … … 102 118 bool MediumAttachment::rollback() 103 119 { 120 LogFlowThisFuncEnter(); 121 104 122 /* sanity */ 105 123 AutoCaller autoCaller(this); … … 118 136 } 119 137 138 LogFlowThisFuncLeave(); 120 139 return changed; 121 140 } … … 126 145 void MediumAttachment::commit() 127 146 { 147 LogFlowThisFuncEnter(); 148 128 149 /* sanity */ 129 150 AutoCaller autoCaller(this); … … 134 155 if (m.isBackedUp()) 135 156 m.commit(); 157 158 LogFlowThisFuncLeave(); 136 159 } 137 160 … … 142 165 STDMETHODIMP MediumAttachment::COMGETTER(Medium)(IMedium **aHardDisk) 143 166 { 167 LogFlowThisFuncEnter(); 168 144 169 CheckComArgOutPointerValid(aHardDisk); 145 170 … … 151 176 m->medium.queryInterfaceTo(aHardDisk); 152 177 178 LogFlowThisFuncLeave(); 153 179 return S_OK; 154 180 } … … 156 182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)(BSTR *aController) 157 183 { 184 LogFlowThisFuncEnter(); 185 158 186 CheckComArgOutPointerValid(aController); 159 187 … … 164 192 m->controller.cloneTo(aController); 165 193 194 LogFlowThisFuncLeave(); 166 195 return S_OK; 167 196 } … … 169 198 STDMETHODIMP MediumAttachment::COMGETTER(Port)(LONG *aPort) 170 199 { 200 LogFlowThisFuncEnter(); 201 171 202 CheckComArgOutPointerValid(aPort); 172 203 … … 177 208 *aPort = m->port; 178 209 210 LogFlowThisFuncLeave(); 179 211 return S_OK; 180 212 } … … 182 214 STDMETHODIMP MediumAttachment::COMGETTER(Device)(LONG *aDevice) 183 215 { 216 LogFlowThisFuncEnter(); 217 184 218 CheckComArgOutPointerValid(aDevice); 185 219 … … 190 224 *aDevice = m->device; 191 225 226 LogFlowThisFuncLeave(); 192 227 return S_OK; 193 228 } … … 195 230 STDMETHODIMP MediumAttachment::COMGETTER(Type)(DeviceType_T *aType) 196 231 { 232 LogFlowThisFuncEnter(); 233 197 234 CheckComArgOutPointerValid(aType); 198 235 … … 203 240 *aType = m->type; 204 241 242 LogFlowThisFuncLeave(); 205 243 return S_OK; 206 244 } … … 208 246 STDMETHODIMP MediumAttachment::COMSETTER(Passthrough)(BOOL aPassthrough) 209 247 { 248 LogFlowThisFuncEnter(); 249 210 250 AutoCaller autoCaller(this); 211 251 CheckComRCReturnRC(autoCaller.rc()); 212 252 213 253 /* the machine need to be mutable */ 214 Machine::AutoMutableStateDependency adep(m Machine);254 Machine::AutoMutableStateDependency adep(mParent); 215 255 CheckComRCReturnRC(adep.rc()); 216 256 … … 223 263 } 224 264 265 LogFlowThisFuncLeave(); 225 266 return S_OK; 226 267 } … … 228 269 STDMETHODIMP MediumAttachment::COMGETTER(Passthrough)(BOOL *aPassthrough) 229 270 { 271 LogFlowThisFuncEnter(); 272 230 273 CheckComArgOutPointerValid(aPassthrough); 231 274 … … 236 279 237 280 *aPassthrough = m->passthrough; 238 return S_OK; 239 } 240 281 282 LogFlowThisFuncLeave(); 283 return S_OK; 284 } 285
Note:
See TracChangeset
for help on using the changeset viewer.