VirtualBox

Changeset 25966 in vbox for trunk/src/VBox/Frontends/VBoxBFE


Ignore:
Timestamp:
Jan 22, 2010 11:15:43 AM (15 years ago)
Author:
vboxsync
Message:

PDMIBASE refactoring; use UUID as interface IDs.

Location:
trunk/src/VBox/Frontends/VBoxBFE
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Implementation of VMDisplay class
     
    3030#endif
    3131
    32 #include <iprt/alloc.h>
     32#include <iprt/mem.h>
    3333#include <iprt/semaphore.h>
    3434#include <iprt/thread.h>
     
    4040#include <VBox/log.h>
    4141#include <iprt/asm.h>
     42#include <iprt/uuid.h>
    4243
    4344#ifdef RT_OS_L4
    44 #include <stdio.h>
    45 #include <l4/util/util.h>
    46 #include <l4/log/l4log.h>
     45# include <stdio.h>
     46# include <l4/util/util.h>
     47# include <l4/log/l4log.h>
    4748#endif
    4849
     
    11461147
    11471148/**
    1148  * Queries an interface to the driver.
    1149  *
    1150  * @returns Pointer to interface.
    1151  * @returns NULL if the interface was not supported by the driver.
    1152  * @param   pInterface          Pointer to this interface structure.
    1153  * @param   enmInterface        The requested interface identification.
    1154  */
    1155 DECLCALLBACK(void *)  VMDisplay::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     1149 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     1150 */
     1151DECLCALLBACK(void *)  VMDisplay::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    11561152{
    11571153    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    11581154    PDRVMAINDISPLAY pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
    1159     switch (enmInterface)
    1160     {
    1161         case PDMINTERFACE_BASE:
    1162             return &pDrvIns->IBase;
    1163         case PDMINTERFACE_DISPLAY_CONNECTOR:
    1164             return &pDrv->Connector;
    1165         default:
    1166             return NULL;
    1167     }
     1155
     1156    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1157        return &pDrvIns->IBase;
     1158    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_DISPLAY_CONNECTOR) == 0)
     1159        return &pDrv->Connector;
     1160    return NULL;
    11681161}
    11691162
  • trunk/src/VBox/Frontends/VBoxBFE/DisplayImpl.h

    r22277 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Declaration of VMDisplay class
     
    6868    void updateDisplayData();
    6969
    70     static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     70    static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    7171    static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    7272    static DECLCALLBACK(int)   displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
     
    113113extern VMDisplay *gDisplay;
    114114
    115 #endif // ____H_DISPLAYIMPL
     115#endif // !____H_DISPLAYIMPL
  • trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Implementation of Keyboard class and related things
     
    3333#include <VBox/log.h>
    3434#include <iprt/asm.h>
     35#include <iprt/uuid.h>
    3536#include "KeyboardImpl.h"
    3637
     
    157158
    158159/**
    159  * Queries an interface to the driver.
    160  *
    161  * @returns Pointer to interface.
    162  * @returns NULL if the interface was not supported by the driver.
    163  * @param   pInterface          Pointer to this interface structure.
    164  * @param   enmInterface        The requested interface identification.
    165  */
    166 DECLCALLBACK(void *)  Keyboard::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     160 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     161 */
     162DECLCALLBACK(void *)  Keyboard::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    167163{
    168164    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    169165    PDRVMAINKEYBOARD pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
    170     switch (enmInterface)
    171     {
    172         case PDMINTERFACE_BASE:
    173             return &pDrvIns->IBase;
    174         case PDMINTERFACE_KEYBOARD_CONNECTOR:
    175             return &pDrv->Connector;
    176         default:
    177             return NULL;
    178     }
     166    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     167        return &pDrvIns->IBase;
     168    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_KEYBOARD_CONNECTOR) == 0)
     169        return &pDrv->Connector;
     170    return NULL;
    179171}
    180172
  • trunk/src/VBox/Frontends/VBoxBFE/KeyboardImpl.h

    r22277 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Declaration of Keyboard class and related things
     
    5656private:
    5757
    58     static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     58    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    5959    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6060    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
     
    7070extern Keyboard *gKeyboard;
    7171
    72 #endif // ____H_KEYBOARDIMPL
     72#endif // !____H_KEYBOARDIMPL
  • trunk/src/VBox/Frontends/VBoxBFE/MouseImpl.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Implementation of Mouse class
     
    3232#include <VBox/log.h>
    3333#include <iprt/asm.h>
     34#include <iprt/uuid.h>
    3435#include <VBox/VMMDev.h>
    3536#include "MouseImpl.h"
     
    177178
    178179/**
    179  * Queries an interface to the driver.
    180  *
    181  * @returns Pointer to interface.
    182  * @returns NULL if the interface was not supported by the driver.
    183  * @param   pInterface          Pointer to this interface structure.
    184  * @param   enmInterface        The requested interface identification.
    185  */
    186 DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     180 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     181 */
     182DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    187183{
    188184    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    189185    PDRVMAINMOUSE pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
    190     switch (enmInterface)
    191     {
    192         case PDMINTERFACE_BASE:
    193             return &pDrvIns->IBase;
    194         case PDMINTERFACE_MOUSE_CONNECTOR:
    195             return &pDrv->Connector;
    196         default:
    197             return NULL;
    198     }
     186    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     187        return &pDrvIns->IBase;
     188    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUSE_CONNECTOR) == 0)
     189        return &pDrv->Connector;
     190    return NULL;
    199191}
    200192
  • trunk/src/VBox/Frontends/VBoxBFE/MouseImpl.h

    r22277 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Declaration of Mouse class
     
    6868private:
    6969
    70     static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     70    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    7171    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    7272    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
     
    8484extern Mouse *gMouse;
    8585
    86 #endif // ____H_MOUSEIMPL
     86#endif // !____H_MOUSEIMPL
  • trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Implementation of VMStatus class
     
    3232#include <VBox/log.h>
    3333#include <iprt/asm.h>
     34#include <iprt/uuid.h>
    3435#include "StatusImpl.h"
    3536
     
    8485
    8586/**
    86  * Queries an interface to the driver.
    87  *
    88  * @returns Pointer to interface.
    89  * @returns NULL if the interface was not supported by the driver.
    90  * @param   pInterface          Pointer to this interface structure.
    91  * @param   enmInterface        The requested interface identification.
    92  */
    93 DECLCALLBACK(void *)  VMStatus::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     87 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     88 */
     89DECLCALLBACK(void *)  VMStatus::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    9490{
    9591    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    9692    PDRVMAINSTATUS pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
    97     switch (enmInterface)
    98     {
    99         case PDMINTERFACE_BASE:
    100             return &pDrvIns->IBase;
    101         case PDMINTERFACE_LED_CONNECTORS:
    102             return &pDrv->ILedConnectors;
    103         default:
    104             return NULL;
    105     }
     93    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     94        return &pDrvIns->IBase;
     95    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_CONNECTORS) == 0)
     96        return &pDrv->ILedConnectors;
     97    return NULL;
    10698}
    10799
  • trunk/src/VBox/Frontends/VBoxBFE/StatusImpl.h

    r22277 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Declaration of VMStatus class
     
    3535
    3636    static DECLCALLBACK(void)   drvUnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
    37     static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     37    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    3838    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    3939    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
     
    4242extern VMStatus *gStatus;
    4343
    44 #endif // ____H_STATUSIMPL
     44#endif // !____H_STATUSIMPL
  • trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Implementation of VMMDev: driver interface to VMM device
     
    3535#include <VBox/log.h>
    3636#include <iprt/asm.h>
     37#include <iprt/uuid.h>
    3738
    3839#include "VBoxBFE.h"
     
    344345
    345346/**
    346  * Queries an interface to the driver.
    347  *
    348  * @returns Pointer to interface.
    349  * @returns NULL if the interface was not supported by the driver.
    350  * @param   pInterface          Pointer to this interface structure.
    351  * @param   enmInterface        The requested interface identification.
    352  */
    353 DECLCALLBACK(void *) VMMDev::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     347 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     348 */
     349DECLCALLBACK(void *) VMMDev::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    354350{
    355351    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    356352    PDRVMAINVMMDEV pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINVMMDEV);
    357     switch (enmInterface)
    358     {
    359         case PDMINTERFACE_BASE:
    360             return &pDrvIns->IBase;
    361         case PDMINTERFACE_VMMDEV_CONNECTOR:
    362             return &pDrv->Connector;
    363 #ifdef VBOX_WITH_HGCM
    364         case PDMINTERFACE_HGCM_CONNECTOR:
    365             if (fActivateHGCM())
    366                 return &pDrv->HGCMConnector;
    367             else
    368                 return NULL;
    369 #endif
    370         default:
    371             return NULL;
    372     }
     353    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     354        return &pDrvIns->IBase;
     355    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_VMMDEV_CONNECTOR) == 0)
     356        return &pDrv->Connector;
     357#ifdef VBOX_WITH_HGCM
     358    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_CONNECTOR) == 0)
     359    {
     360        if (fActivateHGCM())
     361            return &pDrv->HGCMConnector;
     362        return NULL;
     363    }
     364#endif
     365    return NULL;
    373366}
    374367
  • trunk/src/VBox/Frontends/VBoxBFE/VMMDevInterface.h

    r22277 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    33 * VBox frontends: Basic Frontend (BFE):
    44 * Declaration of VMMDev: driver interface to VMM device
     
    6363    static DECLCALLBACK(int)    GetHeightReduction(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *heightReduction);
    6464
    65     static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     65    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    6666    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags);
    6767    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
     
    7070extern VMMDev *gVMMDev;
    7171
    72 #endif // ____H_VMMDEV
     72#endif // !____H_VMMDEV
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