VirtualBox

Ignore:
Timestamp:
Dec 1, 2011 7:59:21 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75169
Message:

RTReq refactoring.

File:
1 edited

Legend:

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

    r37596 r39498  
    6363    PPDMTHREAD              pAsyncIOThread;
    6464    /** Queue for passing the requests to the thread. */
    65     PRTREQQUEUE             pQueueRequests;
     65    RTREQQUEUE              hQueueRequests;
    6666} DRVSCSIHOST, *PDRVSCSIHOST;
    6767
     
    352352    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    353353    {
    354         rc = RTReqProcess(pThis->pQueueRequests, RT_INDEFINITE_WAIT);
     354        rc = RTReqQueueProcess(pThis->hQueueRequests, RT_INDEFINITE_WAIT);
    355355        AssertMsg(rc == VWRN_STATE_CHANGED, ("Left RTReqProcess and error code is not VWRN_STATE_CHANGED rc=%Rrc\n", rc));
    356356    }
     
    365365    PRTREQ pReq;
    366366
    367     AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE);
    368 
    369     rc = RTReqCall(pThis->pQueueRequests, &pReq, 10000 /* 10 sec. */, (PFNRT)drvscsihostAsyncIOLoopWakeupFunc, 0);
     367    AssertReturn(pThis->hQueueRequests != NIL_RTREQQUEUE, VERR_INVALID_STATE);
     368
     369    rc = RTReqQueueCall(pThis->hQueueRequests, &pReq, 10000 /* 10 sec. */, (PFNRT)drvscsihostAsyncIOLoopWakeupFunc, 0);
    370370    AssertMsgRC(rc, ("Inserting request into queue failed rc=%Rrc\n"));
    371371
     
    382382    PRTREQ pReq;
    383383
    384     AssertMsgReturn(pThis->pQueueRequests, ("pQueueRequests is NULL\n"), VERR_INVALID_STATE);
    385 
    386     rc = RTReqCallEx(pThis->pQueueRequests, &pReq, 0, RTREQFLAGS_NO_WAIT, (PFNRT)drvscsihostProcessRequestOne, 2, pThis, pSCSIRequest);
     384    AssertReturn(pThis->hQueueRequests != NIL_RTREQQUEUE, VERR_INVALID_STATE);
     385
     386    rc = RTReqQueueCallEx(pThis->hQueueRequests, &pReq, 0, RTREQFLAGS_NO_WAIT, (PFNRT)drvscsihostProcessRequestOne, 2, pThis, pSCSIRequest);
    387387    AssertMsgReturn(RT_SUCCESS(rc), ("Inserting request into queue failed rc=%Rrc\n", rc), rc);
    388388
     
    429429    }
    430430
    431     if (pThis->pQueueRequests)
    432     {
    433         int rc = RTReqDestroyQueue(pThis->pQueueRequests);
     431    if (pThis->hQueueRequests != NIL_RTREQQUEUE)
     432    {
     433        int rc = RTReqQueueDestroy(pThis->hQueueRequests);
    434434        AssertMsgRC(rc, ("Failed to destroy queue rc=%Rrc\n", rc));
     435        pThis->hQueueRequests = NIL_RTREQQUEUE;
    435436    }
    436437
     
    447448    LogFlowFunc(("pDrvIns=%#p pCfg=%#p\n", pDrvIns, pCfg));
    448449    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     450
     451    /*
     452     * Initialize the instance data first because of the destructor.
     453     */
     454    pDrvIns->IBase.pfnQueryInterface            = drvscsihostQueryInterface;
     455    pThis->ISCSIConnector.pfnSCSIRequestSend    = drvscsihostRequestSend;
     456    pThis->pDrvIns                              = pDrvIns;
     457    pThis->hDeviceFile                          = NIL_RTFILE;
     458    pThis->hQueueRequests                       = NIL_RTREQQUEUE;
    449459
    450460    /*
     
    455465                                N_("Invalid configuration for host scsi access driver"));
    456466
    457     /*
    458      * Initialize interfaces.
    459      */
    460     pDrvIns->IBase.pfnQueryInterface                    = drvscsihostQueryInterface;
    461     pThis->ISCSIConnector.pfnSCSIRequestSend            = drvscsihostRequestSend;
    462     pThis->pDrvIns     = pDrvIns;
    463     pThis->hDeviceFile = NIL_RTFILE;
    464467
    465468    /* Query the SCSI port interface above. */
     
    468471
    469472    /* Create request queue. */
    470     int rc = RTReqCreateQueue(&pThis->pQueueRequests);
     473    int rc = RTReqQueueCreate(&pThis->hQueueRequests);
    471474    AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc);
    472475
Note: See TracChangeset for help on using the changeset viewer.

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