VirtualBox

Changeset 65061 in vbox


Ignore:
Timestamp:
Jan 3, 2017 10:55:26 AM (8 years ago)
Author:
vboxsync
Message:

pdmstorageifs.h: Pass the CDB length in PDMIMEDIA::pfnSendCmd to not being bound to guessing it in the host DVD access driver

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmstorageifs.h

    r65057 r65061  
    288288     * @returns VBox status code.
    289289     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    290      * @param   pbCmd           Offset to start reading from.
     290     * @param   pbCdb           The command to process.
     291     * @param   cbCdb           The length of the command in bytes.
    291292     * @param   enmTxDir        Direction of transfer.
    292293     * @param   pvBuf           Pointer tp the transfer buffer.
     
    297298     * @thread  Any thread.
    298299     */
    299     DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIMEDIA pInterface, const uint8_t *pbCmd, PDMMEDIATXDIR enmTxDir,
    300                                           void *pvBuf, uint32_t *pcbBuf, uint8_t *pabSense, size_t cbSense,
    301                                           uint32_t cTimeoutMillies));
     300    DECLR3CALLBACKMEMBER(int, pfnSendCmd,(PPDMIMEDIA pInterface, const uint8_t *pbCdb, size_t cbCdb,
     301                                          PDMMEDIATXDIR enmTxDir, void *pvBuf, uint32_t *pcbBuf,
     302                                          uint8_t *pabSense, size_t cbSense, uint32_t cTimeoutMillies));
    302303
    303304    /**
     
    462463} PDMIMEDIA;
    463464/** PDMIMEDIA interface ID. */
    464 #define PDMIMEDIA_IID                           "d344aeaa-3ad0-4563-bb03-2733383e9230"
     465#define PDMIMEDIA_IID                           "527246f5-f300-47a7-9ec3-03d8ea8bf9de"
    465466
    466467
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r65060 r65061  
    20512051                    break;
    20522052            }
    2053             rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, aATAPICmd, (PDMMEDIATXDIR)s->uTxDir, pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
     2053            rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, aATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir,
     2054                                          pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
    20542055            if (rc != VINF_SUCCESS)
    20552056                break;
     
    20922093    }
    20932094    else
    2094         rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, s->aATAPICmd, (PDMMEDIATXDIR)s->uTxDir, s->CTX_SUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
     2095        rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, s->aATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir,
     2096                                      s->CTX_SUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
    20952097    if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); }
    20962098
  • trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp

    r64413 r65061  
    500500
    501501/** @interface_method_impl{PDMIMEDIA,pfnSendCmd} */
    502 static DECLCALLBACK(int) drvHostDvdSendCmd(PPDMIMEDIA pInterface, const uint8_t *pbCmd,
     502static DECLCALLBACK(int) drvHostDvdSendCmd(PPDMIMEDIA pInterface, const uint8_t *pbCdb, size_t cbCdb,
    503503                                           PDMMEDIATXDIR enmTxDir, void *pvBuf, uint32_t *pcbBuf,
    504504                                           uint8_t *pabSense, size_t cbSense, uint32_t cTimeoutMillies)
     
    506506    PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMedia);
    507507    int rc;
    508     LogFlow(("%s: cmd[0]=%#04x txdir=%d pcbBuf=%d timeout=%d\n", __FUNCTION__, pbCmd[0], enmTxDir, *pcbBuf, cTimeoutMillies));
     508    LogFlow(("%s: cmd[0]=%#04x txdir=%d pcbBuf=%d timeout=%d\n", __FUNCTION__, pbCdb[0], enmTxDir, *pcbBuf, cTimeoutMillies));
    509509
    510510    RTCritSectEnter(&pThis->CritSect);
    511     /*
    512      * Pass the request on to the internal scsi command interface.
    513      * The command seems to be 12 bytes long, the docs a bit copy&pasty on the command length point...
    514      */
     511    /* Pass the request on to the internal scsi command interface. */
    515512    if (enmTxDir == PDMMEDIATXDIR_FROM_DEVICE)
    516513        memset(pvBuf, '\0', *pcbBuf); /* we got read size, but zero it anyway. */
    517     rc = drvHostBaseScsiCmdOs(pThis, pbCmd, 12, enmTxDir, pvBuf, pcbBuf, pabSense, cbSense, cTimeoutMillies);
     514    rc = drvHostBaseScsiCmdOs(pThis, pbCdb, cbCdb, enmTxDir, pvBuf, pcbBuf, pabSense, cbSense, cTimeoutMillies);
    518515    if (rc == VERR_UNRESOLVED_ERROR)
    519516        /* sense information set */
    520517        rc = VERR_DEV_IO_ERROR;
    521518
    522     if (pbCmd[0] == SCSI_GET_EVENT_STATUS_NOTIFICATION)
     519    if (pbCdb[0] == SCSI_GET_EVENT_STATUS_NOTIFICATION)
    523520    {
    524521        uint8_t *pbBuf = (uint8_t*)pvBuf;
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