Changeset 7992 in vbox for trunk/src/VBox/Main/HardDiskImpl.cpp
- Timestamp:
- Apr 15, 2008 1:53:12 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 29646
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HardDiskImpl.cpp
r7277 r7992 196 196 return E_POINTER; 197 197 198 Auto Lock alock (this);198 AutoReaderLock alock (this); 199 199 CHECK_READY(); 200 200 … … 208 208 return E_POINTER; 209 209 210 Auto Lock alock (this);210 AutoReaderLock alock (this); 211 211 CHECK_READY(); 212 212 … … 220 220 return E_POINTER; 221 221 222 Auto Lock alock (this);222 AutoReaderLock alock (this); 223 223 CHECK_READY(); 224 224 … … 232 232 return E_POINTER; 233 233 234 Auto Lock alock (this);234 AutoReaderLock alock (this); 235 235 CHECK_READY(); 236 236 … … 274 274 return E_POINTER; 275 275 276 Auto Lock alock (this);276 AutoReaderLock alock (this); 277 277 CHECK_READY(); 278 278 … … 286 286 return E_POINTER; 287 287 288 Auto Lock lock(this);289 CHECK_READY(); 290 291 Auto Lock chLock (childrenLock());288 AutoReaderLock lock(this); 289 CHECK_READY(); 290 291 AutoReaderLock chLock (childrenLock()); 292 292 293 293 ComObjPtr <HardDiskCollection> collection; … … 303 303 return E_POINTER; 304 304 305 Auto Lock lock(this);305 AutoReaderLock lock(this); 306 306 CHECK_READY(); 307 307 … … 368 368 return E_POINTER; 369 369 370 Auto Lock alock (this);370 AutoReaderLock alock (this); 371 371 CHECK_READY(); 372 372 … … 380 380 return E_POINTER; 381 381 382 Auto Lock alock (this);382 AutoReaderLock alock (this); 383 383 CHECK_READY(); 384 384 … … 392 392 return E_POINTER; 393 393 394 Auto Lock alock (this);394 AutoReaderLock alock (this); 395 395 CHECK_READY(); 396 396 … … 600 600 bool aCheckReaders /* = false */) 601 601 { 602 Auto Lock alock (this);602 AutoReaderLock alock (this); 603 603 CHECK_READY(); 604 604 … … 636 636 bool HardDisk::sameAs (HardDisk *that) 637 637 { 638 Auto Lock alock (this);638 AutoReaderLock alock (this); 639 639 if (!isReady()) 640 640 return false; … … 744 744 bool HardDisk::hasForeignChildren() 745 745 { 746 Auto Lock alock (this);746 AutoReaderLock alock (this); 747 747 AssertReturn (isReady(), false); 748 748 … … 750 750 751 751 /* check all children */ 752 Auto Lock chLock (childrenLock());752 AutoReaderLock chLock (childrenLock()); 753 753 for (HardDiskList::const_iterator it = children().begin(); 754 754 it != children().end(); … … 756 756 { 757 757 ComObjPtr <HardDisk> child = *it; 758 Auto Lock childLock (child);758 AutoReaderLock childLock (child); 759 759 if (child->mMachineId != mMachineId) 760 760 return true; … … 779 779 return setError (E_FAIL, errMsg, toString().raw()); 780 780 781 Auto Lock chLock (childrenLock());781 AutoReaderLock chLock (childrenLock()); 782 782 783 783 for (HardDiskList::const_iterator it = children().begin(); … … 814 814 AssertReturn (mBusy == true, (void) 0); 815 815 816 Auto Lock chLock (childrenLock());816 AutoReaderLock chLock (childrenLock()); 817 817 818 818 for (HardDiskList::const_iterator it = children().begin(); … … 831 831 /** 832 832 * Checks that this hard disk and all its direct children are accessible. 833 * 834 * @note Locks this object for writing. 833 835 */ 834 836 HRESULT HardDisk::getAccessibleWithChildren (Bstr &aAccessError) 835 837 { 838 /* getAccessible() needs a write lock */ 836 839 AutoLock alock (this); 837 840 AssertReturn (isReady(), E_FAIL); … … 841 844 return rc; 842 845 843 Auto Lock chLock (childrenLock());846 AutoReaderLock chLock (childrenLock()); 844 847 845 848 for (HardDiskList::const_iterator it = children().begin(); … … 869 872 HRESULT HardDisk::checkConsistency() 870 873 { 871 Auto Lock alock (this);874 AutoReaderLock alock (this); 872 875 AssertReturn (isReady(), E_FAIL); 873 876 … … 886 889 HRESULT rc = S_OK; 887 890 888 Auto Lock chLock (childrenLock());891 AutoReaderLock chLock (childrenLock()); 889 892 890 893 if (mParent.isNull() && mType == HardDiskType_Normal && … … 1022 1025 1023 1026 /* update paths of all children */ 1024 Auto Lock chLock (childrenLock());1027 AutoReaderLock chLock (childrenLock()); 1025 1028 for (HardDiskList::const_iterator it = children().begin(); 1026 1029 it != children().end(); … … 1262 1265 * 1263 1266 * @note 1264 * Must be called from under the object's lock1267 * Must be called from under the object's read lock 1265 1268 */ 1266 1269 HRESULT HardDisk::saveSettings (settings::Key &aHDNode) … … 1293 1296 1294 1297 /* save all children */ 1295 Auto Lock chLock (childrenLock());1298 AutoReaderLock chLock (childrenLock()); 1296 1299 for (HardDiskList::const_iterator it = children().begin(); 1297 1300 it != children().end(); … … 1299 1302 { 1300 1303 ComObjPtr <HardDisk> child = *it; 1301 Auto Lock childLock (child);1304 AutoReaderLock childLock (child); 1302 1305 1303 1306 Key hdNode = aHDNode.appendKey ("DiffHardDisk"); … … 1506 1509 return E_POINTER; 1507 1510 1508 Auto Lock alock (this);1511 AutoReaderLock alock (this); 1509 1512 CHECK_READY(); 1510 1513 … … 1539 1542 return E_POINTER; 1540 1543 1541 Auto Lock alock (this);1544 AutoReaderLock alock (this); 1542 1545 CHECK_READY(); 1543 1546 … … 1555 1558 return E_POINTER; 1556 1559 1557 Auto Lock alock (this);1560 AutoReaderLock alock (this); 1558 1561 CHECK_READY(); 1559 1562 … … 1570 1573 return E_POINTER; 1571 1574 1572 Auto Lock alock (this);1575 AutoReaderLock alock (this); 1573 1576 CHECK_READY(); 1574 1577 … … 1612 1615 return E_POINTER; 1613 1616 1614 Auto Lock alock (this);1617 AutoReaderLock alock (this); 1615 1618 CHECK_READY(); 1616 1619 … … 1708 1711 * accessible, otherwise contains a message describing 1709 1712 * the reason of inaccessibility. 1713 * 1714 * @note Locks this object for writing. 1710 1715 */ 1711 1716 HRESULT HVirtualDiskImage::getAccessible (Bstr &aAccessError) 1712 1717 { 1718 /* queryInformation() needs a write lock */ 1713 1719 AutoLock alock (this); 1714 1720 CHECK_READY(); … … 1767 1773 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 1768 1774 1769 Auto Lock alock (this);1775 AutoReaderLock alock (this); 1770 1776 CHECK_READY(); 1771 1777 … … 1822 1828 * 1823 1829 * @param aShort if true, a short representation is returned 1830 * 1831 * @note Locks this object for reading. 1824 1832 */ 1825 1833 Bstr HVirtualDiskImage::toString (bool aShort /* = false */) 1826 1834 { 1827 Auto Lock alock (this);1835 AutoReaderLock alock (this); 1828 1836 1829 1837 if (!aShort) … … 2119 2127 HRESULT rc = S_OK; 2120 2128 2121 Auto Lock chLock (childrenLock());2129 AutoReaderLock chLock (childrenLock()); 2122 2130 2123 2131 for (HardDiskList::const_iterator it = children().begin(); … … 2388 2396 * @param aAccessError not used when NULL, otherwise see #getAccessible() 2389 2397 * 2390 * @note Must be called from under the object's lock, only after2398 * @note Must be called from under the object's write lock, only after 2391 2399 * CHECK_BUSY_AND_READERS() succeeds. 2392 2400 */ … … 2956 2964 return E_POINTER; 2957 2965 2958 Auto Lock alock (this);2966 AutoReaderLock alock (this); 2959 2967 CHECK_READY(); 2960 2968 … … 2985 2993 return E_POINTER; 2986 2994 2987 Auto Lock alock (this);2995 AutoReaderLock alock (this); 2988 2996 CHECK_READY(); 2989 2997 … … 2997 3005 return E_POINTER; 2998 3006 2999 Auto Lock alock (this);3007 AutoReaderLock alock (this); 3000 3008 CHECK_READY(); 3001 3009 … … 3012 3020 return E_POINTER; 3013 3021 3014 Auto Lock alock (this);3022 AutoReaderLock alock (this); 3015 3023 CHECK_READY(); 3016 3024 … … 3044 3052 return E_POINTER; 3045 3053 3046 Auto Lock alock (this);3054 AutoReaderLock alock (this); 3047 3055 CHECK_READY(); 3048 3056 … … 3073 3081 return E_POINTER; 3074 3082 3075 Auto Lock alock (this);3083 AutoReaderLock alock (this); 3076 3084 CHECK_READY(); 3077 3085 … … 3105 3113 return E_POINTER; 3106 3114 3107 Auto Lock alock (this);3115 AutoReaderLock alock (this); 3108 3116 CHECK_READY(); 3109 3117 … … 3134 3142 return E_POINTER; 3135 3143 3136 Auto Lock alock (this);3144 AutoReaderLock alock (this); 3137 3145 CHECK_READY(); 3138 3146 … … 3163 3171 return E_POINTER; 3164 3172 3165 Auto Lock alock (this);3173 AutoReaderLock alock (this); 3166 3174 CHECK_READY(); 3167 3175 … … 3214 3222 /** 3215 3223 * Checks accessibility of this iSCSI hard disk. 3224 * 3225 * @note Locks this object for writing. 3216 3226 */ 3217 3227 HRESULT HISCSIHardDisk::getAccessible (Bstr &aAccessError) 3218 3228 { 3229 /* queryInformation() needs a write lock */ 3219 3230 AutoLock alock (this); 3220 3231 CHECK_READY(); … … 3240 3251 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 3241 3252 3242 Auto Lock alock (this);3253 AutoReaderLock alock (this); 3243 3254 CHECK_READY(); 3244 3255 … … 3267 3278 * 3268 3279 * @param aShort if true, a short representation is returned 3280 * 3281 * @note Locks this object for reading. 3269 3282 */ 3270 3283 Bstr HISCSIHardDisk::toString (bool aShort /* = false */) 3271 3284 { 3272 Auto Lock alock (this);3285 AutoReaderLock alock (this); 3273 3286 3274 3287 Bstr str; … … 3346 3359 * 3347 3360 * @param aAccessError see #getAccessible() 3348 * @note 3349 * Must be called from under the object's lock! 3361 * 3362 * @note Must be called from under the object's write lock, only after 3363 * CHECK_BUSY_AND_READERS() succeeds. 3350 3364 */ 3351 3365 HRESULT HISCSIHardDisk::queryInformation (Bstr &aAccessError) 3352 3366 { 3367 AssertReturn (isLockedOnCurrentThread(), E_FAIL); 3368 3369 /* create a lock object to completely release it later */ 3370 AutoLock alock (this); 3371 3353 3372 /// @todo (dmik) query info about this iSCSI disk, 3354 3373 // set mSize and mActualSize, … … 3572 3591 return E_POINTER; 3573 3592 3574 Auto Lock alock (this);3593 AutoReaderLock alock (this); 3575 3594 CHECK_READY(); 3576 3595 … … 3609 3628 return E_POINTER; 3610 3629 3611 Auto Lock alock (this);3630 AutoReaderLock alock (this); 3612 3631 CHECK_READY(); 3613 3632 … … 3627 3646 return E_POINTER; 3628 3647 3629 Auto Lock alock (this);3648 AutoReaderLock alock (this); 3630 3649 CHECK_READY(); 3631 3650 … … 3642 3661 return E_POINTER; 3643 3662 3644 Auto Lock alock (this);3663 AutoReaderLock alock (this); 3645 3664 CHECK_READY(); 3646 3665 … … 3684 3703 return E_POINTER; 3685 3704 3686 Auto Lock alock (this);3705 AutoReaderLock alock (this); 3687 3706 CHECK_READY(); 3688 3707 … … 3792 3811 * accessible, otherwise contains a message describing 3793 3812 * the reason of inaccessibility. 3813 * 3814 * @note Locks this object for writing. 3794 3815 */ 3795 3816 HRESULT HVMDKImage::getAccessible (Bstr &aAccessError) 3796 3817 { 3818 /* queryInformation() needs a write lock */ 3797 3819 AutoLock alock (this); 3798 3820 CHECK_READY(); … … 3851 3873 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 3852 3874 3853 Auto Lock alock (this);3875 AutoReaderLock alock (this); 3854 3876 CHECK_READY(); 3855 3877 … … 3906 3928 * 3907 3929 * @param aShort if true, a short representation is returned 3930 * 3931 * @note Locks this object for reading. 3908 3932 */ 3909 3933 Bstr HVMDKImage::toString (bool aShort /* = false */) 3910 3934 { 3911 Auto Lock alock (this);3935 AutoReaderLock alock (this); 3912 3936 3913 3937 if (!aShort) … … 4482 4506 return E_POINTER; 4483 4507 4484 Auto Lock alock (this);4508 AutoReaderLock alock (this); 4485 4509 CHECK_READY(); 4486 4510 … … 4504 4528 return E_POINTER; 4505 4529 4506 Auto Lock alock (this);4530 AutoReaderLock alock (this); 4507 4531 CHECK_READY(); 4508 4532 … … 4516 4540 return E_POINTER; 4517 4541 4518 Auto Lock alock (this);4542 AutoReaderLock alock (this); 4519 4543 CHECK_READY(); 4520 4544 … … 4531 4555 return E_POINTER; 4532 4556 4533 Auto Lock alock (this);4557 AutoReaderLock alock (this); 4534 4558 CHECK_READY(); 4535 4559 … … 4577 4601 return E_POINTER; 4578 4602 4579 Auto Lock alock (this);4603 AutoReaderLock alock (this); 4580 4604 CHECK_READY(); 4581 4605 … … 4589 4613 return E_POINTER; 4590 4614 4591 Auto Lock alock (this);4615 AutoReaderLock alock (this); 4592 4616 CHECK_READY(); 4593 4617 … … 4665 4689 * accessible, otherwise contains a message describing 4666 4690 * the reason of inaccessibility. 4691 * 4692 * @note Locks this object for writing. 4667 4693 */ 4668 4694 HRESULT HCustomHardDisk::getAccessible (Bstr &aAccessError) 4669 4695 { 4696 /* queryInformation() needs a write lock */ 4670 4697 AutoLock alock (this); 4671 4698 CHECK_READY(); … … 4724 4751 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 4725 4752 4726 Auto Lock alock (this);4753 AutoReaderLock alock (this); 4727 4754 CHECK_READY(); 4728 4755 … … 4743 4770 * 4744 4771 * @param aShort if true, a short representation is returned 4772 * 4773 * @note Locks this object for reading. 4745 4774 */ 4746 4775 Bstr HCustomHardDisk::toString (bool aShort /* = false */) 4747 4776 { 4748 Auto Lock alock (this);4777 AutoReaderLock alock (this); 4749 4778 4750 4779 /// @todo currently, we assume that location is always a file path for … … 5270 5299 return E_POINTER; 5271 5300 5272 Auto Lock alock (this);5301 AutoReaderLock alock (this); 5273 5302 CHECK_READY(); 5274 5303 … … 5307 5336 return E_POINTER; 5308 5337 5309 Auto Lock alock (this);5338 AutoReaderLock alock (this); 5310 5339 CHECK_READY(); 5311 5340 … … 5325 5354 return E_POINTER; 5326 5355 5327 Auto Lock alock (this);5356 AutoReaderLock alock (this); 5328 5357 CHECK_READY(); 5329 5358 … … 5340 5369 return E_POINTER; 5341 5370 5342 Auto Lock alock (this);5371 AutoReaderLock alock (this); 5343 5372 CHECK_READY(); 5344 5373 … … 5382 5411 return E_POINTER; 5383 5412 5384 Auto Lock alock (this);5413 AutoReaderLock alock (this); 5385 5414 CHECK_READY(); 5386 5415 … … 5490 5519 * accessible, otherwise contains a message describing 5491 5520 * the reason of inaccessibility. 5521 * 5522 * @note Locks this object for writing. 5492 5523 */ 5493 5524 HRESULT HVHDImage::getAccessible (Bstr &aAccessError) 5494 5525 { 5526 /* queryInformation() needs a write lock */ 5495 5527 AutoLock alock (this); 5496 5528 CHECK_READY(); … … 5548 5580 AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL); 5549 5581 5550 Auto Lock alock (this);5582 AutoReaderLock alock (this); 5551 5583 CHECK_READY(); 5552 5584 … … 5603 5635 * 5604 5636 * @param aShort if true, a short representation is returned 5637 * 5638 * @note Locks this object for reading. 5605 5639 */ 5606 5640 Bstr HVHDImage::toString (bool aShort /* = false */) 5607 5641 { 5608 Auto Lock alock (this);5642 AutoReaderLock alock (this); 5609 5643 5610 5644 if (!aShort)
Note:
See TracChangeset
for help on using the changeset viewer.