Changeset 1874 in vbox for trunk/src/VBox
- Timestamp:
- Apr 3, 2007 11:00:09 AM (18 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r1565 r1874 347 347 N_("VHDD: Configuration error: Querying \"Path\" as string failed")); 348 348 349 rc = CFGMR3QueryBool(pC fgHandle, "ReadOnly", &fReadOnly);349 rc = CFGMR3QueryBool(pCurNode, "ReadOnly", &fReadOnly); 350 350 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 351 351 fReadOnly = false; -
trunk/src/VBox/Main/ConsoleImpl.cpp
r1721 r1874 4869 4869 rc = CFGMR3InsertString(pCur, "Path", psz); RC_CHECK(); 4870 4870 STR_FREE(); 4871 rc = CFGMR3InsertInteger(pCur, "ReadOnly", 1); RC_CHECK(); 4871 4872 4872 4873 /* next */ -
trunk/src/VBox/Main/HardDiskImpl.cpp
r1553 r1874 567 567 * in the first place. 568 568 * 569 * When @a aCheckBusy is true, this method checks that mBusy = false and 570 * mReaders = 0 (and returns an appropriate error if not). This lets 571 * reimplementations successfully call setBusy() to lock the disk for the 572 * duration of the check if they need. Note that in this case, the 573 * reimplementation must enter the object lock before calling this method 574 * and not leave it before calling setBusy() to avoid race condition. 575 * 576 * @param aAccessError On output, a null string indicates the hard disk is 577 * accessible, otherwise contains a message describing 578 * the reason of inaccessibility. 579 * @param aCheckBusy Whether to do the busy check or not. 569 * When @a aCheckBusy is true, this method checks that mBusy = false (and 570 * returns an appropriate error if not). This lets reimplementations 571 * successfully call addReader() after getBaseAccessible() succeeds to 572 * reference the disk and protect it from being modified or deleted before 573 * the remaining check steps are done. Note that in this case, the 574 * reimplementation must enter the object lock before calling this method and 575 * must not leave it before calling addReader() to avoid race condition. 576 * 577 * When @a aCheckReaders is true, this method checks that mReaders = 0 (and 578 * returns an appropriate error if not). When set to true together with 579 * @a aCheckBusy, this lets reimplementations successfully call setBusy() after 580 * getBaseAccessible() succeeds to lock the disk and make sure nobody is 581 * referencing it until the remaining check steps are done. Note that in this 582 * case, the reimplementation must enter the object lock before calling this 583 * method and must not leave it before calling setBusy() to avoid race 584 * condition. 585 * 586 * @param aAccessError On output, a null string indicates the hard disk is 587 * accessible, otherwise contains a message describing 588 * the reason of inaccessibility. 589 * @param aCheckBusy Whether to do the busy check or not. 590 * @param aCheckReaders Whether to do readers check or not. 580 591 */ 581 592 HRESULT HardDisk::getBaseAccessible (Bstr &aAccessError, 582 bool aCheckBusy /* = false */) 593 bool aCheckBusy /* = false */, 594 bool aCheckReaders /* = false */) 583 595 { 584 596 AutoLock alock (this); … … 594 606 tr ("Hard disk '%ls' is being exclusively used by another task"), 595 607 toString().raw()); 608 return S_OK; 596 609 } 597 else if (mReaders > 0) 610 } 611 612 if (aCheckReaders) 613 { 614 if (mReaders > 0) 598 615 { 599 616 aAccessError = Utf8StrFmt ( 600 617 tr ("Hard disk '%ls' is being used by another task (%d readers)"), 601 618 toString().raw(), mReaders); 619 return S_OK; 602 620 } 603 621 } … … 2310 2328 ComAssertRCRet (vrc, E_FAIL); 2311 2329 2312 /* go to Busy stateto prevent any concurrent modifications2330 /* Reference the disk to prevent any concurrent modifications 2313 2331 * after releasing the lock below (to unblock getters before 2314 * a lengthy operation) */2315 setBusy();2332 * a lengthy operation). */ 2333 addReader(); 2316 2334 2317 2335 alock.leave(); … … 2415 2433 alock.enter(); 2416 2434 2417 /* remove the busy flag*/2418 clearBusy();2435 /* remove the reference */ 2436 releaseReader(); 2419 2437 2420 2438 if (FAILED (rc) || VBOX_FAILURE (vrc) || !errMsg.isNull()) … … 3909 3927 ComAssertRCRet (vrc, E_FAIL); 3910 3928 3911 /* go to Busy stateto prevent any concurrent modifications3929 /* Reference the disk to prevent any concurrent modifications 3912 3930 * after releasing the lock below (to unblock getters before 3913 * a lengthy operation) */3914 setBusy();3931 * a lengthy operation). */ 3932 addReader(); 3915 3933 3916 3934 alock.leave(); … … 4020 4038 alock.enter(); 4021 4039 4022 /* remove the busy flag*/4023 clearBusy();4040 /* remove the reference */ 4041 releaseReader(); 4024 4042 4025 4043 if (FAILED (rc) || VBOX_FAILURE (vrc) || !errMsg.isNull()) -
trunk/src/VBox/Main/include/HardDiskImpl.h
r953 r1874 129 129 ComObjPtr <HardDisk> root() const; 130 130 131 HRESULT getBaseAccessible (Bstr &aAccessError, bool aCheckBusy = false); 131 HRESULT getBaseAccessible (Bstr &aAccessError, bool aCheckBusy = false, 132 bool aCheckReaders = false); 132 133 133 134 // virtual methods that need to be [re]implemented by every subclass
Note:
See TracChangeset
for help on using the changeset viewer.