VirtualBox

Changeset 37780 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Jul 5, 2011 12:55:13 PM (13 years ago)
Author:
vboxsync
Message:

Storage/DrvHostBase: add generic unmount implementation, so that host floppy unmount works
Main/Console: fix swapped error messages for medium change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r37601 r37780  
    466466static DECLCALLBACK(int) drvHostBaseUnmount(PPDMIMOUNT pInterface, bool fForce, bool fEject)
    467467{
    468      LogFlow(("drvHostBaseUnmount: returns VERR_NOT_SUPPORTED\n"));
    469      return VERR_NOT_SUPPORTED;
     468    /* While we're not mountable (see drvHostBaseMount), we're unmountable. */
     469    PDRVHOSTBASE pThis = PDMIMOUNT_2_DRVHOSTBASE(pInterface);
     470    RTCritSectEnter(&pThis->CritSect);
     471
     472    /*
     473     * Validate state.
     474     */
     475    int rc = VINF_SUCCESS;
     476    if (!pThis->fLocked || fForce)
     477    {
     478        /* Unlock drive if necessary. */
     479        if (pThis->fLocked)
     480        {
     481            if (pThis->pfnDoLock)
     482                rc = pThis->pfnDoLock(pThis, false);
     483            if (RT_SUCCESS(rc))
     484                pThis->fLocked = false;
     485        }
     486
     487        /*
     488         * Media is no longer present.
     489         */
     490        DRVHostBaseMediaNotPresent(pThis);
     491    }
     492    else
     493    {
     494        Log(("drvHostiBaseUnmount: Locked\n"));
     495        rc = VERR_PDM_MEDIA_LOCKED;
     496    }
     497
     498    RTCritSectLeave(&pThis->CritSect);
     499    LogFlow(("drvHostBaseUnmount: returns %Rrc\n", rc));
     500    return rc;
    470501}
    471502
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette