Changeset 56820 in vbox
- Timestamp:
- Jul 6, 2015 3:05:40 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101471
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MachineImpl.h
r56788 r56820 594 594 bool aSetError = false); 595 595 596 HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName, 597 MediaData::AttachmentList &aAttachments); 598 596 599 HRESULT i_getUSBControllerByName(const Utf8Str &aName, 597 600 ComObjPtr<USBController> &aUSBController, … … 650 653 bool aSetError = false); 651 654 652 HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName,653 MediaData::AttachmentList &aAttachments);654 655 655 ULONG i_getUSBControllerCountByType(USBControllerType_T enmType); 656 656 … … 687 687 688 688 MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll, 689 IN_BSTRaControllerName,689 const Utf8Str &aControllerName, 690 690 LONG aControllerPort, 691 691 LONG aDevice); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r55401 r56820 6 6 7 7 /* 8 * Copyright (C) 2006-201 3Oracle Corporation8 * Copyright (C) 2006-2015 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 HRESULT init(Machine *aParent, 36 36 Medium *aMedium, 37 const Bstr &aControllerName,37 const Utf8Str &aControllerName, 38 38 LONG aPort, 39 39 LONG aDevice, … … 59 59 60 60 const ComObjPtr<Medium>& i_getMedium() const; 61 const Bstri_getControllerName() const;61 const Utf8Str &i_getControllerName() const; 62 62 LONG i_getPort() const; 63 63 LONG i_getDevice() const; … … 70 70 bool i_getHotPluggable() const; 71 71 72 bool i_matches(CBSTR aControllerName, LONG aPort, LONG aDevice); 72 bool i_matches(const Utf8Str &aControllerName, LONG aPort, LONG aDevice); 73 74 /** Must be called from under this object's write lock. */ 75 void i_updateName(const Utf8Str &aName); 73 76 74 77 /** Must be called from under this object's write lock. */ -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r56788 r56820 9580 9580 AutoReadLock attLock(pAtt COMMA_LOCKVAL_SRC_POS); 9581 9581 9582 if (pAtt->i_getControllerName() == Bstr(aName).raw())9582 if (pAtt->i_getControllerName() == aName) 9583 9583 atts.push_back(pAtt); 9584 9584 } … … 11067 11067 */ 11068 11068 MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll, 11069 IN_BSTRaControllerName,11069 const Utf8Str &aControllerName, 11070 11070 LONG aControllerPort, 11071 11071 LONG aDevice) -
trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
r55401 r56820 53 53 * to the old, uninitialized instance. Changing this requires 54 54 * substantial changes to MediumImpl.cpp. */ 55 const Bstr bstrControllerName;55 const Utf8Str strControllerName; 56 56 /* Same counts for the assigned bandwidth group */ 57 57 Utf8Str strBandwidthGroup; … … 118 118 HRESULT MediumAttachment::init(Machine *aParent, 119 119 Medium *aMedium, 120 const Bstr &aControllerName,120 const Utf8Str &aControllerName, 121 121 LONG aPort, 122 122 LONG aDevice, … … 131 131 { 132 132 LogFlowThisFuncEnter(); 133 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=% ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d aDiscard=%d aHotPluggable=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, aDiscard, aHotPluggable, strBandwidthGroup.c_str()));133 LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%s aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d aDiscard=%d aHotPluggable=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.c_str(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, aDiscard, aHotPluggable, strBandwidthGroup.c_str())); 134 134 135 135 if (aType == DeviceType_HardDisk) … … 147 147 m->bd->pMedium = aMedium; 148 148 unconst(m->bd->strBandwidthGroup) = strBandwidthGroup; 149 unconst(m->bd-> bstrControllerName) = aControllerName;149 unconst(m->bd->strControllerName) = aControllerName; 150 150 unconst(m->bd->lPort) = aPort; 151 151 unconst(m->bd->lDevice) = aDevice; … … 250 250 251 251 /* m->controller is constant during life time, no need to lock */ 252 aController = Utf8Str(m->bd-> bstrControllerName);252 aController = Utf8Str(m->bd->strControllerName); 253 253 254 254 LogFlowThisFuncLeave(); … … 442 442 } 443 443 444 const BstrMediumAttachment::i_getControllerName() const445 { 446 return m->bd-> bstrControllerName;444 const Utf8Str &MediumAttachment::i_getControllerName() const 445 { 446 return m->bd->strControllerName; 447 447 } 448 448 … … 497 497 } 498 498 499 bool MediumAttachment::i_matches( CBSTRaControllerName, LONG aPort, LONG aDevice)500 { 501 return ( aControllerName == m->bd-> bstrControllerName499 bool MediumAttachment::i_matches(const Utf8Str &aControllerName, LONG aPort, LONG aDevice) 500 { 501 return ( aControllerName == m->bd->strControllerName 502 502 && aPort == m->bd->lPort 503 503 && aDevice == m->bd->lDevice); 504 } 505 506 /** Must be called from under this object's write lock. */ 507 void MediumAttachment::i_updateName(const Utf8Str &aName) 508 { 509 Assert(isWriteLockOnCurrentThread()); 510 511 m->bd.backup(); 512 unconst(m->bd->strControllerName) = aName; 504 513 } 505 514 -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r56030 r56820 2689 2689 pOnlineMediumAttachment = 2690 2690 i_findAttachment(mMediaData->mAttachments, 2691 pAttach->i_getControllerName() .raw(),2691 pAttach->i_getControllerName(), 2692 2692 pAttach->i_getPort(), 2693 2693 pAttach->i_getDevice()); -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r56477 r56820 234 234 235 235 unconst(aThat->m->pPeer) = this; 236 m->bd.attach 236 m->bd.attach(aThat->m->bd); 237 237 } 238 238 else … … 241 241 242 242 AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS); 243 m->bd.share 243 m->bd.share(aThat->m->bd); 244 244 } 245 245 … … 331 331 aName.c_str()); 332 332 333 Machine::MediaData::AttachmentList atts; 334 rc = m->pParent->i_getMediumAttachmentsOfController(m->bd->strName, atts); 335 for (Machine::MediaData::AttachmentList::const_iterator it = atts.begin(); 336 it != atts.end(); 337 ++it) 338 { 339 IMediumAttachment *iA = *it; 340 MediumAttachment *pAttach = static_cast<MediumAttachment *>(iA); 341 AutoWriteLock attlock(pAttach COMMA_LOCKVAL_SRC_POS); 342 pAttach->i_updateName(aName); 343 } 344 345 333 346 m->bd.backup(); 334 347 m->bd->strName = aName; … … 419 432 if (!SUCCEEDED(rc)) 420 433 return setError(rc, 421 tr 434 tr("Invalid controller type %d"), 422 435 aControllerType); 423 436 … … 730 743 /* sanity */ 731 744 AutoCaller autoCaller(this); 732 AssertComRCReturnVoid 745 AssertComRCReturnVoid(autoCaller.rc()); 733 746 734 747 /* sanity too */ 735 AutoCaller peerCaller 736 AssertComRCReturnVoid 748 AutoCaller peerCaller(m->pPeer); 749 AssertComRCReturnVoid(peerCaller.rc()); 737 750 738 751 /* lock both for writing since we modify both (m->pPeer is "master" so locked … … 746 759 { 747 760 // attach new data to the peer and reshare it 748 m->pPeer->m->bd.attach 761 m->pPeer->m->bd.attach(m->bd); 749 762 } 750 763 } … … 762 775 /* sanity */ 763 776 AutoCaller autoCaller(this); 764 AssertComRCReturnVoid 777 AssertComRCReturnVoid(autoCaller.rc()); 765 778 766 779 /* sanity too */ 767 AutoCaller peerCaller 768 AssertComRCReturnVoid 780 AutoCaller peerCaller(m->pPeer); 781 AssertComRCReturnVoid(peerCaller.rc()); 769 782 770 783 /* peer is not modified, lock it for reading (m->pPeer is "master" so locked
Note:
See TracChangeset
for help on using the changeset viewer.