VirtualBox

Changeset 39855 in vbox


Ignore:
Timestamp:
Jan 24, 2012 4:40:14 PM (13 years ago)
Author:
vboxsync
Message:

Various drivers: Use PDMIBASE_2_PDMDRV instead of cooking your own stuff.

Location:
trunk/src/VBox/Devices
Files:
5 edited

Legend:

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

    r35353 r39855  
    5151/** Converts a pointer to DRVNAMEDPIPE::IMedia to a PDRVNAMEDPIPE. */
    5252#define PDMISTREAM_2_DRVNAMEDPIPE(pInterface) ( (PDRVNAMEDPIPE)((uintptr_t)pInterface - RT_OFFSETOF(DRVNAMEDPIPE, IStream)) )
    53 
    54 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    55 #define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
    5653
    5754
     
    286283static DECLCALLBACK(void *) drvNamedPipeQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    287284{
    288     PPDMDRVINS      pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     285    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    289286    PDRVNAMEDPIPE   pThis   = PDMINS_2_DATA(pDrvIns, PDRVNAMEDPIPE);
    290287    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
  • trunk/src/VBox/Devices/Serial/DrvRawFile.cpp

    r37596 r39855  
    3939#define PDMISTREAM_2_DRVRAWFILE(pInterface) ( (PDRVRAWFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWFILE, IStream)) )
    4040
    41 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    42 #define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
    43 
    4441
    4542/*******************************************************************************
     
    9895static DECLCALLBACK(void *) drvRawFileQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    9996{
    100     PPDMDRVINS  pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     97    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    10198    PDRVRAWFILE pThis   = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    10299
  • trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp

    r37596 r39855  
    3434/** Converts a pointer to MEDIAISO::IMedia to a PRDVMEDIAISO. */
    3535#define PDMIMEDIA_2_DRVMEDIAISO(pInterface) ( (PDRVMEDIAISO)((uintptr_t)pInterface - RT_OFFSETOF(DRVMEDIAISO, IMedia)) )
    36 
    37 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    38 #define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
    39 
    40 /** Converts a pointer to PDMDRVINS::IBase to a PVBOXHDD. */
    41 #define PDMIBASE_2_DRVMEDIAISO(pInterface)  ( PDMINS_2_DATA(PDMIBASE_2_DRVINS(pInterface), PDRVMEDIAISO) )
    42 
    4336
    4437
     
    181174static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    182175{
    183     PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     176    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    184177    PDRVMEDIAISO pThis = PDMINS_2_DATA(pDrvIns, PDRVMEDIAISO);
    185178    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
  • trunk/src/VBox/Devices/Storage/DrvRawImage.cpp

    r37596 r39855  
    2828
    2929#include "VBoxDD.h"
    30 
    31 
    32 /*******************************************************************************
    33 *   Defined Constants And Macros                                               *
    34 *******************************************************************************/
    35 /** Converts a pointer to RAWIMAGE::IMedia to a PRDVRAWIMAGE. */
    36 #define PDMIMEDIA_2_DRVRAWIMAGE(pInterface) ( (PDRVRAWIMAGE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWIMAGE, IMedia)) )
    37 
    38 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    39 #define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
    40 
    41 /** Converts a pointer to PDMDRVINS::IBase to a PVBOXHDD. */
    42 #define PDMIBASE_2_DRVRAWIMAGE(pInterface)  ( PDMINS_2_DATA(PDMIBASE_2_DRVINS(pInterface), PDRVRAWIMAGE) )
    43 
    4430
    4531
     
    7359static DECLCALLBACK(uint64_t) drvRawImageGetSize(PPDMIMEDIA pInterface)
    7460{
    75     PDRVRAWIMAGE pThis = PDMIMEDIA_2_DRVRAWIMAGE(pInterface);
     61    PDRVRAWIMAGE pThis = RT_FROM_MEMBER(pInterface, DRVRAWIMAGE, IMedia);
    7662    LogFlow(("drvRawImageGetSize: '%s'\n", pThis->pszFilename));
    7763
     
    124110static DECLCALLBACK(int) drvRawImageRead(PPDMIMEDIA pInterface, uint64_t off, void *pvBuf, size_t cbRead)
    125111{
    126     PDRVRAWIMAGE pThis = PDMIMEDIA_2_DRVRAWIMAGE(pInterface);
     112    PDRVRAWIMAGE pThis = RT_FROM_MEMBER(pInterface, DRVRAWIMAGE, IMedia);
    127113    LogFlow(("drvRawImageRead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n", off, pvBuf, cbRead, pThis->pszFilename));
    128114
     
    158144static DECLCALLBACK(int) drvRawImageWrite(PPDMIMEDIA pInterface, uint64_t off, const void *pvBuf, size_t cbWrite)
    159145{
    160     PDRVRAWIMAGE pThis = PDMIMEDIA_2_DRVRAWIMAGE(pInterface);
     146    PDRVRAWIMAGE pThis = RT_FROM_MEMBER(pInterface, DRVRAWIMAGE, IMedia);
    161147    LogFlow(("drvRawImageWrite: off=%#llx pvBuf=%p cbWrite=%#x (%s)\n", off, pvBuf, cbWrite, pThis->pszFilename));
    162148
     
    192178static DECLCALLBACK(int) drvRawImageFlush(PPDMIMEDIA pInterface)
    193179{
    194     PDRVRAWIMAGE pThis = PDMIMEDIA_2_DRVRAWIMAGE(pInterface);
     180    PDRVRAWIMAGE pThis = RT_FROM_MEMBER(pInterface, DRVRAWIMAGE, IMedia);
    195181    LogFlow(("drvRawImageFlush: (%s)\n", pThis->pszFilename));
    196182
     
    213199static DECLCALLBACK(bool) drvRawImageIsReadOnly(PPDMIMEDIA pInterface)
    214200{
    215     PDRVRAWIMAGE pThis = PDMIMEDIA_2_DRVRAWIMAGE(pInterface);
     201    PDRVRAWIMAGE pThis = RT_FROM_MEMBER(pInterface, DRVRAWIMAGE, IMedia);
    216202    return pThis->fReadOnly;
    217203}
     
    225211static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    226212{
    227     PPDMDRVINS      pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     213    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    228214    PDRVRAWIMAGE    pThis   = PDMINS_2_DATA(pDrvIns, PDRVRAWIMAGE);
    229215
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r39414 r39855  
    6262#define PDMIMEDIA_2_VBOXDISK(pInterface) \
    6363    ( (PVBOXDISK)((uintptr_t)pInterface - RT_OFFSETOF(VBOXDISK, IMedia)) )
    64 
    65 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    66 #define PDMIBASE_2_DRVINS(pInterface) \
    67     ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
    68 
    69 /** Converts a pointer to PDMDRVINS::IBase to a PVBOXDISK. */
    70 #define PDMIBASE_2_VBOXDISK(pInterface) \
    71     ( PDMINS_2_DATA(PDMIBASE_2_DRVINS(pInterface), PVBOXDISK) )
    7264
    7365/** Converts a pointer to VBOXDISK::IMediaAsync to a PVBOXDISK. */
     
    18731865static DECLCALLBACK(void *) drvvdQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    18741866{
    1875     PPDMDRVINS  pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     1867    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    18761868    PVBOXDISK   pThis   = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    18771869
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