Changeset 37768 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 4, 2011 2:49:46 PM (14 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r37709 r37768 9652 9652 9653 9653 /** 9654 * Search for medias which are not attached to any machine, but in the chain to 9655 * an attached disk. Mediums are only consided if they are: 9656 * - have only one child 9657 * - no refereneces to any machines 9658 * - are of normal medium type 9659 * 9660 * This is done recursive and the recursing is stopped if a medium has more the 9661 * one child or there is no parent anymore. 9662 * 9663 * Used in detachAllMedia. 9664 * 9665 * @param pMedium Medium to investigate. 9666 * @param llMedia Caller's list to add a corrosponding media to. 9667 * @return 9668 */ 9669 HRESULT Machine::searchAndAddImplicitParents(ComObjPtr<Medium> pMedium, MediaList &llMedia) const 9670 { 9671 if (!pMedium.isNull()) 9672 { 9673 AutoCaller mac(pMedium); 9674 if (FAILED(mac.rc())) return mac.rc(); 9675 AutoReadLock lock(pMedium COMMA_LOCKVAL_SRC_POS); 9676 MediaList childs = pMedium->getChildren(); 9677 if (childs.size() == 1) 9678 { 9679 if ( pMedium->getMachineBackRefCount() == 0 9680 && pMedium->getType() == MediumType_Normal 9681 && find(llMedia.begin(), llMedia.end(), pMedium) == llMedia.end()) 9682 llMedia.push_back(pMedium); 9683 /* Recurse */ 9684 return searchAndAddImplicitParents(pMedium->getParent(), llMedia); 9685 } 9686 } 9687 return S_OK; 9688 } 9689 9690 /** 9654 9691 * Goes thru all media of the given list and 9655 9692 * … … 9702 9739 || (cleanupMode == CleanupMode_Full) 9703 9740 ) 9741 { 9704 9742 llMedia.push_back(pMedium); 9743 /* not enabled yet 9744 rc = searchAndAddImplicitParents(pMedium->getParent(), llMedia); 9745 if (FAILED(rc)) 9746 return rc; 9747 */ 9748 } 9705 9749 } 9706 9750 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r37625 r37768 3463 3463 3464 3464 return &ref.llSnapshotIds.front(); 3465 } 3466 3467 size_t Medium::getMachineBackRefCount() const 3468 { 3469 return m->backRefs.size(); 3465 3470 } 3466 3471
Note:
See TracChangeset
for help on using the changeset viewer.