VirtualBox

Changeset 43693 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Oct 22, 2012 9:34:18 AM (12 years ago)
Author:
vboxsync
Message:

VSCSI: Added support for media locking/unlocking.

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

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

    r43640 r43693  
    246246}
    247247
     248static DECLCALLBACK(int) drvscsiSetLock(VSCSILUN hVScsiLun, void *pvScsiLunUser, bool fLocked)
     249{
     250    PDRVSCSI pThis = (PDRVSCSI)pvScsiLunUser;
     251
     252    if (fLocked)
     253        pThis->pDrvMount->pfnLock(pThis->pDrvMount);
     254    else
     255        pThis->pDrvMount->pfnUnlock(pThis->pDrvMount);
     256
     257    return VINF_SUCCESS;
     258}
     259
    248260static int drvscsiTransferCompleteNotify(PPDMIBLOCKASYNCPORT pInterface, void *pvUser, int rc)
    249261{
     
    961973    pThis->VScsiIoCallbacks.pfnVScsiLunReqTransferEnqueue = drvscsiReqTransferEnqueue;
    962974    pThis->VScsiIoCallbacks.pfnVScsiLunGetFeatureFlags    = drvscsiGetFeatureFlags;
     975    pThis->VScsiIoCallbacks.pfnVScsiLunMediumSetLock      = drvscsiSetLock;
    963976
    964977    rc = VSCSIDeviceCreate(&pThis->hVScsiDevice, drvscsiVScsiReqCompleted, pThis);
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h

    r43640 r43693  
    364364
    365365/**
     366 * Wrapper for the get medium lock/unlock I/O callback.
     367 *
     368 * @returns VBox status code.
     369 * @param   pVScsiLun   The LUN.
     370 * @param   bool        The new medium lock state.
     371 */
     372DECLINLINE(int) vscsiLunMediumSetLock(PVSCSILUNINT pVScsiLun, bool fLocked)
     373{
     374    return pVScsiLun->pVScsiLunIoCallbacks->pfnVScsiLunMediumSetLock(pVScsiLun,
     375                                                                     pVScsiLun->pvVScsiLunUser,
     376                                                                     fLocked);
     377}
     378
     379/**
    366380 * Wrapper for the I/O request enqueue I/O callback.
    367381 *
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp

    r43662 r43693  
    409409        {
    410410            pVScsiLunMmc->fLocked = pVScsiReq->pbCDB[4] & 1;
     411            vscsiLunMediumSetLock(pVScsiLun, pVScsiLunMmc->fLocked);
    411412            rcReq = vscsiLunReqSenseOkSet(pVScsiLun, pVScsiReq);
    412413            break;
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