Changeset 23880 in vbox
- Timestamp:
- Oct 19, 2009 5:48:04 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53660
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r23801 r23880 1265 1265 if (attachment.GetMedium().GetId() == aMedium.id()) 1266 1266 { 1267 machine.DetachDevice (attachment.GetController(), attachment.GetPort(), attachment.GetDevice()); 1267 CStorageController controller = attachment.GetController(); 1268 machine.DetachDevice (controller.GetName(), attachment.GetPort(), attachment.GetDevice()); 1268 1269 if (!machine.isOk()) 1269 1270 { 1270 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());1271 1271 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, aMedium.location(), 1272 1272 controller.GetBus(), attachment.GetPort(), attachment.GetDevice()); … … 1288 1288 if (medium.id() == aMedium.id()) 1289 1289 { 1290 machine.MountMedium (attachment.GetController() , attachment.GetPort(), attachment.GetDevice(), QString());1290 machine.MountMedium (attachment.GetController().GetName(), attachment.GetPort(), attachment.GetDevice(), QString()); 1291 1291 if (!machine.isOk()) 1292 1292 { 1293 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());1294 1293 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1295 1294 success = false; … … 1310 1309 if (medium.id() == aMedium.id()) 1311 1310 { 1312 machine.MountMedium (attachment.GetController() , attachment.GetPort(), attachment.GetDevice(), QString());1311 machine.MountMedium (attachment.GetController().GetName(), attachment.GetPort(), attachment.GetDevice(), QString()); 1313 1312 if (!machine.isOk()) 1314 1313 { 1315 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());1316 1314 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1317 1315 success = false; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r23585 r23880 911 911 { 912 912 CMediumAttachment hda = vec [i]; 913 const QString ctlName = hda.GetController(); 914 915 machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice()); 913 CStorageController controller = hda.GetController(); 914 machine.DetachDevice(controller.GetName(), hda.GetPort(), hda.GetDevice()); 916 915 if (!machine.isOk()) 917 916 { 918 CStorageController ctl = machine.GetStorageControllerByName(ctlName);919 917 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, 920 918 vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(), 921 c tl.GetBus(), hda.GetPort(), hda.GetDevice());919 controller.GetBus(), hda.GetPort(), hda.GetDevice()); 922 920 } 923 921 } -
trunk/src/VBox/Main/ApplianceImpl.cpp
r23733 r23880 4446 4446 ComPtr<IMedium> pMedium; 4447 4447 ComPtr<IStorageController> ctl; 4448 Bstr controllerName; 4449 4450 rc = pHDA->COMGETTER(Controller)(controllerName.asOutParam()); 4451 if (FAILED(rc)) throw rc; 4452 4453 rc = GetStorageControllerByName(controllerName, ctl.asOutParam()); 4448 4449 rc = pHDA->COMGETTER(Controller)(ctl.asOutParam()); 4454 4450 if (FAILED(rc)) throw rc; 4455 4451 -
trunk/src/VBox/Main/ConsoleImpl.cpp
r23879 r23880 2705 2705 rc = mMachine->COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(ctrls)); 2706 2706 AssertComRC(rc); 2707 Bstr attCtrlName;2708 rc = aMediumAttachment->COMGETTER(Controller)( attCtrlName.asOutParam());2707 ComPtr<IStorageController> ctrl; 2708 rc = aMediumAttachment->COMGETTER(Controller)(ctrl.asOutParam()); 2709 2709 AssertComRC(rc); 2710 ComPtr<IStorageController> ctrl;2711 for (size_t i = 0; i < ctrls.size(); ++i)2712 {2713 Bstr ctrlName;2714 rc = ctrls[i]->COMGETTER(Name)(ctrlName.asOutParam());2715 AssertComRC(rc);2716 if (attCtrlName == ctrlName)2717 {2718 ctrl = ctrls[i];2719 break;2720 }2721 }2722 if (ctrl.isNull())2723 {2724 return setError(E_FAIL,2725 tr("Could not find storage controller '%ls'"), attCtrlName.raw());2726 }2727 2710 StorageControllerType_T enmCtrlType; 2728 2711 rc = ctrl->COMGETTER(ControllerType)(&enmCtrlType); … … 7226 7209 { 7227 7210 ComPtr<IStorageController> controller; 7228 BSTR controllerName;7229 7211 ULONG lInstance; 7230 7212 StorageControllerType_T enmController; … … 7235 7217 * so we have to query needed values here and pass them. 7236 7218 */ 7237 rc = atts[i]->COMGETTER(Controller)(&controllerName); 7238 if (FAILED(rc)) 7239 break; 7240 7241 rc = that->mMachine->GetStorageControllerByName(controllerName, controller.asOutParam()); 7219 rc = atts[i]->COMGETTER(Controller)(controller.asOutParam()); 7242 7220 if (FAILED(rc)) throw rc; 7243 7244 7221 rc = controller->COMGETTER(ControllerType)(&enmController); 7222 if (FAILED (rc)) throw rc; 7245 7223 rc = controller->COMGETTER(Instance)(&lInstance); 7224 if (FAILED (rc)) throw rc; 7246 7225 7247 7226 /* -
trunk/src/VBox/Main/MachineImpl.cpp
r23879 r23880 2358 2358 * descendant of medium will be used 2359 2359 */ 2360 if ( (*it)->device() == aDevice 2361 && (*it)->port() == aControllerPort 2362 && (*it)->controller() == aControllerName 2363 ) 2360 if (pAttach->matches(aControllerName, aControllerPort, aDevice)) 2364 2361 { 2365 2362 foundIt = it; … … 2436 2433 ComObjPtr<MediumAttachment> attachment; 2437 2434 attachment.createObject(); 2438 rc = attachment->init(this, medium, aControllerName, aControllerPort, aDevice, aType, indirect);2435 rc = attachment->init(this, medium, ctl, aControllerPort, aDevice, aType, indirect); 2439 2436 CheckComRCReturnRC(rc); 2440 2437 … … 3561 3558 ++it) 3562 3559 { 3563 if ( (*it)->controller() == aName)3560 if (Bstr((*it)->controller()->name()) == aName) 3564 3561 return setError(VBOX_E_OBJECT_IN_USE, 3565 3562 tr("Storage controller named '%ls' has still devices attached"), … … 5607 5604 break; 5608 5605 5609 const Bstr controllerName = aStorageController->name();5610 5606 ComObjPtr<MediumAttachment> pAttachment; 5611 5607 pAttachment.createObject(); 5612 5608 rc = pAttachment->init(this, 5613 5609 medium, 5614 controllerName,5610 aStorageController, 5615 5611 dev.lPort, 5616 5612 dev.lDevice, … … 5755 5751 ++it) 5756 5752 { 5757 if ( (*it)->controller() == aName)5753 if (Bstr((*it)->controller()->name()) == aName) 5758 5754 atts.push_back(*it); 5759 5755 } -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r23397 r23880 58 58 HRESULT MediumAttachment::init(Machine *aParent, 59 59 Medium *aMedium, 60 CBSTRaController,60 StorageController *aController, 61 61 LONG aPort, 62 62 LONG aDevice, … … 180 180 } 181 181 182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)( BSTR*aController)182 STDMETHODIMP MediumAttachment::COMGETTER(Controller)(IStorageController **aController) 183 183 { 184 184 LogFlowThisFuncEnter(); … … 190 190 191 191 /* m->controller is constant during life time, no need to lock */ 192 m->controller. cloneTo(aController);192 m->controller.queryInterfaceTo(aController); 193 193 194 194 LogFlowThisFuncLeave(); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r23879 r23880 8363 8363 <interface 8364 8364 name="IMediumAttachment" extends="$unknown" 8365 uuid=" 0dcf987b-a024-453f-bace-7eb9f885a413"8365 uuid="ff554585-560a-489d-963c-cf6da6a826de" 8366 8366 wsmap="struct" 8367 8367 > … … 8384 8384 </attribute> 8385 8385 8386 <attribute name="controller" type="wstring" readonly="yes"> 8387 <desc>Name of the storage controller of this attachment; this 8388 refers to one of the controllers in <link to="IMachine::storageControllers" /> 8389 by name.</desc> 8386 <attribute name="controller" type="IStorageController" readonly="yes"> 8387 <desc>Storage controller object to which this attachment belongs.</desc> 8390 8388 </attribute> 8391 8389 -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r23394 r23880 26 26 27 27 #include "MediumImpl.h" 28 #include "StorageControllerImpl.h" 28 29 29 30 class Machine; … … 53 54 HRESULT init(Machine *aParent, 54 55 Medium *aMedium, 55 CBSTRaController,56 StorageController *aController, 56 57 LONG aPort, 57 58 LONG aDevice, … … 68 69 // IMediumAttachment properties 69 70 STDMETHOD(COMGETTER(Medium))(IMedium **aMedium); 70 STDMETHOD(COMGETTER(Controller))( BSTR*aController);71 STDMETHOD(COMGETTER(Controller))(IStorageController **aController); 71 72 STDMETHOD(COMGETTER(Port))(LONG *aPort); 72 73 STDMETHOD(COMGETTER(Device))(LONG *aDevice); … … 82 83 83 84 const ComObjPtr<Medium> &medium() const { return m->medium; } 84 Bstrcontroller() const { return m->controller; }85 const ComObjPtr<StorageController> &controller() const { return m->controller; } 85 86 LONG port() const { return m->port; } 86 87 LONG device() const { return m->device; } … … 90 91 bool matches(CBSTR aController, LONG aPort, LONG aDevice) 91 92 { 92 return ( aController == m->controller 93 return ( aController == m->controller->name() 93 94 && aPort == m->port 94 95 && aDevice == m->device); … … 124 125 125 126 ComObjPtr<Medium> medium; 126 const Bstrcontroller;127 ComObjPtr<StorageController> controller; 127 128 const LONG port; 128 129 const LONG device;
Note:
See TracChangeset
for help on using the changeset viewer.