VirtualBox

Changeset 19626 in vbox for trunk


Ignore:
Timestamp:
May 12, 2009 2:00:11 PM (16 years ago)
Author:
vboxsync
Message:

polished r47206

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvRawFile.cpp

    r19624 r19626  
    4141*******************************************************************************/
    4242
    43 /** Converts a pointer to DRVOUTPUTFILE::IMedia to a PDRVOUTPUTFILE. */
    44 #define PDMISTREAM_2_DRVOUTPUTFILE(pInterface) ( (PDRVOUTPUTFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVOUTPUTFILE, IStream)) )
     43/** Converts a pointer to DRVRAWFILE::IMedia to a PDRVRAWFILE. */
     44#define PDMISTREAM_2_DRVRAWFILE(pInterface) ( (PDRVRAWFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWFILE, IStream)) )
    4545
    4646/** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
     
    5353 * Raw file output driver instance data.
    5454 */
    55 typedef struct DRVOUTPUTFILE
     55typedef struct DRVRAWFILE
    5656{
    5757    /** The stream interface. */
     
    6363    /** Flag whether VirtualBox represents the server or client side. */
    6464    RTFILE              OutputFile;
    65     /** Flag to signal listening thread to shut down. */
    66     bool                fShutdown;
    67 } DRVOUTPUTFILE, *PDRVOUTPUTFILE;
     65} DRVRAWFILE, *PDRVRAWFILE;
    6866
    6967
     
    7472
    7573/** @copydoc PDMISTREAM::pfnWrite */
    76 static DECLCALLBACK(int) drvOutputFileWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite)
     74static DECLCALLBACK(int) drvRawFileWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite)
    7775{
    7876    int rc = VINF_SUCCESS;
    79     PDRVOUTPUTFILE pThis = PDMISTREAM_2_DRVOUTPUTFILE(pInterface);
     77    PDRVRAWFILE pThis = PDMISTREAM_2_DRVRAWFILE(pInterface);
    8078    LogFlow(("%s: pvBuf=%p *pcbWrite=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbWrite, pThis->pszLocation));
    8179
     
    104102 * @thread  Any thread.
    105103 */
    106 static DECLCALLBACK(void *) drvOutputFileQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     104static DECLCALLBACK(void *) drvRawFileQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    107105{
    108106    PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    109     PDRVOUTPUTFILE pDrv = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);
     107    PDRVRAWFILE pDrv = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    110108    switch (enmInterface)
    111109    {
     
    130128 *                      iInstance it's expected to be used a bit in this function.
    131129 */
    132 static DECLCALLBACK(int) drvOutputFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     130static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    133131{
    134132    int rc;
    135133    char *pszLocation = NULL;
    136     PDRVOUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);
     134    PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    137135
    138136    /*
     
    142140    pThis->pszLocation                  = NULL;
    143141    pThis->OutputFile                   = NIL_RTFILE;
    144     pThis->fShutdown                    = false;
    145142    /* IBase */
    146     pDrvIns->IBase.pfnQueryInterface    = drvOutputFileQueryInterface;
     143    pDrvIns->IBase.pfnQueryInterface    = drvRawFileQueryInterface;
    147144    /* IStream */
    148     pThis->IStream.pfnWrite             = drvOutputFileWrite;
     145    pThis->IStream.pfnWrite             = drvRawFileWrite;
    149146
    150147    /*
     
    180177    }
    181178
    182     LogFlow(("drvOutputFileConstruct: location %s\n", pszLocation));
     179    LogFlow(("drvRawFileConstruct: location %s\n", pszLocation));
    183180    LogRel(("RawFile: location %s\n", pszLocation));
    184181    return VINF_SUCCESS;
     
    194191 * @param   pDrvIns     The driver instance data.
    195192 */
    196 static DECLCALLBACK(void) drvOutputFileDestruct(PPDMDRVINS pDrvIns)
    197 {
    198     PDRVOUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);
     193static DECLCALLBACK(void) drvRawFileDestruct(PPDMDRVINS pDrvIns)
     194{
     195    PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    199196    LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation));
    200197
     
    211208 * @param   pDrvIns     The driver instance data.
    212209 */
    213 static DECLCALLBACK(void) drvOutputFilePowerOff(PPDMDRVINS pDrvIns)
    214 {
    215     PDRVOUTPUTFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVOUTPUTFILE);
     210static DECLCALLBACK(void) drvRawFilePowerOff(PPDMDRVINS pDrvIns)
     211{
     212    PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    216213    LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation));
    217 
    218     pThis->fShutdown = true;
    219214
    220215    if (pThis->OutputFile != NIL_RTFILE)
     
    241236    ~0,
    242237    /* cbInstance */
    243     sizeof(DRVOUTPUTFILE),
     238    sizeof(DRVRAWFILE),
    244239    /* pfnConstruct */
    245     drvOutputFileConstruct,
     240    drvRawFileConstruct,
    246241    /* pfnDestruct */
    247     drvOutputFileDestruct,
     242    drvRawFileDestruct,
    248243    /* pfnIOCtl */
    249244    NULL,
     
    259254    NULL,
    260255    /* pfnPowerOff */
    261     drvOutputFilePowerOff,
     256    drvRawFilePowerOff,
    262257};
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