VirtualBox

Changeset 22277 in vbox for trunk/src/VBox/Devices/Serial


Ignore:
Timestamp:
Aug 16, 2009 9:12:50 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51119
Message:

PDMDRVREG change (big changeset).

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

Legend:

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

    r19624 r22277  
    288288/**
    289289 * Construct a char driver instance.
    290  *
    291  * @returns VBox status.
    292  * @param   pDrvIns     The driver instance data.
    293  *                      If the registration structure is needed,
    294  *                      pDrvIns->pDrvReg points to it.
    295  * @param   pCfgHandle  Configuration node handle for the driver. Use this to
    296  *                      obtain the configuration of the driver instance. It's
    297  *                      also found in pDrvIns->pCfgHandle as it's expected to
    298  *                      be used frequently in this function.
    299  */
    300 static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     290 * 
     291 * @copydoc FNPDMDRVCONSTRUCT
     292 */
     293static DECLCALLBACK(int) drvCharConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    301294{
    302295    PDRVCHAR pThis = PDMINS_2_DATA(pDrvIns, PDRVCHAR);
     
    326319     */
    327320    PPDMIBASE pBase;
    328     int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase);
     321    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pBase);
    329322    if (RT_FAILURE(rc))
    330323        return rc; /* Don't call PDMDrvHlpVMSetError here as we assume that the driver already set an appropriate error */
     
    428421    /* pfnResume */
    429422    NULL,
     423    /* pfnAttach */
     424    NULL,
    430425    /* pfnDetach */
    431     NULL,
    432     /** pfnPowerOff */
    433     NULL
     426    NULL,
     427    /* pfnPowerOff */
     428    NULL,
     429    /* pfnSoftReset */
     430    NULL,
     431    /* u32EndVersion */
     432    PDM_DRVREG_VERSION
    434433};
    435434
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r22072 r22277  
    11781178/**
    11791179 * Construct a char driver instance.
    1180  *
    1181  * @returns VBox status.
    1182  * @param   pDrvIns     The driver instance data.
    1183  *                      If the registration structure is needed,
    1184  *                      pDrvIns->pDrvReg points to it.
    1185  * @param   pCfgHandle  Configuration node handle for the driver. Use this to
    1186  *                      obtain the configuration of the driver instance. It's
    1187  *                      also found in pDrvIns->pCfgHandle as it's expected to
    1188  *                      be used frequently in this function.
     1180 * 
     1181 * @copydoc FNPDMDRVCONSTRUCT
    11891182 */
    1190 static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     1183static DECLCALLBACK(int) drvHostSerialConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    11911184{
    11921185    PDRVHOSTSERIAL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
     
    14651458    /* pfnResume */
    14661459    NULL,
     1460    /* pfnAttach */
     1461    NULL,
    14671462    /* pfnDetach */
     1463    NULL,
     1464    /* pfnPowerOff */
     1465    NULL,
     1466    /* pfnSoftReset */
    14681467    NULL,
    1469     /** pfnPowerOff */
    1470     NULL
     1468    /* u32EndVersion */
     1469    PDM_DRVREG_VERSION
    14711470};
    14721471
  • trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp

    r18443 r22277  
    396396 * Construct a named pipe stream driver instance.
    397397 *
    398  * @returns VBox status.
    399  * @param   pDrvIns     The driver instance data.
    400  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    401  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    402  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    403  *                      iInstance it's expected to be used a bit in this function.
    404  */
    405 static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
     398 * @copydoc FNPDMDRVCONSTRUCT
     399 */
     400static DECLCALLBACK(int) drvNamedPipeConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
    406401{
    407402    int rc;
     
    646641    /* pfnResume */
    647642    NULL,
     643    /* pfnAttach */
     644    NULL,
    648645    /* pfnDetach */
    649646    NULL,
    650647    /* pfnPowerOff */
    651648    drvNamedPipePowerOff,
     649    /* pfnSoftReset */
     650    NULL,
     651    /* u32EndVersion */
     652    PDM_DRVREG_VERSION
    652653};
     654
  • trunk/src/VBox/Devices/Serial/DrvRawFile.cpp

    r19626 r22277  
    1 /** @file
    2  *
    3  * VBox stream devices:
    4  * Raw file output
     1/* $Id$ */
     2/** @file
     3 * VBox stream drivers - Raw file output.
    54 */
    65
     
    2524*   Header Files                                                               *
    2625*******************************************************************************/
    27 #define LOG_GROUP LOG_GROUP_DRV_NAMEDPIPE
     26#define LOG_GROUP LOG_GROUP_DEFAULT
    2827#include <VBox/pdmdrv.h>
    2928#include <iprt/assert.h>
     
    6059    PPDMDRVINS          pDrvIns;
    6160    /** Pointer to the file name. (Freed by MM) */
    62     char                *pszLocation;
     61    char               *pszLocation;
    6362    /** Flag whether VirtualBox represents the server or client side. */
    6463    RTFILE              OutputFile;
     
    121120 * Construct a raw output stream driver instance.
    122121 *
    123  * @returns VBox status.
    124  * @param   pDrvIns     The driver instance data.
    125  *                      If the registration structure is needed, pDrvIns->pDrvReg points to it.
    126  * @param   pCfgHandle  Configuration node handle for the driver. Use this to obtain the configuration
    127  *                      of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
    128  *                      iInstance it's expected to be used a bit in this function.
    129  */
    130 static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle)
    131 {
    132     int rc;
    133     char *pszLocation = NULL;
     122 * @copydoc FNPDMDRVCONSTRUCT
     123 */
     124static DECLCALLBACK(int) drvRawFileConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     125{
    134126    PDRVRAWFILE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    135127
     
    149141     */
    150142    if (!CFGMR3AreValuesValid(pCfgHandle, "Location\0"))
    151     {
    152         rc = VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
    153         goto out;
    154     }
    155 
    156     rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pszLocation);
     143        AssertFailedReturn(VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES);
     144
     145    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pThis->pszLocation);
     146    if (RT_FAILURE(rc))
     147        AssertMsgFailedReturn(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc), rc);
     148
     149    /*
     150     * Open the raw file.
     151     */
     152    rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
    157153    if (RT_FAILURE(rc))
    158154    {
    159         AssertMsgFailed(("Configuration error: query \"Location\" resulted in %Rrc.\n", rc));
    160         goto out;
    161     }
    162     pThis->pszLocation = pszLocation;
    163 
    164     rc = RTFileOpen(&pThis->OutputFile, pThis->pszLocation, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE);
    165     if (RT_FAILURE(rc))
    166     {
    167         LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pThis->pDrvIns->iInstance));
    168         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pszLocation);
    169     }
    170 
    171 out:
    172     if (RT_FAILURE(rc))
    173     {
    174         if (pszLocation)
    175             MMR3HeapFree(pszLocation);
    176         return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to initialize"), pDrvIns->iInstance);
    177     }
    178 
    179     LogFlow(("drvRawFileConstruct: location %s\n", pszLocation));
    180     LogRel(("RawFile: location %s\n", pszLocation));
     155        LogRel(("RawFile%d: CreateFile failed rc=%Rrc\n", pDrvIns->iInstance));
     156        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("RawFile#%d failed to create the raw output file %s"), pDrvIns->iInstance, pThis->pszLocation);
     157    }
     158
     159    LogFlow(("drvRawFileConstruct: location %s\n", pThis->pszLocation));
     160    LogRel(("RawFile#%u: location %s\n", pDrvIns->iInstance, pThis->pszLocation));
    181161    return VINF_SUCCESS;
    182162}
     
    198178    if (pThis->pszLocation)
    199179        MMR3HeapFree(pThis->pszLocation);
     180
     181    if (pThis->OutputFile != NIL_RTFILE)
     182    {   
     183        RTFileClose(pThis->OutputFile);
     184        pThis->OutputFile = NIL_RTFILE;
     185    }
    200186}
    201187
     
    214200
    215201    if (pThis->OutputFile != NIL_RTFILE)
     202    {   
    216203        RTFileClose(pThis->OutputFile);
     204        pThis->OutputFile = NIL_RTFILE;
     205    }
    217206}
    218207
     
    251240    /* pfnResume */
    252241    NULL,
     242    /* pfnAttach */
     243    NULL,
    253244    /* pfnDetach */
    254245    NULL,
    255246    /* pfnPowerOff */
    256247    drvRawFilePowerOff,
     248    /* pfnSoftReset */
     249    NULL,
     250    /* u32EndVersion */
     251    PDM_DRVREG_VERSION
    257252};
     253
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