VirtualBox

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


Ignore:
Timestamp:
Jan 22, 2018 7:38:45 PM (7 years ago)
Author:
vboxsync
Message:

VSCSI,DrvSCSI: Add method to query INQUIRY related data from the outside to overwrite defaults

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

Legend:

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

    r69500 r70688  
    444444}
    445445
     446/**
     447 * @interface_method_impl{VSCSILUNIOCALLBACKS,pfnVScsiLunQueryInqStrings}
     448 */
     449static DECLCALLBACK(int) drvscsiQueryInqStrings(VSCSILUN hVScsiLun, void *pvScsiLunUser, const char **ppszVendorId,
     450                                                const char **ppszProductId, const char **ppszProductLevel)
     451{
     452    RT_NOREF(hVScsiLun);
     453    PDRVSCSI pThis = (PDRVSCSI)pvScsiLunUser;
     454
     455    if (pThis->pDevMediaPort->pfnQueryScsiInqStrings)
     456        return pThis->pDevMediaPort->pfnQueryScsiInqStrings(pThis->pDevMediaPort, ppszVendorId,
     457                                                            ppszProductId, ppszProductLevel);
     458
     459    return VERR_NOT_FOUND;
     460}
    446461
    447462/* -=-=-=-=- IPortEx -=-=-=-=- */
     
    14161431    pThis->VScsiIoCallbacks.pfnVScsiLunGetFeatureFlags                   = drvscsiGetFeatureFlags;
    14171432    pThis->VScsiIoCallbacks.pfnVScsiLunMediumSetLock                     = drvscsiSetLock;
     1433    pThis->VScsiIoCallbacks.pfnVScsiLunQueryInqStrings                   = drvscsiQueryInqStrings;
    14181434
    14191435    rc = VSCSIDeviceCreate(&pThis->hVScsiDevice, drvscsiIoReqVScsiReqCompleted, pThis);
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h

    r69500 r70688  
    629629 * @returns VBox status code.
    630630 * @param   pVScsiLun   The LUN.
    631  * @param   pVScsiIoReq The I/O request to enqueue.
     631 * @param   pfFeatures  Where to sthre supported flags on success.
    632632 */
    633633DECLINLINE(int) vscsiLunGetFeatureFlags(PVSCSILUNINT pVScsiLun, uint64_t *pfFeatures)
     
    639639
    640640/**
     641 * Wrapper for the query INQUIRY strings I/O callback.
     642 *
     643 * @returns VBox status code.
     644 * @param   pVScsiLun   The LUN.
     645 * @param   ppszVendorId     Where to store the pointer to the vendor ID string to report.
     646 * @param   ppszProductId    Where to store the pointer to the product ID string to report.
     647 * @param   ppszProductLevel Where to store the pointer to the revision string to report.
     648 */
     649DECLINLINE(int) vscsiLunQueryInqStrings(PVSCSILUNINT pVScsiLun, const char **ppszVendorId,
     650                                        const char **ppszProductId, const char **ppszProductLevel)
     651{
     652    if (pVScsiLun->pVScsiLunIoCallbacks->pfnVScsiLunQueryInqStrings)
     653    {
     654        return pVScsiLun->pVScsiLunIoCallbacks->pfnVScsiLunQueryInqStrings(pVScsiLun,
     655                                                                           pVScsiLun->pvVScsiLunUser,
     656                                                                           ppszVendorId, ppszProductId,
     657                                                                           ppszProductLevel);
     658    }
     659
     660    return VERR_NOT_FOUND;
     661}
     662
     663/**
    641664 * Wrapper around vscsiReqSenseOkSet()
    642665 */
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunMmc.cpp

    r69500 r70688  
    11031103                ScsiInquiryReply.fCmdQue                = 1;    /* Command queuing supported. */
    11041104                ScsiInquiryReply.fWBus16                = 1;
    1105                 scsiPadStrS(ScsiInquiryReply.achVendorId, "VBOX", 8);
    1106                 scsiPadStrS(ScsiInquiryReply.achProductId, "CD-ROM", 16);
    1107                 scsiPadStrS(ScsiInquiryReply.achProductLevel, "1.0", 4);
     1105
     1106                const char *pszVendorId = "VBOX";
     1107                const char *pszProductId = "CD-ROM";
     1108                const char *pszProductLevel = "1.0";
     1109                int rcTmp = vscsiLunQueryInqStrings(pVScsiLun, &pszVendorId, &pszProductId, &pszProductLevel);
     1110                Assert(RT_SUCCESS(rcTmp) || rcTmp == VERR_NOT_FOUND);
     1111
     1112                scsiPadStrS(ScsiInquiryReply.achVendorId, pszVendorId, 8);
     1113                scsiPadStrS(ScsiInquiryReply.achProductId, pszProductId, 16);
     1114                scsiPadStrS(ScsiInquiryReply.achProductLevel, pszProductLevel, 4);
    11081115
    11091116                RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, (uint8_t *)&ScsiInquiryReply, sizeof(SCSIINQUIRYDATA));
  • trunk/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp

    r69500 r70688  
    231231                ScsiInquiryReply.fCmdQue                = 1;    /* Command queuing supported. */
    232232                ScsiInquiryReply.fWBus16                = 1;
    233                 scsiPadStrS(ScsiInquiryReply.achVendorId, "VBOX", 8);
    234                 scsiPadStrS(ScsiInquiryReply.achProductId, "HARDDISK", 16);
    235                 scsiPadStrS(ScsiInquiryReply.achProductLevel, "1.0", 4);
     233
     234                const char *pszVendorId = "VBOX";
     235                const char *pszProductId = "HARDDISK";
     236                const char *pszProductLevel = "1.0";
     237                int rcTmp = vscsiLunQueryInqStrings(pVScsiLun, &pszVendorId, &pszProductId, &pszProductLevel);
     238                Assert(RT_SUCCESS(rcTmp) || rcTmp == VERR_NOT_FOUND);
     239
     240                scsiPadStrS(ScsiInquiryReply.achVendorId, pszVendorId, 8);
     241                scsiPadStrS(ScsiInquiryReply.achProductId, pszProductId, 16);
     242                scsiPadStrS(ScsiInquiryReply.achProductLevel, pszProductLevel, 4);
    236243
    237244                RTSgBufCopyFromBuf(&pVScsiReq->SgBuf, (uint8_t *)&ScsiInquiryReply, sizeof(SCSIINQUIRYDATA));
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