VirtualBox

Ignore:
Timestamp:
Jan 24, 2012 4:40:14 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75880
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
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