VirtualBox

Changeset 26001 in vbox for trunk/src/VBox/Devices/Parallel


Ignore:
Timestamp:
Jan 25, 2010 2:21:13 PM (15 years ago)
Author:
vboxsync
Message:

PDM,*: Redid the PDM structure versions. Check the instance and helper versions in every device and driver constructor.

Location:
trunk/src/VBox/Devices/Parallel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Parallel/DevParallel.cpp

    r25985 r26001  
    673673{
    674674    ParallelState *pThis = PDMINS_2_DATA(pDevIns, ParallelState *);
     675    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    675676
    676677    PDMR3CritSectDelete(&pThis->CritSect);
     
    702703
    703704    Assert(iInstance < 4);
     705    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    704706
    705707    /*
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r25985 r26001  
    249249
    250250/**
    251  * Construct a host parallel driver instance.
    252  *
    253  * @copydoc FNPDMDRVCONSTRUCT
    254  */
    255 static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     251 * Destruct a host parallel driver instance.
     252 *
     253 * Most VM resources are freed by the VM. This callback is provided so that
     254 * any non-VM resources can be freed correctly.
     255 *
     256 * @param   pDrvIns     The driver instance data.
     257 */
     258static DECLCALLBACK(void) drvHostParallelDestruct(PPDMDRVINS pDrvIns)
    256259{
    257260    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    258261    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
     262    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     263
     264    ioctl(pThis->FileDevice, PPRELEASE);
     265
     266    if (pThis->WakeupPipeW != NIL_RTFILE)
     267    {
     268        int rc = RTFileClose(pThis->WakeupPipeW);
     269        AssertRC(rc);
     270        pThis->WakeupPipeW = NIL_RTFILE;
     271    }
     272    if (pThis->WakeupPipeR != NIL_RTFILE)
     273    {
     274        int rc = RTFileClose(pThis->WakeupPipeR);
     275        AssertRC(rc);
     276        pThis->WakeupPipeR = NIL_RTFILE;
     277    }
     278    if (pThis->FileDevice != NIL_RTFILE)
     279    {
     280        int rc = RTFileClose(pThis->FileDevice);
     281        AssertRC(rc);
     282        pThis->FileDevice = NIL_RTFILE;
     283    }
     284}
     285
     286/**
     287 * Construct a host parallel driver instance.
     288 *
     289 * @copydoc FNPDMDRVCONSTRUCT
     290 */
     291static DECLCALLBACK(int) drvHostParallelConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
     292{
     293    PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     294    LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
     295    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    259296
    260297    /*
     
    348385
    349386    return VINF_SUCCESS;
    350 }
    351 
    352 
    353 /**
    354  * Destruct a host parallel driver instance.
    355  *
    356  * Most VM resources are freed by the VM. This callback is provided so that
    357  * any non-VM resources can be freed correctly.
    358  *
    359  * @param   pDrvIns     The driver instance data.
    360  */
    361 static DECLCALLBACK(void) drvHostParallelDestruct(PPDMDRVINS pDrvIns)
    362 {
    363     PDRVHOSTPARALLEL pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    364 
    365     LogFlow(("%s: iInstance=%d\n", __FUNCTION__, pDrvIns->iInstance));
    366 
    367     ioctl(pThis->FileDevice, PPRELEASE);
    368 
    369     if (pThis->WakeupPipeW != NIL_RTFILE)
    370     {
    371         int rc = RTFileClose(pThis->WakeupPipeW);
    372         AssertRC(rc);
    373         pThis->WakeupPipeW = NIL_RTFILE;
    374     }
    375     if (pThis->WakeupPipeR != NIL_RTFILE)
    376     {
    377         int rc = RTFileClose(pThis->WakeupPipeR);
    378         AssertRC(rc);
    379         pThis->WakeupPipeR = NIL_RTFILE;
    380     }
    381     if (pThis->FileDevice != NIL_RTFILE)
    382     {
    383         int rc = RTFileClose(pThis->FileDevice);
    384         AssertRC(rc);
    385         pThis->FileDevice = NIL_RTFILE;
    386     }
    387387}
    388388
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