Changeset 72703 in vbox for trunk/src/VBox
- Timestamp:
- Jun 27, 2018 3:27:32 PM (7 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r72478 r72703 15186 15186 </attribute> 15187 15187 15188 <attribute name="description" type="wstring" >15188 <attribute name="description" type="wstring" wrap-hint-server="passcaller"> 15189 15189 <desc> 15190 15190 Optional description of the medium. For a newly created medium the value … … 16145 16145 <!-- other methods --> 16146 16146 16147 <method name="setLocation" >16147 <method name="setLocation" wrap-hint-server="passcaller"> 16148 16148 <desc> 16149 16149 Changes the location of this medium. Some medium types may support … … 16307 16307 </method> 16308 16308 16309 <method name="getEncryptionSettings" const="yes" >16309 <method name="getEncryptionSettings" const="yes" wrap-hint-server="passcaller"> 16310 16310 <desc> 16311 16311 Returns the encryption settings for this medium. -
trunk/src/VBox/Main/include/MediumImpl.h
r69500 r72703 230 230 // wrapped IMedium properties 231 231 HRESULT getId(com::Guid &aId); 232 HRESULT getDescription( com::Utf8Str &aDescription);233 HRESULT setDescription( const com::Utf8Str &aDescription);232 HRESULT getDescription(AutoCaller &autoCaller, com::Utf8Str &aDescription); 233 HRESULT setDescription(AutoCaller &autoCaller, const com::Utf8Str &aDescription); 234 234 HRESULT getState(MediumState_T *aState); 235 235 HRESULT getVariant(std::vector<MediumVariant_T> &aVariant); … … 293 293 const std::vector<MediumVariant_T> &aVariant, 294 294 ComPtr<IProgress> &aProgress); 295 HRESULT setLocation(const com::Utf8Str &aLocation, 295 HRESULT setLocation(AutoCaller &autoCaller, 296 const com::Utf8Str &aLocation, 296 297 ComPtr<IProgress> &aProgress); 297 298 HRESULT compact(ComPtr<IProgress> &aProgress); … … 302 303 const com::Utf8Str &aNewPassword, const com::Utf8Str &aNewPasswordId, 303 304 ComPtr<IProgress> &aProgress); 304 HRESULT getEncryptionSettings( com::Utf8Str &aCipher, com::Utf8Str &aPasswordId);305 HRESULT getEncryptionSettings(AutoCaller &autoCaller, com::Utf8Str &aCipher, com::Utf8Str &aPasswordId); 305 306 HRESULT checkEncryptionPassword(const com::Utf8Str &aPassword); 306 307 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r71097 r72703 1607 1607 } 1608 1608 1609 HRESULT Medium::getDescription(com::Utf8Str &aDescription) 1610 { 1609 HRESULT Medium::getDescription(AutoCaller &autoCaller, com::Utf8Str &aDescription) 1610 { 1611 NOREF(autoCaller); 1611 1612 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1612 1613 … … 1616 1617 } 1617 1618 1618 HRESULT Medium::setDescription( const com::Utf8Str &aDescription)1619 HRESULT Medium::setDescription(AutoCaller &autoCaller, const com::Utf8Str &aDescription) 1619 1620 { 1620 1621 /// @todo update m->strDescription and save the global registry (and local … … 1628 1629 try 1629 1630 { 1631 autoCaller.release(); 1632 1630 1633 // locking: we need the tree lock first because we access parent pointers 1631 1634 // and we need to write-lock the media involved 1632 uint32_t cHandles = 2; 1633 LockHandle* pHandles[2] = { &m->pVirtualBox->i_getMediaTreeLockHandle(), 1634 this->lockHandle() }; 1635 1636 AutoWriteLock alock(cHandles, 1637 pHandles 1638 COMMA_LOCKVAL_SRC_POS); 1635 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1636 1637 autoCaller.add(); 1638 AssertComRCThrowRC(autoCaller.rc()); 1639 1640 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1639 1641 1640 1642 /* Build the lock list. */ 1641 1643 alock.release(); 1644 autoCaller.release(); 1645 treeLock.release(); 1642 1646 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 1643 1647 this /* pToLockWrite */, … … 1645 1649 NULL, 1646 1650 *pMediumLockList); 1651 treeLock.acquire(); 1652 autoCaller.add(); 1653 AssertComRCThrowRC(autoCaller.rc()); 1647 1654 alock.acquire(); 1648 1655 … … 1655 1662 1656 1663 alock.release(); 1664 autoCaller.release(); 1665 treeLock.release(); 1657 1666 rc = pMediumLockList->Lock(); 1667 treeLock.acquire(); 1668 autoCaller.add(); 1669 AssertComRCThrowRC(autoCaller.rc()); 1658 1670 alock.acquire(); 1659 1671 … … 1673 1685 // save the settings 1674 1686 alock.release(); 1687 autoCaller.release(); 1688 treeLock.release(); 1675 1689 i_markRegistriesModified(); 1676 1690 m->pVirtualBox->i_saveModifiedRegistries(); … … 1906 1920 // save the settings 1907 1921 mlock.release(); 1922 autoCaller.release(); 1908 1923 treeLock.release(); 1909 1924 i_markRegistriesModified(); … … 2638 2653 ComPtr<IProgress> &aProgress) 2639 2654 { 2640 /** @todo r=klaus The code below needs to be double checked with regard2641 * to lock order violations, it probably causes lock order issues related2642 * to the AutoCaller usage. */2643 2655 IMedium *aT = aTarget; 2644 2656 ComObjPtr<Medium> diff = static_cast<Medium*>(aT); … … 2656 2668 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2657 2669 2658 AutoMultiWriteLock2 alock(this ->lockHandle(), diff->lockHandle()COMMA_LOCKVAL_SRC_POS);2670 AutoMultiWriteLock2 alock(this, diff COMMA_LOCKVAL_SRC_POS); 2659 2671 2660 2672 if (m->type == MediumType_Writethrough) … … 2674 2686 MediumLockList *pMediumLockList(new MediumLockList()); 2675 2687 alock.release(); 2688 autoCaller.release(); 2676 2689 treeLock.release(); 2677 2690 HRESULT rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, … … 2681 2694 *pMediumLockList); 2682 2695 treeLock.acquire(); 2696 autoCaller.add(); 2697 if (FAILED(autoCaller.rc())) 2698 rc = autoCaller.rc(); 2683 2699 alock.acquire(); 2684 2700 if (FAILED(rc)) … … 2689 2705 2690 2706 alock.release(); 2707 autoCaller.release(); 2691 2708 treeLock.release(); 2692 2709 rc = pMediumLockList->Lock(); 2693 2710 treeLock.acquire(); 2711 autoCaller.add(); 2712 if (FAILED(autoCaller.rc())) 2713 rc = autoCaller.rc(); 2694 2714 alock.acquire(); 2695 2715 if (FAILED(rc)) … … 2707 2727 diff->m->llRegistryIDs.push_back(parentMachineRegistry); 2708 2728 alock.release(); 2729 autoCaller.release(); 2709 2730 treeLock.release(); 2710 2731 diff->i_markRegistriesModified(); 2711 2732 treeLock.acquire(); 2733 autoCaller.add(); 2712 2734 alock.acquire(); 2713 2735 } 2714 2736 2715 2737 alock.release(); 2738 autoCaller.release(); 2716 2739 treeLock.release(); 2717 2740 … … 2739 2762 ComPtr<IProgress> &aProgress) 2740 2763 { 2741 2742 /** @todo r=klaus The code below needs to be double checked with regard2743 * to lock order violations, it probably causes lock order issues related2744 * to the AutoCaller usage. */2745 2764 IMedium *aT = aTarget; 2746 2765 … … 2926 2945 } 2927 2946 2928 HRESULT Medium::setLocation(const com::Utf8Str &aLocation, ComPtr<IProgress> &aProgress) 2929 { 2930 2947 HRESULT Medium::setLocation(AutoCaller &autoCaller, const com::Utf8Str &aLocation, ComPtr<IProgress> &aProgress) 2948 { 2931 2949 ComObjPtr<Medium> pParent; 2932 2950 ComObjPtr<Progress> pProgress; … … 2945 2963 /// this medium), this will also require to add the mRegistered flag to data 2946 2964 2965 autoCaller.release(); 2966 2947 2967 // locking: we need the tree lock first because we access parent pointers 2948 2968 // and we need to write-lock the media involved 2949 uint32_t cHandles = 2; 2950 LockHandle* pHandles[2] = { &m->pVirtualBox->i_getMediaTreeLockHandle(), 2951 this->lockHandle() }; 2952 2953 AutoWriteLock alock(cHandles, 2954 pHandles 2955 COMMA_LOCKVAL_SRC_POS); 2969 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 2970 2971 autoCaller.add(); 2972 AssertComRCThrowRC(autoCaller.rc()); 2973 2974 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2956 2975 2957 2976 /* play with locations */ … … 3096 3115 3097 3116 alock.release(); 3117 autoCaller.release(); 3118 treeLock.release(); 3098 3119 rc = m->pVirtualBox->i_findMachine(id, false, true, &aMachine); 3120 treeLock.acquire(); 3121 autoCaller.add(); 3122 AssertComRCThrowRC(autoCaller.rc()); 3099 3123 alock.acquire(); 3100 3124 … … 3105 3129 3106 3130 alock.release(); 3131 autoCaller.release(); 3132 treeLock.release(); 3107 3133 bool ses = aMachine->i_isSessionOpenVM(sm, &ctl); 3134 treeLock.acquire(); 3135 autoCaller.add(); 3136 AssertComRCThrowRC(autoCaller.rc()); 3108 3137 alock.acquire(); 3109 3138 … … 3123 3152 MediumLockList *pMediumLockList(new MediumLockList()); 3124 3153 alock.release(); 3154 autoCaller.release(); 3155 treeLock.release(); 3125 3156 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 3126 3157 this /* pToLockWrite */, … … 3128 3159 NULL, 3129 3160 *pMediumLockList); 3161 treeLock.acquire(); 3162 autoCaller.add(); 3163 AssertComRCThrowRC(autoCaller.rc()); 3130 3164 alock.acquire(); 3131 3165 if (FAILED(rc)) … … 3137 3171 } 3138 3172 alock.release(); 3173 autoCaller.release(); 3174 treeLock.release(); 3139 3175 rc = pMediumLockList->Lock(); 3176 treeLock.acquire(); 3177 autoCaller.add(); 3178 AssertComRCThrowRC(autoCaller.rc()); 3140 3179 alock.acquire(); 3141 3180 if (FAILED(rc)) … … 3551 3590 } 3552 3591 3553 HRESULT Medium::getEncryptionSettings( com::Utf8Str &aCipher, com::Utf8Str &aPasswordId)3592 HRESULT Medium::getEncryptionSettings(AutoCaller &autoCaller, com::Utf8Str &aCipher, com::Utf8Str &aPasswordId) 3554 3593 { 3555 3594 #ifndef VBOX_WITH_EXTPACK … … 3560 3599 try 3561 3600 { 3601 autoCaller.release(); 3562 3602 ComObjPtr<Medium> pBase = i_getBase(); 3603 autoCaller.add(); 3604 if (FAILED(autoCaller.rc())) 3605 throw rc; 3563 3606 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3564 3607 … … 4997 5040 bool aWait) 4998 5041 { 4999 /** @todo r=klaus The code below needs to be double checked with regard5000 * to lock order violations, it probably causes lock order issues related5001 * to the AutoCaller usage. */5002 5042 AssertReturn(aProgress != NULL || aWait == true, E_FAIL); 5003 5004 AutoCaller autoCaller(this);5005 if (FAILED(autoCaller.rc())) return autoCaller.rc();5006 5043 5007 5044 HRESULT rc = S_OK; … … 5012 5049 { 5013 5050 /* we're accessing the media tree, and canClose() needs it too */ 5014 AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(), 5015 this->lockHandle() 5016 COMMA_LOCKVAL_SRC_POS); 5051 AutoWriteLock treelock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5052 5053 AutoCaller autoCaller(this); 5054 AssertComRCThrowRC(autoCaller.rc()); 5055 5056 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5057 5017 5058 LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, i_getLocationFull().c_str() )); 5018 5059 … … 5030 5071 while (m->queryInfoRunning) 5031 5072 { 5032 multilock.release(); 5073 alock.release(); 5074 autoCaller.release(); 5075 treelock.release(); 5033 5076 /* Must not hold the media tree lock or the object lock, as 5034 5077 * Medium::i_queryInfo needs this lock and thus we would run … … 5039 5082 AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS); 5040 5083 } 5041 multilock.acquire(); 5084 treelock.acquire(); 5085 autoCaller.add(); 5086 AssertComRCThrowRC(autoCaller.rc()); 5087 alock.acquire(); 5042 5088 } 5043 5089 } … … 5097 5143 /* Build the medium lock list. */ 5098 5144 MediumLockList *pMediumLockList(new MediumLockList()); 5099 multilock.release(); 5145 alock.release(); 5146 autoCaller.release(); 5147 treelock.release(); 5100 5148 rc = i_createMediumLockList(true /* fFailIfInaccessible */, 5101 5149 this /* pToLockWrite */, … … 5103 5151 NULL, 5104 5152 *pMediumLockList); 5105 multilock.acquire(); 5153 treelock.acquire(); 5154 autoCaller.add(); 5155 AssertComRCThrowRC(autoCaller.rc()); 5156 alock.acquire(); 5106 5157 if (FAILED(rc)) 5107 5158 { … … 5110 5161 } 5111 5162 5112 multilock.release(); 5163 alock.release(); 5164 autoCaller.release(); 5165 treelock.release(); 5113 5166 rc = pMediumLockList->Lock(); 5114 multilock.acquire(); 5167 treelock.acquire(); 5168 autoCaller.add(); 5169 AssertComRCThrowRC(autoCaller.rc()); 5170 alock.acquire(); 5115 5171 if (FAILED(rc)) 5116 5172 { … … 5129 5185 throw rc; 5130 5186 // no longer need lock 5131 multilock.release(); 5187 alock.release(); 5188 autoCaller.release(); 5189 treelock.release(); 5132 5190 i_markRegistriesModified(); 5133 5191 … … 5286 5344 bool &fMergeForward) 5287 5345 { 5288 /** @todo r=klaus The code below needs to be double checked with regard5289 * to lock order violations, it probably causes lock order issues related5290 * to the AutoCaller usage. Likewise the code using this method seems5291 * problematic. */5292 5346 AssertReturn(pOther != NULL, E_FAIL); 5293 5347 AssertReturn(pOther != this, E_FAIL); 5294 5348 5295 AutoCaller autoCaller(this);5296 AssertComRCReturnRC(autoCaller.rc());5297 5298 AutoCaller otherCaller(pOther);5299 AssertComRCReturnRC(otherCaller.rc());5300 5301 5349 HRESULT rc = S_OK; 5302 5350 bool fThisParent = false; /**<< Flag whether this medium is the parent of pOther. */ … … 5306 5354 // locking: we need the tree lock first because we access parent pointers 5307 5355 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5356 5357 AutoCaller autoCaller(this); 5358 AssertComRCThrowRC(autoCaller.rc()); 5359 5360 AutoCaller otherCaller(pOther); 5361 AssertComRCThrowRC(otherCaller.rc()); 5308 5362 5309 5363 /* more sanity checking and figuring out the current merge direction */ … … 5415 5469 MediumLockList * &aMediumLockList) 5416 5470 { 5417 /** @todo r=klaus The code below needs to be double checked with regard5418 * to lock order violations, it probably causes lock order issues related5419 * to the AutoCaller usage. Likewise the code using this method seems5420 * problematic. */5421 5471 AssertReturn(pTarget != NULL, E_FAIL); 5422 5472 AssertReturn(pTarget != this, E_FAIL); 5423 5424 AutoCaller autoCaller(this);5425 AssertComRCReturnRC(autoCaller.rc());5426 5427 AutoCaller targetCaller(pTarget);5428 AssertComRCReturnRC(targetCaller.rc());5429 5473 5430 5474 HRESULT rc = S_OK; … … 5441 5485 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5442 5486 5487 AutoCaller autoCaller(this); 5488 AssertComRCThrowRC(autoCaller.rc()); 5489 5490 AutoCaller targetCaller(pTarget); 5491 AssertComRCThrowRC(targetCaller.rc()); 5492 5443 5493 /* more sanity checking and figuring out the merge direction */ 5444 5494 ComObjPtr<Medium> pMedium = i_getParent(); … … 5471 5521 /* Build the lock list. */ 5472 5522 aMediumLockList = new MediumLockList(); 5523 targetCaller.release(); 5524 autoCaller.release(); 5473 5525 treeLock.release(); 5474 5526 if (fMergeForward) … … 5485 5537 *aMediumLockList); 5486 5538 treeLock.acquire(); 5539 autoCaller.add(); 5540 AssertComRCThrowRC(autoCaller.rc()); 5541 targetCaller.add(); 5542 AssertComRCThrowRC(targetCaller.rc()); 5487 5543 if (FAILED(rc)) 5488 5544 throw rc; … … 5627 5683 if (fLockMedia && aChildrenToReparent) 5628 5684 { 5685 targetCaller.release(); 5686 autoCaller.release(); 5629 5687 treeLock.release(); 5630 5688 rc = aChildrenToReparent->Lock(); 5631 5689 treeLock.acquire(); 5690 autoCaller.add(); 5691 AssertComRCThrowRC(autoCaller.rc()); 5692 targetCaller.add(); 5693 AssertComRCThrowRC(targetCaller.rc()); 5632 5694 if (FAILED(rc)) 5633 5695 throw rc; … … 5674 5736 if (fLockMedia) 5675 5737 { 5738 targetCaller.release(); 5739 autoCaller.release(); 5676 5740 treeLock.release(); 5677 5741 rc = aMediumLockList->Lock(); 5678 5742 treeLock.acquire(); 5743 autoCaller.add(); 5744 AssertComRCThrowRC(autoCaller.rc()); 5745 targetCaller.add(); 5746 AssertComRCThrowRC(targetCaller.rc()); 5679 5747 if (FAILED(rc)) 5680 5748 { … … 5795 5863 5796 5864 AutoCaller autoCaller(this); 5797 if (FAILED(autoCaller.rc())) return autoCaller.rc();5865 AssertComRCReturnRC(autoCaller.rc()); 5798 5866 5799 5867 AutoCaller targetCaller(pTarget);
Note:
See TracChangeset
for help on using the changeset viewer.