Changeset 24511 in vbox for trunk/src/VBox
- Timestamp:
- Nov 9, 2009 3:27:28 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54606
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r24501 r24511 2171 2171 Assert (mediumType != VBoxDefs::MediumType_Invalid); 2172 2172 2173 const CMediumAttachmentVector &attachments = mSession.GetMachine().GetMediumAttachments(); 2173 CMachine machine = mSession.GetMachine(); 2174 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 2174 2175 foreach (const CMediumAttachment &attachment, attachments) 2175 2176 { 2176 CStorageController controller = attachment.GetController();2177 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 2177 2178 if ( !controller.isNull() 2178 2179 && (attachment.GetType() == deviceType)) -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r24493 r24511 1179 1179 if (attachment.GetMedium().GetId() == aMedium.id()) 1180 1180 { 1181 CStorageController controller = attachment.GetController(); 1182 machine.DetachDevice (controller.GetName(), attachment.GetPort(), attachment.GetDevice()); 1181 machine.DetachDevice (attachment.GetController(), attachment.GetPort(), attachment.GetDevice()); 1183 1182 if (!machine.isOk()) 1184 1183 { 1184 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1185 1185 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, aMedium.location(), 1186 1186 controller.GetBus(), attachment.GetPort(), attachment.GetDevice()); … … 1202 1202 if (medium.id() == aMedium.id()) 1203 1203 { 1204 machine.MountMedium (attachment.GetController() .GetName(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);1204 machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */); 1205 1205 if (!machine.isOk()) 1206 1206 { 1207 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1207 1208 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1208 1209 success = false; … … 1223 1224 if (medium.id() == aMedium.id()) 1224 1225 { 1225 machine.MountMedium (attachment.GetController() .GetName(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */);1226 machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString(""), false /* force */); 1226 1227 if (!machine.isOk()) 1227 1228 { 1229 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1228 1230 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1229 1231 success = false; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r24301 r24511 911 911 { 912 912 CMediumAttachment hda = vec [i]; 913 CStorageController controller = hda.GetController(); 914 machine.DetachDevice(controller.GetName(), hda.GetPort(), hda.GetDevice()); 913 const QString ctlName = hda.GetController(); 914 915 machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice()); 915 916 if (!machine.isOk()) 916 917 { 918 CStorageController ctl = machine.GetStorageControllerByName(ctlName); 917 919 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, 918 920 vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(), 919 c ontroller.GetBus(), hda.GetPort(), hda.GetDevice());921 ctl.GetBus(), hda.GetPort(), hda.GetDevice()); 920 922 } 921 923 } -
trunk/src/VBox/Main/ApplianceImpl.cpp
r24494 r24511 4446 4446 ComPtr<IMedium> pMedium; 4447 4447 ComPtr<IStorageController> ctl; 4448 4449 rc = pHDA->COMGETTER(Controller)(ctl.asOutParam()); 4448 Bstr controllerName; 4449 4450 rc = pHDA->COMGETTER(Controller)(controllerName.asOutParam()); 4451 if (FAILED(rc)) throw rc; 4452 4453 rc = GetStorageControllerByName(controllerName, ctl.asOutParam()); 4450 4454 if (FAILED(rc)) throw rc; 4451 4455 -
trunk/src/VBox/Main/ConsoleImpl.cpp
r24493 r24511 2769 2769 rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls)); 2770 2770 AssertComRC(rc); 2771 Bstr attCtrlName; 2772 rc = aMediumAttachment->COMGETTER(Controller)(attCtrlName.asOutParam()); 2773 AssertComRC(rc); 2771 2774 ComPtr<IStorageController> ctrl; 2772 rc = aMediumAttachment->COMGETTER(Controller)(ctrl.asOutParam()); 2773 AssertComRC(rc); 2775 for (size_t i = 0; i < ctrls.size(); ++i) 2776 { 2777 Bstr ctrlName; 2778 rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam()); 2779 AssertComRC(rc); 2780 if (attCtrlName == ctrlName) 2781 { 2782 ctrl = ctrls[i]; 2783 break; 2784 } 2785 } 2786 if (ctrl.isNull()) 2787 { 2788 return setError(E_FAIL, 2789 tr("Could not find storage controller '%ls'"), attCtrlName.raw()); 2790 } 2774 2791 StorageControllerType_T enmCtrlType; 2775 2792 rc = ctrl->COMGETTER(ControllerType)(&enmCtrlType); … … 7321 7338 { 7322 7339 ComPtr<IStorageController> controller; 7340 BSTR controllerName; 7323 7341 ULONG lInstance; 7324 7342 StorageControllerType_T enmController; … … 7329 7347 * so we have to query needed values here and pass them. 7330 7348 */ 7331 rc = atts[i]->COMGETTER(Controller)(controller.asOutParam()); 7349 rc = atts[i]->COMGETTER(Controller)(&controllerName); 7350 if (FAILED(rc)) 7351 break; 7352 7353 rc = that->mMachine->GetStorageControllerByName(controllerName, controller.asOutParam()); 7332 7354 if (FAILED(rc)) throw rc; 7355 7333 7356 rc = controller->COMGETTER(ControllerType)(&enmController); 7334 if (FAILED (rc)) throw rc;7335 7357 rc = controller->COMGETTER(Instance)(&lInstance); 7336 if (FAILED (rc)) throw rc;7337 7358 7338 7359 /* -
trunk/src/VBox/Main/MachineImpl.cpp
r24493 r24511 2584 2584 * descendant of medium will be used 2585 2585 */ 2586 if (pAttach->matches(aControllerName, aControllerPort, aDevice)) 2586 if ( (*it)->device() == aDevice 2587 && (*it)->port() == aControllerPort 2588 && (*it)->controllerName() == aControllerName 2589 ) 2587 2590 { 2588 2591 foundIt = it; … … 3872 3875 ++it) 3873 3876 { 3874 if ( Bstr((*it)->controllerName()) == aName)3877 if ((*it)->controllerName() == aName) 3875 3878 return setError(VBOX_E_OBJECT_IN_USE, 3876 3879 tr("Storage controller named '%ls' has still devices attached"), … … 6040 6043 break; 6041 6044 6045 const Bstr controllerName = aStorageController->name(); 6042 6046 ComObjPtr<MediumAttachment> pAttachment; 6043 6047 pAttachment.createObject(); 6044 6048 rc = pAttachment->init(this, 6045 6049 medium, 6046 aStorageController->name(),6050 controllerName, 6047 6051 dev.lPort, 6048 6052 dev.lDevice, … … 6188 6192 ++it) 6189 6193 { 6190 if ( Bstr((*it)->controllerName()) == aName)6194 if ((*it)->controllerName() == aName) 6191 6195 atts.push_back(*it); 6192 6196 } -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r24401 r24511 180 180 } 181 181 182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)( IStorageController **aController)182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)(BSTR *aController) 183 183 { 184 184 LogFlowThisFuncEnter(); … … 190 190 191 191 /* m->controller is constant during life time, no need to lock */ 192 /** @todo ugly hack, MediumAttachment should have a direct reference 193 * to the storage controller, but can't have that right now due to 194 * how objects are created for settings rollback support. */ 195 HRESULT rc = E_FAIL; 196 197 if (mParent) 198 rc = mParent->GetStorageControllerByName(m->controllerName, aController); 199 200 LogFlowThisFuncLeave(); 201 return rc; 192 m->controllerName.cloneTo(aController); 193 194 LogFlowThisFuncLeave(); 195 return S_OK; 202 196 } 203 197 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r24493 r24511 8780 8780 <interface 8781 8781 name="IMediumAttachment" extends="$unknown" 8782 uuid=" 7bb6ac41-8c03-4863-9eea-d9c76561b8d1"8782 uuid="e58eb3eb-8627-428b-bdf8-34487c848de5" 8783 8783 wsmap="struct" 8784 8784 > … … 8800 8800 </attribute> 8801 8801 8802 <attribute name="controller" type="IStorageController" readonly="yes"> 8803 <desc>Storage controller object to which this attachment belongs.</desc> 8802 <attribute name="controller" type="wstring" readonly="yes"> 8803 <desc>Name of the storage controller of this attachment; this 8804 refers to one of the controllers in <link to="IMachine::storageControllers" /> 8805 by name.</desc> 8804 8806 </attribute> 8805 8807 -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r24160 r24511 26 26 27 27 #include "MediumImpl.h" 28 #include "StorageControllerImpl.h"29 28 30 29 class Machine; … … 69 68 // IMediumAttachment properties 70 69 STDMETHOD(COMGETTER(Medium))(IMedium **aMedium); 71 STDMETHOD(COMGETTER(Controller))( IStorageController **aController);70 STDMETHOD(COMGETTER(Controller))(BSTR *aController); 72 71 STDMETHOD(COMGETTER(Port))(LONG *aPort); 73 72 STDMETHOD(COMGETTER(Device))(LONG *aDevice); … … 136 135 * to the old, uninitialized instance. Changing this requires 137 136 * substantial changes to MediumImpl.cpp. */ 138 Bstr controllerName;137 const Bstr controllerName; 139 138 const LONG port; 140 139 const LONG device;
Note:
See TracChangeset
for help on using the changeset viewer.