VirtualBox

Changeset 25966 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jan 22, 2010 11:15:43 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56818
Message:

PDMIBASE refactoring; use UUID as interface IDs.

Location:
trunk/src/VBox/Devices
Files:
1 added
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r25770 r25966  
    206206    /** Pointer to the attached audio driver. */
    207207    PPDMIBASE               pDrvBase;
    208     /** The base interface. */
     208    /** The base interface for LUN\#0. */
    209209    PDMIBASE                IBase;
    210210    /** Base port of the I/O space region. */
     
    15381538
    15391539/**
    1540  * Queries an interface to the driver.
    1541  *
    1542  * @returns Pointer to interface.
    1543  * @returns NULL if the interface was not supported by the driver.
    1544  * @param   pInterface          Pointer to this interface structure.
    1545  * @param   enmInterface        The requested interface identification.
    1546  * @thread  Any thread.
     1540 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    15471541 */
    15481542static DECLCALLBACK(void *) ichac97QueryInterface (struct PDMIBASE *pInterface,
    1549                                                    PDMINTERFACE enmInterface)
    1550 {
    1551     PCIAC97LinkState *pThis =
    1552         (PCIAC97LinkState *)((uintptr_t)pInterface
    1553                              - RT_OFFSETOF(PCIAC97LinkState, ac97.IBase));
     1543                                                   const char *pszIID)
     1544{
     1545    PCIAC97LinkState *pThis = RT_FROM_MEMBER(pInterface, PCIAC97LinkState, ac97.IBase);
    15541546    Assert(&pThis->ac97.IBase == pInterface);
    1555     switch (enmInterface)
    1556     {
    1557         case PDMINTERFACE_BASE:
    1558             return &pThis->ac97.IBase;
    1559         default:
    1560             return NULL;
    1561     }
     1547
     1548    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1549        return &pThis->ac97.IBase;
     1550    return NULL;
    15621551}
    15631552
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r24265 r25966  
    3636#include <iprt/assert.h>
    3737#include <iprt/string.h>
     38#include <iprt/uuid.h>
    3839#include "../vl_vbox.h"
    3940
     
    188189    PTMTIMER  pTimer;
    189190    PPDMIBASE pDrvBase;
     191    /** LUN\#0: Base interface. */
    190192    PDMIBASE  IBase;
    191193#endif
     
    17701772}
    17711773
     1774/**
     1775 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     1776 */
    17721777static DECLCALLBACK(void *) sb16QueryInterface (struct PDMIBASE *pInterface,
    1773                                                 PDMINTERFACE enmInterface)
    1774 {
    1775     SB16State *pThis = (SB16State *)((uintptr_t)pInterface
    1776                      - RT_OFFSETOF(SB16State, IBase));
     1778                                                const char *pszIID)
     1779{
     1780    SB16State *pThis = RT_FROM_MEMBER(pInterface, SB16State, IBase);
    17771781    Assert(&pThis->IBase == pInterface);
    1778     switch (enmInterface)
    1779     {
    1780         case PDMINTERFACE_BASE:
    1781             return &pThis->IBase;
    1782         default:
    1783             return NULL;
    1784     }
     1782
     1783    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1784        return &pThis->IBase;
     1785    return NULL;
    17851786}
    17861787
  • trunk/src/VBox/Devices/Audio/audio.c

    r25893 r25966  
    19261926
    19271927/**
    1928  * Queries an interface to the driver.
    1929  *
    1930  * @returns Pointer to interface.
    1931  * @returns NULL if the interface was not supported by the driver.
    1932  * @param   pInterface          Pointer to this interface structure.
    1933  * @param   enmInterface        The requested interface identification.
    1934  * @thread  Any thread.
     1928 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    19351929 */
    1936 static DECLCALLBACK(void *) drvAudioQueryInterface(PPDMIBASE pInterface,
    1937                                                    PDMINTERFACE enmInterface)
     1930static DECLCALLBACK(void *) drvAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    19381931{
    19391932    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    1940     PDRVAUDIO  pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
    1941     switch (enmInterface)
    1942     {
    1943         case PDMINTERFACE_BASE:
    1944             return &pDrvIns->IBase;
    1945         case PDMINTERFACE_AUDIO_CONNECTOR:
    1946             return &pThis->IAudioConnector;
    1947         default:
    1948             return NULL;
    1949     }
     1933    PDRVAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
     1934    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1935        return &pDrvIns->IBase;
     1936    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_AUDIO_CONNECTOR) == 0)
     1937        return &pThis->IAudioConnector;
     1938    return NULL;
    19501939}
    19511940
  • trunk/src/VBox/Devices/Audio/audiosniffer.c

    r12978 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox audio device:
    4  * Audio sniffer device
     3 * VBox audio device: Audio sniffer device
    54 */
    65
     
    108107 */
    109108
    110 /* Converts a Audio Sniffer port interface pointer to a Audio Sniffer state pointer. */
    111 #define IAUDIOSNIFFERPORT_2_AUDIOSNIFFERSTATE(pInterface) ((AUDIOSNIFFERSTATE *)((uintptr_t)pInterface - RT_OFFSETOF(AUDIOSNIFFERSTATE, Port)))
    112 
    113109static DECLCALLBACK(int) iface_Setup (PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio)
    114110{
    115     AUDIOSNIFFERSTATE *pThis = IAUDIOSNIFFERPORT_2_AUDIOSNIFFERSTATE(pInterface);
     111    AUDIOSNIFFERSTATE *pThis = RT_FROM_MEMBER(pInterface, AUDIOSNIFFERSTATE, Port);
    116112
    117113    Assert(g_pData == pThis);
     
    124120
    125121/**
    126  * Queries an interface to the device.
    127  *
    128  * @returns Pointer to interface.
    129  * @returns NULL if the interface was not supported by the driver.
    130  * @param   pInterface          Pointer to this interface structure.
    131  * @param   enmInterface        The requested interface identification.
    132  */
    133 static DECLCALLBACK(void *) iface_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    134 {
    135     AUDIOSNIFFERSTATE *pThis = (AUDIOSNIFFERSTATE *)((uintptr_t)pInterface - RT_OFFSETOF(AUDIOSNIFFERSTATE, Base));
    136 
    137     switch (enmInterface)
    138     {
    139         case PDMINTERFACE_BASE:
    140             return &pThis->Base;
    141         case PDMINTERFACE_AUDIO_SNIFFER_PORT:
    142             return &pThis->Port;
    143         default:
    144             return NULL;
    145     }
     122 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     123 */
     124static DECLCALLBACK(void *) iface_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
     125{
     126    AUDIOSNIFFERSTATE *pThis = RT_FROM_MEMBER(pInterface, AUDIOSNIFFERSTATE, Base);
     127    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     128        return &pThis->Base;
     129    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_AUDIO_SNIFFER_PORT) == 0)
     130        return &pThis->Port;
     131    return NULL;
    146132}
    147133
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r25732 r25966  
    134134#include <iprt/time.h>
    135135#include <iprt/string.h>
     136#include <iprt/uuid.h>
    136137
    137138#include <VBox/VMMDev.h>
     
    47334734
    47344735/**
    4735  * Queries an interface to the driver.
    4736  *
    4737  * @returns Pointer to interface.
    4738  * @returns NULL if the interface was not supported by the driver.
    4739  * @param   pInterface          Pointer to this interface structure.
    4740  * @param   enmInterface        The requested interface identification.
    4741  * @thread  Any thread.
     4736 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    47424737 */
    4743 static DECLCALLBACK(void *) vgaPortQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    4744 {
    4745     PVGASTATE pThis = (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, Base));
    4746     switch (enmInterface)
    4747     {
    4748         case PDMINTERFACE_BASE:
    4749             return &pThis->Base;
    4750         case PDMINTERFACE_DISPLAY_PORT:
    4751             return &pThis->Port;
     4738static DECLCALLBACK(void *) vgaPortQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     4739{
     4740    PVGASTATE pThis = RT_FROM_MEMBER(pInterface, VGASTATE, Base);
     4741    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     4742        return &pThis->Base;
     4743    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_DISPLAY_PORT) == 0)
     4744        return &pThis->Port;
    47524745#if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
    4753         case PDMINTERFACE_DISPLAY_VBVA_CALLBACKS:
    4754             return &pThis->VBVACallbacks;
    4755 #endif
    4756         default:
    4757             return NULL;
    4758     }
     4746    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_DISPLAY_VBVA_CALLBACKS) == 0)
     4747        return &pThis->VBVACallbacks;
     4748#endif
     4749    return NULL;
    47594750}
    47604751
  • trunk/src/VBox/Devices/Graphics/DevVGA.h

    r25062 r25966  
    303303    PDMCRITSECT                 lock;
    304304
    305     /** The display port base interface. */
     305    /** LUN\#0: The display port base interface. */
    306306    PDMIBASE                    Base;
    307     /** The display port interface. */
     307    /** LUN\#0: The display port interface. */
    308308    PDMIDISPLAYPORT             Port;
    309309# if HC_ARCH_BITS == 32
     
    311311# endif
    312312#if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL)
    313     /** VBVA callbacks interface */
     313    /** LUN\#0: VBVA callbacks interface */
    314314    PDMDDISPLAYVBVACALLBACKS    VBVACallbacks;
    315315#else
  • trunk/src/VBox/Devices/Input/DevPS2.cpp

    r25732 r25966  
    5353#include <VBox/pdmdev.h>
    5454#include <iprt/assert.h>
     55#include <iprt/uuid.h>
    5556
    5657#include "../Builtins.h"
     
    221222    /**
    222223     * Keyboard port - LUN#0.
     224     *
     225     * @implements  PDMIBASE
     226     * @implements  PDMIKEYBOARDPORT
    223227     */
    224228    struct
     
    237241    /**
    238242     * Mouse port - LUN#1.
     243     *
     244     * @implements  PDMIBASE
     245     * @implements  PDMIMOUSEPORT
    239246     */
    240247    struct
     
    13491356
    13501357/**
    1351  * Queries an interface to the driver.
    1352  *
    1353  * @returns Pointer to interface.
    1354  * @returns NULL if the interface was not supported by the device.
    1355  * @param   pInterface          Pointer to the keyboard port base interface (KBDState::Keyboard.Base).
    1356  * @param   enmInterface        The requested interface identification.
    1357  */
    1358 static DECLCALLBACK(void *)  kbdKeyboardQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    1359 {
    1360     KBDState *pThis = (KBDState *)((uintptr_t)pInterface -  RT_OFFSETOF(KBDState, Keyboard.Base));
    1361     switch (enmInterface)
    1362     {
    1363         case PDMINTERFACE_BASE:
    1364             return &pThis->Keyboard.Base;
    1365         case PDMINTERFACE_KEYBOARD_PORT:
    1366             return &pThis->Keyboard.Port;
    1367         default:
    1368             return NULL;
    1369     }
     1358 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     1359 */
     1360static DECLCALLBACK(void *)  kbdKeyboardQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     1361{
     1362    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Keyboard.Base);
     1363    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1364        return &pThis->Keyboard.Base;
     1365    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_KEYBOARD_PORT) == 0)
     1366        return &pThis->Keyboard.Port;
     1367    return NULL;
    13701368}
    13711369
    13721370
    13731371/* -=-=-=-=-=- Keyboard: IKeyboardPort  -=-=-=-=-=- */
    1374 
    1375 /** Converts a keyboard port interface pointer to a keyboard state pointer. */
    1376 #define IKEYBOARDPORT_2_KBDSTATE(pInterface) ( (KBDState *)((uintptr_t)pInterface -  RT_OFFSETOF(KBDState, Keyboard.Port)) )
    13771372
    13781373/**
     
    13851380static DECLCALLBACK(int) kbdKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode)
    13861381{
    1387     KBDState *pThis = IKEYBOARDPORT_2_KBDSTATE(pInterface);
     1382    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Keyboard.Port);
    13881383    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    13891384    AssertReleaseRC(rc);
     1385
    13901386    pc_kbd_put_keycode(pThis, u8KeyCode);
     1387
    13911388    PDMCritSectLeave(&pThis->CritSect);
    13921389    return VINF_SUCCESS;
     
    13971394
    13981395/**
    1399  * Queries an interface to the driver.
    1400  *
    1401  * @returns Pointer to interface.
    1402  * @returns NULL if the interface was not supported by the device.
    1403  * @param   pInterface          Pointer to the mouse port base interface (KBDState::Mouse.Base).
    1404  * @param   enmInterface        The requested interface identification.
    1405  */
    1406 static DECLCALLBACK(void *)  kbdMouseQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    1407 {
    1408     KBDState *pThis = (KBDState *)((uintptr_t)pInterface -  RT_OFFSETOF(KBDState, Mouse.Base));
    1409     switch (enmInterface)
    1410     {
    1411         case PDMINTERFACE_BASE:
    1412             return &pThis->Mouse.Base;
    1413         case PDMINTERFACE_MOUSE_PORT:
    1414             return &pThis->Mouse.Port;
    1415         default:
    1416             return NULL;
    1417     }
     1396 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     1397 */
     1398static DECLCALLBACK(void *)  kbdMouseQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     1399{
     1400    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.Base);
     1401    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1402        return &pThis->Mouse.Base;
     1403    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUSE_PORT) == 0)
     1404        return &pThis->Mouse.Port;
     1405    return NULL;
    14181406}
    14191407
    14201408
    14211409/* -=-=-=-=-=- Mouse: IMousePort  -=-=-=-=-=- */
    1422 
    1423 /** Converts a mouse port interface pointer to a keyboard state pointer. */
    1424 #define IMOUSEPORT_2_KBDSTATE(pInterface) ( (KBDState *)((uintptr_t)pInterface -  RT_OFFSETOF(KBDState, Mouse.Port)) )
    14251410
    14261411/**
     
    14361421static DECLCALLBACK(int) kbdMousePutEvent(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, int32_t i32DeltaW, uint32_t fButtonStates)
    14371422{
    1438     KBDState *pThis = IMOUSEPORT_2_KBDSTATE(pInterface);
     1423    KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.Port);
    14391424    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
    14401425    AssertReleaseRC(rc);
     1426
    14411427    pc_kbd_mouse_event(pThis, i32DeltaX, i32DeltaY, i32DeltaZ, i32DeltaW, fButtonStates);
     1428
    14421429    PDMCritSectLeave(&pThis->CritSect);
    14431430    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Input/DrvKeyboardQueue.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox input devices:
    4  * Keyboard queue driver
     3 * VBox input devices: Keyboard queue driver
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2827#include <VBox/pdmdrv.h>
    2928#include <iprt/assert.h>
     29#include <iprt/uuid.h>
    3030
    3131#include "Builtins.h"
     
    3838/**
    3939 * Keyboard queue driver instance data.
     40 *
     41 * @implements  PDMIKEYBOARDCONNECTOR
     42 * @implements  PDMIKEYBOARDPORT
    4043 */
    4144typedef struct DRVKBDQUEUE
     
    7578
    7679/**
    77  * Queries an interface to the driver.
    78  *
    79  * @returns Pointer to interface.
    80  * @returns NULL if the interface was not supported by the driver.
    81  * @param   pInterface          Pointer to this interface structure.
    82  * @param   enmInterface        The requested interface identification.
    83  */
    84 static DECLCALLBACK(void *)  drvKbdQueueQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    85 {
    86     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    87     PDRVKBDQUEUE pDrv = PDMINS_2_DATA(pDrvIns, PDRVKBDQUEUE);
    88     switch (enmInterface)
    89     {
    90         case PDMINTERFACE_BASE:
    91             return &pDrvIns->IBase;
    92         case PDMINTERFACE_KEYBOARD_PORT:
    93             return &pDrv->Port;
    94         case PDMINTERFACE_KEYBOARD_CONNECTOR:
    95             return &pDrv->Connector;
    96         default:
    97             return NULL;
    98     }
     80 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     81 */
     82static DECLCALLBACK(void *)  drvKbdQueueQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     83{
     84    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     85    PDRVKBDQUEUE    pThis   = PDMINS_2_DATA(pDrvIns, PDRVKBDQUEUE);
     86
     87    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     88        return &pDrvIns->IBase;
     89    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_KEYBOARD_CONNECTOR) == 0)
     90        return &pThis->Connector;
     91    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_KEYBOARD_PORT) == 0)
     92        return &pThis->Port;
     93    return NULL;
    9994}
    10095
  • trunk/src/VBox/Devices/Input/DrvMouseQueue.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox input devices:
    4  * Mouse queue driver
     3 * VBox input devices: Mouse queue driver
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2827#include <VBox/pdmdrv.h>
    2928#include <iprt/assert.h>
     29#include <iprt/uuid.h>
    3030
    3131#include "Builtins.h"
     
    3838/**
    3939 * Mouse queue driver instance data.
     40 *
     41 * @implements  PDMIMOUSECONNECTOR
     42 * @implements  PDMIMOUSEPORT
    4043 */
    4144typedef struct DRVMOUSEQUEUE
     
    7881
    7982/**
    80  * Queries an interface to the driver.
    81  *
    82  * @returns Pointer to interface.
    83  * @returns NULL if the interface was not supported by the driver.
    84  * @param   pInterface          Pointer to this interface structure.
    85  * @param   enmInterface        The requested interface identification.
    86  */
    87 static DECLCALLBACK(void *)  drvMouseQueueQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    88 {
    89     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    90     PDRVMOUSEQUEUE pDrv = PDMINS_2_DATA(pDrvIns, PDRVMOUSEQUEUE);
    91     switch (enmInterface)
    92     {
    93         case PDMINTERFACE_BASE:
    94             return &pDrvIns->IBase;
    95         case PDMINTERFACE_MOUSE_PORT:
    96             return &pDrv->Port;
    97         case PDMINTERFACE_MOUSE_CONNECTOR:
    98             return &pDrv->Connector;
    99         default:
    100             return NULL;
    101     }
     83 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     84 */
     85static DECLCALLBACK(void *)  drvMouseQueueQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     86{
     87    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     88    PDRVMOUSEQUEUE  pThis   = PDMINS_2_DATA(pDrvIns, PDRVMOUSEQUEUE);
     89    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     90        return &pDrvIns->IBase;
     91    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUSE_PORT) == 0)
     92        return &pThis->Port;
     93    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUSE_CONNECTOR) == 0)
     94        return &pThis->Connector;
     95    return NULL;
    10296}
    10397
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r25876 r25966  
    5151#include <iprt/semaphore.h>
    5252#include <iprt/string.h>
     53#include <iprt/uuid.h>
    5354#include <VBox/pdmdev.h>
    5455#include <VBox/tm.h>
     
    832833/**
    833834 * Device state structure. Holds the current state of device.
     835 *
     836 * @implements  PDMINETWORKPORT
     837 * @implements  PDMINETWORKCONFIG
     838 * @implements  PDMILEDPORTS
    834839 */
    835840struct E1kState_st
     
    44554460
    44564461/**
    4457  * Provides interfaces to the driver.
    4458  *
    4459  * @returns Pointer to interface. NULL if the interface is not supported.
    4460  * @param   pInterface          Pointer to this interface structure.
    4461  * @param   enmInterface        The requested interface identification.
    4462  * @thread  EMT
    4463  */
    4464 static DECLCALLBACK(void *) e1kQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface)
    4465 {
    4466     E1KSTATE *pState = IFACE_TO_STATE(pInterface, IBase);
    4467     Assert(&pState->IBase == pInterface);
    4468     switch (enmInterface)
    4469     {
    4470         case PDMINTERFACE_BASE:
    4471             return &pState->IBase;
    4472         case PDMINTERFACE_NETWORK_PORT:
    4473             return &pState->INetworkPort;
    4474         case PDMINTERFACE_NETWORK_CONFIG:
    4475             return &pState->INetworkConfig;
    4476         case PDMINTERFACE_LED_PORTS:
    4477             return &pState->ILeds;
    4478         default:
    4479             return NULL;
    4480     }
     4462 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     4463 */
     4464static DECLCALLBACK(void *) e1kQueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     4465{
     4466    E1KSTATE *pThis = IFACE_TO_STATE(pInterface, IBase);
     4467    Assert(&pThis->IBase == pInterface);
     4468
     4469    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     4470        return &pThis->IBase;
     4471    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0)
     4472        return &pThis->INetworkPort;
     4473    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0)
     4474        return &pThis->INetworkConfig;
     4475    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     4476        return &pThis->ILeds;
     4477    return NULL;
    44814478}
    44824479
  • trunk/src/VBox/Devices/Network/DevINIP.cpp

    r25728 r25966  
    4747#include <VBox/pdmdev.h>
    4848#include <VBox/tm.h>
     49#include <iprt/assert.h>
    4950#include <iprt/string.h>
    50 #include <iprt/assert.h>
     51#include <iprt/uuid.h>
    5152
    5253#include "../Builtins.h"
     
    6768/**
    6869 * Internal Network IP stack device instance data.
     70 *
     71 * @implements PDMIBASE
     72 * @implements PDMINETWORKPORT
    6973 */
    7074typedef struct DEVINTNETIP
    7175{
    72     /** The base interface. */
     76    /** The base interface for LUN\#0. */
    7377    PDMIBASE                IBase;
    74     /** The network port this device provides. */
     78    /** The network port this device provides (LUN\#0). */
    7579    PDMINETWORKPORT         INetworkPort;
    7680    /** The base interface of the network driver below us. */
     
    387391
    388392/**
    389  * Queries an interface to the device.
    390  *
    391  * @returns Pointer to interface.
    392  * @returns NULL if the interface was not supported by the device.
    393  * @param   pInterface          Pointer to this interface structure.
    394  * @param   enmInterface        The requested interface identification.
    395  * @thread  Any thread.
     393 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    396394 */
    397395static DECLCALLBACK(void *) devINIPQueryInterface(PPDMIBASE pInterface,
    398                                                   PDMINTERFACE enmInterface)
    399 {
    400     PDEVINTNETIP pThis = (PDEVINTNETIP)((uintptr_t)pInterface - RT_OFFSETOF(DEVINTNETIP, IBase));
    401     switch (enmInterface)
    402     {
    403         case PDMINTERFACE_BASE:
    404             return &pThis->IBase;
    405         case PDMINTERFACE_NETWORK_PORT:
    406             return &pThis->INetworkPort;
    407         default:
    408             return NULL;
    409     }
     396                                                  const char *pszIID)
     397{
     398    PDEVINTNETIP pThis = RT_FROM_MEMBER(pInterface, DEVINTNETIP, IBase);
     399    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     400        return &pThis->IBase;
     401    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0)
     402        return &pThis->INetworkPort;
     403    return NULL;
    410404}
    411405
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r25780 r25966  
    6868# include <iprt/mem.h>
    6969# include <iprt/semaphore.h>
     70# include <iprt/uuid.h>
    7071#endif
    7172
     
    109110typedef struct PCNetState_st PCNetState;
    110111
     112/**
     113 * PCNET state.
     114 *
     115 * @extends     PCIDEVICE
     116 * @implements  PDMIBASE
     117 * @implements  PDMINETWORKPORT
     118 * @implements  PDMINETWORKCONFIG
     119 * @implements  PDMILEDPORTS
     120 */
    111121struct PCNetState_st
    112122{
     
    197207    /** Pointer to the attached network driver. */
    198208    R3PTRTYPE(PPDMIBASE)                pDrvBase;
    199     /** The base interface. */
     209    /** LUN\#0 + status LUN: The base interface. */
    200210    PDMIBASE                            IBase;
    201     /** The network port interface. */
     211    /** LUN\#0: The network port interface. */
    202212    PDMINETWORKPORT                     INetworkPort;
    203     /** The network config port interface. */
     213    /** LUN\#0: The network config port interface. */
    204214    PDMINETWORKCONFIG                   INetworkConfig;
    205215    /** Base address of the MMIO region. */
     
    221231    /** The LED. */
    222232    PDMLED                              Led;
    223     /** The LED ports. */
     233    /** Status LUN: The LED ports. */
    224234    PDMILEDPORTS                        ILeds;
    225235    /** Partner of ILeds. */
     
    44714481
    44724482/**
    4473  * Queries an interface to the driver.
    4474  *
    4475  * @returns Pointer to interface.
    4476  * @returns NULL if the interface was not supported by the driver.
    4477  * @param   pInterface          Pointer to this interface structure.
    4478  * @param   enmInterface        The requested interface identification.
    4479  * @thread  Any thread.
    4480  */
    4481 static DECLCALLBACK(void *) pcnetQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface)
    4482 {
    4483     PCNetState *pThis = (PCNetState *)((uintptr_t)pInterface - RT_OFFSETOF(PCNetState, IBase));
     4483 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     4484 */
     4485static DECLCALLBACK(void *) pcnetQueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     4486{
     4487    PCNetState *pThis = RT_FROM_MEMBER(pInterface, PCNetState, IBase);
    44844488    Assert(&pThis->IBase == pInterface);
    4485     switch (enmInterface)
    4486     {
    4487         case PDMINTERFACE_BASE:
    4488             return &pThis->IBase;
    4489         case PDMINTERFACE_NETWORK_PORT:
    4490             return &pThis->INetworkPort;
    4491         case PDMINTERFACE_NETWORK_CONFIG:
    4492             return &pThis->INetworkConfig;
    4493         case PDMINTERFACE_LED_PORTS:
    4494             return &pThis->ILeds;
    4495         default:
    4496             return NULL;
    4497     }
     4489    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     4490        return &pThis->IBase;
     4491    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0)
     4492        return &pThis->INetworkPort;
     4493    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0)
     4494        return &pThis->INetworkConfig;
     4495    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     4496        return &pThis->ILeds;
     4497    return NULL;
    44984498}
    44994499
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r25955 r25966  
    22/** @file
    33 * DevVirtioNet - Virtio Network Device
    4  *
    54 */
    65
     
    2928#ifdef IN_RING3
    3029# include <iprt/mem.h>
     30# include <iprt/uuid.h>
    3131#endif /* IN_RING3 */
    3232#include "../Builtins.h"
     
    107107/**
    108108 * Device state structure. Holds the current state of device.
    109  */
    110 
     109 *
     110 * @extends     VPCISTATE
     111 * @implements  PDMINETWORKPORT
     112 * @implements  PDMINETWORKCONFIG
     113 */
    111114struct VNetState_st
    112115{
     
    578581
    579582/**
    580  * Provides interfaces to the driver.
    581  *
    582  * @returns Pointer to interface. NULL if the interface is not supported.
    583  * @param   pInterface          Pointer to this interface structure.
    584  * @param   enmInterface        The requested interface identification.
    585  * @thread  EMT
    586  */
    587 static DECLCALLBACK(void *) vnetQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface)
    588 {
    589     VNETSTATE *pState = IFACE_TO_STATE(pInterface, VPCI.IBase);
    590     Assert(&pState->VPCI.IBase == pInterface);
    591     switch (enmInterface)
    592     {
    593         case PDMINTERFACE_NETWORK_PORT:
    594             return &pState->INetworkPort;
    595         case PDMINTERFACE_NETWORK_CONFIG:
    596             return &pState->INetworkConfig;
    597         default:
    598             return vpciQueryInterface(pInterface, enmInterface);
    599     }
     583 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     584 */
     585static DECLCALLBACK(void *) vnetQueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     586{
     587    VNETSTATE *pThis = IFACE_TO_STATE(pInterface, VPCI.IBase);
     588    Assert(&pThis->VPCI.IBase == pInterface);
     589
     590    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0)
     591        return &pThis->INetworkPort;
     592    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0)
     593        return &pThis->INetworkConfig;
     594    return vpciQueryInterface(pInterface, pszIID);
    600595}
    601596
     
    858853    }
    859854
    860     Log3(("%s vnetTransmitPendingPackets: About to trasmit %d pending packets\n", INSTANCE(pState), 
     855    Log3(("%s vnetTransmitPendingPackets: About to trasmit %d pending packets\n", INSTANCE(pState),
    861856          vringReadAvailIndex(&pState->VPCI, &pState->pTxQueue->VRing) - pState->pTxQueue->uNextAvailIndex));
    862857
     
    965960            u32MicroDiff, pState->u32AvgDiff, pState->u32MinDiff, pState->u32MaxDiff));
    966961
    967 //    Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState))); 
     962//    Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState)));
    968963    vnetTransmitPendingPackets(pState, pState->pTxQueue);
    969964    if (RT_FAILURE(vnetCsEnter(pState, VERR_SEM_BUSY)))
     
    14611456
    14621457    /* Initialize PCI part first. */
    1463     pState->VPCI.IBase.pfnQueryInterface     = vnetQueryInterface;
     1458    pState->VPCI.IBase.pfnQueryInterface    = vnetQueryInterface;
    14641459    rc = vpciConstruct(pDevIns, &pState->VPCI, iInstance,
    14651460                       VNET_NAME_FMT, VNET_PCI_SUBSYSTEM_ID,
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r25893 r25966  
    3939#include <iprt/time.h>
    4040#include <iprt/thread.h>
     41#include <iprt/uuid.h>
    4142
    4243#include "../Builtins.h"
     
    6364/**
    6465 * Block driver instance data.
     66 *
     67 * @implements  PDMINETWORKCONNECTOR
    6568 */
    6669typedef struct DRVINTNET
     
    576579
    577580/**
    578  * Queries an interface to the driver.
    579  *
    580  * @returns Pointer to interface.
    581  * @returns NULL if the interface was not supported by the driver.
    582  * @param   pInterface          Pointer to this interface structure.
    583  * @param   enmInterface        The requested interface identification.
    584  * @thread  Any thread.
    585  */
    586 static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     581 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     582 */
     583static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    587584{
    588585    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    589     PDRVINTNET pThis = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
    590     switch (enmInterface)
    591     {
    592         case PDMINTERFACE_BASE:
    593             return &pDrvIns->IBase;
    594         case PDMINTERFACE_NETWORK_CONNECTOR:
    595             return &pThis->INetworkConnector;
    596         default:
    597             return NULL;
    598     }
     586    PDRVINTNET pThis   = PDMINS_2_DATA(pDrvIns, PDRVINTNET);
     587
     588    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     589        return &pDrvIns->IBase;
     590    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0)
     591        return &pThis->INetworkConnector;
     592    return NULL;
    599593}
    600594
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r25893 r25966  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3737#include <iprt/cidr.h>
    3838#include <iprt/stream.h>
     39#include <iprt/uuid.h>
    3940
    4041#include "Builtins.h"
     
    118119/**
    119120 * NAT network transport driver instance data.
     121 *
     122 * @implements  PDMINETWORKCONNECTOR
    120123 */
    121124typedef struct DRVNAT
     
    803806
    804807/**
    805  * Queries an interface to the driver.
    806  *
    807  * @returns Pointer to interface.
    808  * @returns NULL if the interface was not supported by the driver.
    809  * @param   pInterface          Pointer to this interface structure.
    810  * @param   enmInterface        The requested interface identification.
    811  * @thread  Any thread.
    812  */
    813 static DECLCALLBACK(void *) drvNATQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    814 {
    815     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    816     PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
    817     switch (enmInterface)
    818     {
    819         case PDMINTERFACE_BASE:
    820             return &pDrvIns->IBase;
    821         case PDMINTERFACE_NETWORK_CONNECTOR:
    822             return &pThis->INetworkConnector;
    823         default:
    824             return NULL;
    825     }
     808 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     809 */
     810static DECLCALLBACK(void *) drvNATQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     811{
     812    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     813    PDRVNAT     pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
     814
     815    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     816        return &pDrvIns->IBase;
     817    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0)
     818        return &pThis->INetworkConnector;
     819    return NULL;
    826820}
    827821
     
    10391033                                N_("Configuration error: the above device/driver didn't "
    10401034                                "export the network port interface"));
    1041     pThis->pConfig =
    1042                 (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase,
    1043                                                                         PDMINTERFACE_NETWORK_CONFIG);
     1035    pThis->pConfig = (PPDMINETWORKCONFIG)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase,
     1036                                                                             PDMINTERFACE_NETWORK_CONFIG);
    10441037    if (!pThis->pConfig)
    10451038        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE,
  • trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox network devices:
    4  * Network sniffer filter driver
     3 * DrvNetSniffer - Network sniffer filter driver.
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3029#include <VBox/log.h>
    3130#include <iprt/assert.h>
     31#include <iprt/critsect.h>
    3232#include <iprt/file.h>
    3333#include <iprt/process.h>
    3434#include <iprt/string.h>
    3535#include <iprt/time.h>
    36 #include <iprt/critsect.h>
     36#include <iprt/uuid.h>
    3737#include <VBox/param.h>
    3838
     
    4646/**
    4747 * Block driver instance data.
     48 *
     49 * @implements  PDMINETWORKCONNECTOR
     50 * @implements  PDMINETWORKPORT
     51 * @implements  PDMINETWORKCONFIG
    4852 */
    4953typedef struct DRVNETSNIFFER
     
    248252
    249253/**
    250  * Queries an interface to the driver.
    251  *
    252  * @returns Pointer to interface.
    253  * @returns NULL if the interface was not supported by the driver.
    254  * @param   pInterface          Pointer to this interface structure.
    255  * @param   enmInterface        The requested interface identification.
    256  * @thread  Any thread.
    257  */
    258 static DECLCALLBACK(void *) drvNetSnifferQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    259 {
    260     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    261     PDRVNETSNIFFER pThis = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER);
    262     switch (enmInterface)
    263     {
    264         case PDMINTERFACE_BASE:
    265             return &pDrvIns->IBase;
    266         case PDMINTERFACE_NETWORK_CONNECTOR:
    267             return &pThis->INetworkConnector;
    268         case PDMINTERFACE_NETWORK_PORT:
    269             return &pThis->INetworkPort;
    270         case PDMINTERFACE_NETWORK_CONFIG:
    271             return &pThis->INetworkConfig;
    272         default:
    273             return NULL;
    274     }
     254 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     255 */
     256static DECLCALLBACK(void *) drvNetSnifferQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     257{
     258    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     259    PDRVNETSNIFFER  pThis   = PDMINS_2_DATA(pDrvIns, PDRVNETSNIFFER);
     260    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     261        return &pDrvIns->IBase;
     262    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0)
     263        return &pThis->INetworkConnector;
     264    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_PORT) == 0)
     265        return &pThis->INetworkPort;
     266    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONFIG) == 0)
     267        return &pThis->INetworkConfig;
     268    return NULL;
    275269}
    276270
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r25893 r25966  
    1 /** $Id$ */
     1/* $Id$ */
    22/** @file
    3  * Universial TAP network transport driver.
     3 * DrvTAP - Universial TAP network transport driver.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727#include <VBox/pdmdrv.h>
    2828
     29#include <iprt/asm.h>
    2930#include <iprt/assert.h>
    3031#include <iprt/ctype.h>
    3132#include <iprt/file.h>
     33#include <iprt/path.h>
     34#include <iprt/semaphore.h>
    3235#include <iprt/string.h>
    33 #include <iprt/path.h>
    3436#include <iprt/thread.h>
    35 #include <iprt/asm.h>
    36 #include <iprt/semaphore.h>
     37#include <iprt/uuid.h>
    3738#ifdef RT_OS_SOLARIS
    3839# include <iprt/process.h>
     
    8081*******************************************************************************/
    8182/**
    82  * Block driver instance data.
     83 * TAP driver instance data.
     84 *
     85 * @implements PDMINETWORKCONNECTOR
    8386 */
    8487typedef struct DRVTAP
     
    774777
    775778/**
    776  * Queries an interface to the driver.
    777  *
    778  * @returns Pointer to interface.
    779  * @returns NULL if the interface was not supported by the driver.
    780  * @param   pInterface          Pointer to this interface structure.
    781  * @param   enmInterface        The requested interface identification.
    782  * @thread  Any thread.
    783  */
    784 static DECLCALLBACK(void *) drvTAPQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    785 {
    786     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    787     PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
    788     switch (enmInterface)
    789     {
    790         case PDMINTERFACE_BASE:
    791             return &pDrvIns->IBase;
    792         case PDMINTERFACE_NETWORK_CONNECTOR:
    793             return &pThis->INetworkConnector;
    794         default:
    795             return NULL;
    796     }
     779 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     780 */
     781static DECLCALLBACK(void *) drvTAPQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     782{
     783    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     784    PDRVTAP     pThis   = PDMINS_2_DATA(pDrvIns, PDRVTAP);
     785
     786    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     787        return &pDrvIns->IBase;
     788    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_NETWORK_CONNECTOR) == 0)
     789        return &pThis->INetworkConnector;
     790    return NULL;
    797791}
    798792
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r25928 r25966  
    3333# include <iprt/alloc.h>
    3434# include <iprt/string.h>
     35# include <iprt/uuid.h>
    3536#endif /* IN_RING3 */
    3637
     
    19351936
    19361937/**
    1937  * Queries an interface to the driver.
    1938  *
    1939  * @returns Pointer to interface.
    1940  * @returns NULL if the interface was not supported by the driver.
    1941  * @param   pInterface          Pointer to this interface structure.
    1942  * @param   enmInterface        The requested interface identification.
    1943  * @thread  Any thread.
     1938 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    19441939 */
    1945 static DECLCALLBACK(void *) acpiQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    1946 {
    1947     ACPIState *pThis = (ACPIState*)((uintptr_t)pInterface - RT_OFFSETOF(ACPIState, IBase));
    1948     switch (enmInterface)
    1949     {
    1950         case PDMINTERFACE_BASE:
    1951             return &pThis->IBase;
    1952         case PDMINTERFACE_ACPI_PORT:
    1953             return &pThis->IACPIPort;
    1954         default:
    1955             return NULL;
    1956     }
     1940static DECLCALLBACK(void *) acpiQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     1941{
     1942    ACPIState *pThis = RT_FROM_MEMBER(pInterface, ACPIState, IBase);
     1943    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1944        return &pThis->IBase;
     1945    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_PORT) == 0)
     1946        return &pThis->IACPIPort;
     1947    return NULL;
    19571948}
    19581949
  • trunk/src/VBox/Devices/PC/DrvACPI.cpp

    r25893 r25966  
    3333#include <iprt/assert.h>
    3434#include <iprt/string.h>
     35#include <iprt/uuid.h>
    3536
    3637#ifdef RT_OS_LINUX
     
    6667/**
    6768 * ACPI driver instance data.
     69 *
     70 * @implements  PDMIACPICONNECTOR
    6871 */
    6972typedef struct DRVACPI
     
    7982
    8083/**
    81  * Queries an interface to the driver.
    82  *
    83  * @returns Pointer to interface.
    84  * @returns NULL if the interface was not supported by the driver.
    85  * @param   pInterface          Pointer to this interface structure.
    86  * @param   enmInterface        The requested interface identification.
    87  * @thread  Any thread.
     84 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    8885 */
    89 static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     86static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    9087{
    9188    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    9289    PDRVACPI pThis = PDMINS_2_DATA(pDrvIns, PDRVACPI);
    93     switch (enmInterface)
    94     {
    95         case PDMINTERFACE_BASE:
    96             return &pDrvIns->IBase;
    97         case PDMINTERFACE_ACPI_CONNECTOR:
    98             return &pThis->IACPIConnector;
    99         default:
    100             return NULL;
    101     }
     90
     91    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     92        return &pDrvIns->IBase;
     93    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_CONNECTOR) == 0)
     94        return &pThis->IACPIConnector;
     95    return NULL;
    10296}
    10397
     
    117111    {
    118112        /* running on battery? */
    119         if (    (powerStatus.ACLineStatus == 0)
    120              || (powerStatus.ACLineStatus == 255)
    121              && (powerStatus.BatteryFlag & 15))
     113        if (    powerStatus.ACLineStatus == 0   /* Offline */
     114             || powerStatus.ACLineStatus == 255 /* Unknown */
     115             && (powerStatus.BatteryFlag & 15)  /* high | low | critical | charging */
     116           ) /** @todo why is 'charging' included in the flag test?  Add parenthesis around the right bits so the code is clearer. */
    122117        {
    123118            *pPowerSource = PDM_ACPI_POWER_SOURCE_BATTERY;
  • trunk/src/VBox/Devices/PC/DrvAcpiCpu.cpp

    r25893 r25966  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2929#include <iprt/assert.h>
    3030#include <iprt/string.h>
     31#include <iprt/uuid.h>
    3132
    3233#include "Builtins.h"
    3334
     35
    3436/**
    35  * Queries an interface to the driver.
    36  *
    37  * @returns Pointer to interface.
    38  * @returns NULL if the interface was not supported by the driver.
    39  * @param   pInterface          Pointer to this interface structure.
    40  * @param   enmInterface        The requested interface identification.
    41  * @thread  Any thread.
     37 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    4238 */
    43 static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     39static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    4440{
    4541    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    46 
    47     switch (enmInterface)
    48     {
    49         case PDMINTERFACE_BASE:
    50             return &pDrvIns->IBase;
    51         default:
    52             return NULL;
    53     }
     42    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     43        return &pDrvIns->IBase;
     44    return NULL;
    5445}
    5546
  • trunk/src/VBox/Devices/Parallel/DevParallel.cpp

    r25732 r25966  
    9393*   Structures and Typedefs                                                    *
    9494*******************************************************************************/
     95/**
     96 * Parallel device state.
     97 *
     98 * @implements  PDMIBASE
     99 * @implements  PDMIHOSTPARALLELPORT
     100 */
    95101typedef struct ParallelState
    96102{
     
    105111    PPDMDEVINSRC                        pDevInsRC;
    106112    RTRCPTR                             Alignment0; /**< Alignment. */
    107     /** The base interface. */
     113    /** LUN\#0: The base interface. */
    108114    PDMIBASE                            IBase;
    109     /** The host device port interface. */
     115    /** LUN\#0: The host device port interface. */
    110116    PDMIHOSTPARALLELPORT                IHostParallelPort;
    111117    /** Pointer to the attached base driver. */
     
    644650}
    645651
    646 /** @copydoc PIBASE::pfnqueryInterface */
    647 static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     652/**
     653 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     654 */
     655static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    648656{
    649657    ParallelState *pThis = PDMIBASE_2_PARALLELSTATE(pInterface);
    650     switch (enmInterface)
    651     {
    652         case PDMINTERFACE_BASE:
    653             return &pThis->IBase;
    654         case PDMINTERFACE_HOST_PARALLEL_PORT:
    655             return &pThis->IHostParallelPort;
    656         default:
    657             return NULL;
    658     }
     658    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     659        return &pThis->IBase;
     660    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_PORT) == 0)
     661        return &pThis->IHostParallelPort;
     662    return NULL;
    659663}
    660664
  • trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp

    r25893 r25966  
    77
    88/*
    9  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     9 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3030#include <iprt/asm.h>
    3131#include <iprt/assert.h>
     32#include <iprt/file.h>
     33#include <iprt/semaphore.h>
    3234#include <iprt/stream.h>
    33 #include <iprt/semaphore.h>
    34 #include <iprt/file.h>
     35#include <iprt/uuid.h>
    3536
    3637#ifdef RT_OS_LINUX
     
    4849#include "Builtins.h"
    4950
     51
    5052/*******************************************************************************
    5153*   Structures and Typedefs                                                    *
     
    5355/**
    5456 * Host parallel port driver instance data.
     57 * @implements PDMIHOSTPARALLELCONNECTOR
    5558 */
    5659typedef struct DRVHOSTPARALLEL
     
    6265    /** Our host device interface. */
    6366    PDMIHOSTPARALLELCONNECTOR     IHostParallelConnector;
    64     /** Our host device port interface. */
    65     PDMIHOSTPARALLELPORT          IHostParallelPort;
    6667    /** Device Path */
    67     char                          *pszDevicePath;
     68    char                         *pszDevicePath;
    6869    /** Device Handle */
    6970    RTFILE                        FileDevice;
     
    7879/** Converts a pointer to DRVHOSTPARALLEL::IHostDeviceConnector to a PDRHOSTPARALLEL. */
    7980#define PDMIHOSTPARALLELCONNECTOR_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelConnector)) )
    80 /** Converts a pointer to DRVHOSTPARALLEL::IHostDevicePort to a PDRHOSTPARALLEL. */
    81 #define PDMIHOSTPARALLELPORT_2_DRVHOSTPARALLEL(pInterface) ( (PDRVHOSTPARALLEL)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPARALLEL, IHostParallelPort)) )
     81
    8282
    8383/* -=-=-=-=- IBase -=-=-=-=- */
    8484
    8585/**
    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 static DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    94 {
    95     PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    96     PDRVHOSTPARALLEL    pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
    97     switch (enmInterface)
    98     {
    99         case PDMINTERFACE_BASE:
    100             return &pDrvIns->IBase;
    101         case PDMINTERFACE_HOST_PARALLEL_CONNECTOR:
    102             return &pThis->IHostParallelConnector;
    103         default:
    104             return NULL;
    105     }
     86 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     87 */
     88static DECLCALLBACK(void *) drvHostParallelQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     89{
     90    PPDMDRVINS          pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     91    PDRVHOSTPARALLEL    pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTPARALLEL);
     92
     93    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     94        return &pDrvIns->IBase;
     95    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HOST_PARALLEL_CONNECTOR) == 0)
     96        return &pThis->IHostParallelConnector;
     97    return NULL;
    10698}
    10799
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r25732 r25966  
    121121*   Structures and Typedefs                                                    *
    122122*******************************************************************************/
     123/**
     124 * Serial device.
     125 *
     126 * @implements  PDMIBASE
     127 * @implements  PDMICHARPORT
     128 */
    123129struct SerialState
    124130{
     
    133139    PPDMDEVINSRC                    pDevInsRC;
    134140    RTRCPTR                         Alignment0; /**< Alignment. */
    135     /** The base interface. */
     141    /** LUN\#0: The base interface. */
    136142    PDMIBASE                        IBase;
    137     /** The character port interface. */
     143    /** LUN\#0: The character port interface. */
    138144    PDMICHARPORT                    ICharPort;
    139145    /** Pointer to the attached base driver. */
     
    726732#endif /* VBOX_SERIAL_PCI */
    727733
    728 
    729 /** @copydoc PIBASE::pfnqueryInterface */
    730 static DECLCALLBACK(void *) serialQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     734/**
     735 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     736 */
     737static DECLCALLBACK(void *) serialQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    731738{
    732739    SerialState *pThis = PDMIBASE_2_SERIALSTATE(pInterface);
    733     switch (enmInterface)
    734     {
    735         case PDMINTERFACE_BASE:
    736             return &pThis->IBase;
    737         case PDMINTERFACE_CHAR_PORT:
    738             return &pThis->ICharPort;
    739         default:
    740             return NULL;
    741     }
     740    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     741        return &pThis->IBase;
     742    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_CHAR_PORT) == 0)
     743        return &pThis->ICharPort;
     744    return NULL;
    742745}
    743746
  • trunk/src/VBox/Devices/Serial/DrvChar.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox stream I/O devices:
    4  * Generic char driver
     3 * VBox stream I/O devices: Generic char driver
    54 */
    65
     
    3231#include <iprt/stream.h>
    3332#include <iprt/semaphore.h>
     33#include <iprt/uuid.h>
    3434
    3535#include "Builtins.h"
    3636
    3737
     38/*******************************************************************************
     39*   Defined Constants And Macros                                               *
     40*******************************************************************************/
    3841/** Size of the send fifo queue (in bytes) */
    3942#define CHAR_MAX_SEND_QUEUE             0x80
    4043#define CHAR_MAX_SEND_QUEUE_MASK        0x7f
    4144
     45/** Converts a pointer to DRVCHAR::IChar to a PDRVCHAR. */
     46#define PDMICHAR_2_DRVCHAR(pInterface) ( (PDRVCHAR)((uintptr_t)pInterface - RT_OFFSETOF(DRVCHAR, IChar)) )
     47
     48
    4249/*******************************************************************************
    4350*   Structures and Typedefs                                                    *
    4451*******************************************************************************/
    45 
    4652/**
    4753 * Char driver instance data.
     54 *
     55 * @implements PDMICHAR
    4856 */
    4957typedef struct DRVCHAR
     
    7987
    8088
    81 /** Converts a pointer to DRVCHAR::IChar to a PDRVCHAR. */
    82 #define PDMICHAR_2_DRVCHAR(pInterface) ( (PDRVCHAR)((uintptr_t)pInterface - RT_OFFSETOF(DRVCHAR, IChar)) )
    8389
    8490
     
    8692
    8793/**
    88  * Queries an interface to the driver.
    89  *
    90  * @returns Pointer to interface.
    91  * @returns NULL if the interface was not supported by the driver.
    92  * @param   pInterface          Pointer to this interface structure.
    93  * @param   enmInterface        The requested interface identification.
    94  */
    95 static DECLCALLBACK(void *) drvCharQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     94 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     95 */
     96static DECLCALLBACK(void *) drvCharQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    9697{
    9798    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    9899    PDRVCHAR    pThis = PDMINS_2_DATA(pDrvIns, PDRVCHAR);
    99     switch (enmInterface)
    100     {
    101         case PDMINTERFACE_BASE:
    102             return &pDrvIns->IBase;
    103         case PDMINTERFACE_CHAR:
    104             return &pThis->IChar;
    105         default:
    106             return NULL;
    107     }
     100
     101    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     102        return &pDrvIns->IBase;
     103    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_CHAR) == 0)
     104        return &pThis->IChar;
     105    return NULL;
    108106}
    109107
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r25893 r25966  
    3434#include <iprt/asm.h>
    3535#include <iprt/assert.h>
     36#include <iprt/file.h>
     37#include <iprt/mem.h>
    3638#include <iprt/semaphore.h>
    37 #include <iprt/file.h>
    38 #include <iprt/alloc.h>
     39#include <iprt/uuid.h>
    3940
    4041#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     
    9394/**
    9495 * Char driver instance data.
     96 *
     97 * @implements  PDMICHAR
    9598 */
    9699typedef struct DRVHOSTSERIAL
     
    169172
    170173/**
    171  * Queries an interface to the driver.
    172  *
    173  * @returns Pointer to interface.
    174  * @returns NULL if the interface was not supported by the driver.
    175  * @param   pInterface          Pointer to this interface structure.
    176  * @param   enmInterface        The requested interface identification.
     174 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    177175 */
    178 static DECLCALLBACK(void *) drvHostSerialQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     176static DECLCALLBACK(void *) drvHostSerialQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    179177{
    180     PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    181     PDRVHOSTSERIAL    pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
    182     switch (enmInterface)
    183     {
    184         case PDMINTERFACE_BASE:
    185             return &pDrvIns->IBase;
    186         case PDMINTERFACE_CHAR:
    187             return &pThis->IChar;
    188         default:
    189             return NULL;
    190     }
     178    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     179    PDRVHOSTSERIAL  pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTSERIAL);
     180
     181    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     182        return &pDrvIns->IBase;
     183    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_CHAR) == 0)
     184        return &pThis->IChar;
     185    return NULL;
    191186}
    192187
  • trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox stream devices:
    4  * Named pipe stream
     3 * VBox stream drivers: Named pipe stream
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3332#include <iprt/string.h>
    3433#include <iprt/semaphore.h>
     34#include <iprt/uuid.h>
    3535
    3636#include "Builtins.h"
    3737
    3838#ifdef RT_OS_WINDOWS
    39 #include <windows.h>
    40 #else /* !RT_OS_WINDOWS */
    41 #include <errno.h>
    42 #include <unistd.h>
    43 #include <sys/types.h>
    44 #include <sys/socket.h>
    45 #include <sys/un.h>
    46 #endif /* !RT_OS_WINDOWS */
     39# include <windows.h>
     40#else /* !RT_OS_WINDOWS */
     41# include <errno.h>
     42# include <unistd.h>
     43# include <sys/types.h>
     44# include <sys/socket.h>
     45# include <sys/un.h>
     46#endif /* !RT_OS_WINDOWS */
     47
    4748
    4849/*******************************************************************************
    4950*   Defined Constants And Macros                                               *
    5051*******************************************************************************/
    51 
    5252/** Converts a pointer to DRVNAMEDPIPE::IMedia to a PDRVNAMEDPIPE. */
    5353#define PDMISTREAM_2_DRVNAMEDPIPE(pInterface) ( (PDRVNAMEDPIPE)((uintptr_t)pInterface - RT_OFFSETOF(DRVNAMEDPIPE, IStream)) )
     
    5555/** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    5656#define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
     57
    5758
    5859/*******************************************************************************
     
    6162/**
    6263 * Named pipe driver instance data.
     64 *
     65 * @implements PDMISTREAM
    6366 */
    6467typedef struct DRVNAMEDPIPE
     
    278281
    279282/**
    280  * Queries an interface to the driver.
    281  *
    282  * @returns Pointer to interface.
    283  * @returns NULL if the interface was not supported by the driver.
    284  * @param   pInterface          Pointer to this interface structure.
    285  * @param   enmInterface        The requested interface identification.
    286  * @thread  Any thread.
    287  */
    288 static DECLCALLBACK(void *) drvNamedPipeQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    289 {
    290     PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    291     PDRVNAMEDPIPE pDrv = PDMINS_2_DATA(pDrvIns, PDRVNAMEDPIPE);
    292     switch (enmInterface)
    293     {
    294         case PDMINTERFACE_BASE:
    295             return &pDrvIns->IBase;
    296         case PDMINTERFACE_STREAM:
    297             return &pDrv->IStream;
    298         default:
    299             return NULL;
    300     }
     283 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     284 */
     285static DECLCALLBACK(void *) drvNamedPipeQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     286{
     287    PPDMDRVINS      pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     288    PDRVNAMEDPIPE   pThis   = PDMINS_2_DATA(pDrvIns, PDRVNAMEDPIPE);
     289    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     290        return &pDrvIns->IBase;
     291    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_STREAM) == 0)
     292        return &pThis->IStream;
     293    return NULL;
    301294}
    302295
  • trunk/src/VBox/Devices/Serial/DrvRawFile.cpp

    r25893 r25966  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2828#include <iprt/assert.h>
    2929#include <iprt/file.h>
     30#include <iprt/mem.h>
     31#include <iprt/semaphore.h>
    3032#include <iprt/stream.h>
    31 #include <iprt/alloc.h>
    3233#include <iprt/string.h>
    33 #include <iprt/semaphore.h>
     34#include <iprt/uuid.h>
    3435
    3536#include "Builtins.h"
     
    3940*   Defined Constants And Macros                                               *
    4041*******************************************************************************/
    41 
    4242/** Converts a pointer to DRVRAWFILE::IMedia to a PDRVRAWFILE. */
    4343#define PDMISTREAM_2_DRVRAWFILE(pInterface) ( (PDRVRAWFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWFILE, IStream)) )
     
    4545/** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */
    4646#define PDMIBASE_2_DRVINS(pInterface)   ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) )
     47
    4748
    4849/*******************************************************************************
     
    5152/**
    5253 * Raw file output driver instance data.
     54 *
     55 * @implements  PDMISTREAM
    5356 */
    5457typedef struct DRVRAWFILE
     
    6568
    6669
    67 /*******************************************************************************
    68 *   Internal Functions                                                         *
    69 *******************************************************************************/
    7070
    7171
     
    9696
    9797/**
    98  * Queries an interface to the driver.
    99  *
    100  * @returns Pointer to interface.
    101  * @returns NULL if the interface was not supported by the driver.
    102  * @param   pInterface          Pointer to this interface structure.
    103  * @param   enmInterface        The requested interface identification.
    104  * @thread  Any thread.
    105  */
    106 static DECLCALLBACK(void *) drvRawFileQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    107 {
    108     PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    109     PDRVRAWFILE pDrv = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
    110     switch (enmInterface)
    111     {
    112         case PDMINTERFACE_BASE:
    113             return &pDrvIns->IBase;
    114         case PDMINTERFACE_STREAM:
    115             return &pDrv->IStream;
    116         default:
    117             return NULL;
    118     }
     98 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     99 */
     100static DECLCALLBACK(void *) drvRawFileQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     101{
     102    PPDMDRVINS  pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     103    PDRVRAWFILE pThis   = PDMINS_2_DATA(pDrvIns, PDRVRAWFILE);
     104
     105    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     106        return &pDrvIns->IBase;
     107    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_STREAM) == 0)
     108        return &pThis->IStream;
     109    return NULL;
    119110}
    120111
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r25823 r25966  
    292292} DEVPORTNOTIFIERQUEUEITEM, *PDEVPORTNOTIFIERQUEUEITEM;
    293293
     294
     295/**
     296 * @implements PDMIBASE
     297 * @implements PDMIBLOCKPORT
     298 * @implements PDMIBLOCKASYNCPORT
     299 * @implements PDMIMOUNTNOTIFY
     300 */
    294301typedef struct AHCIPort
    295302{
     
    486493    uint32_t                        Alignment7;
    487494
    488 } AHCIPort, *PAHCIPort;
    489 
    490 /*
     495} AHCIPort;
     496/** Pointer to the state of an AHCI port. */
     497typedef AHCIPort *PAHCIPort;
     498
     499/**
    491500 * Main AHCI device state.
     501 *
     502 * @implements  PDMILEDPORTS
    492503 */
    493504typedef struct AHCI
     
    506517#endif
    507518
    508     /** The base interface */
     519    /** Status LUN: The base interface. */
    509520    PDMIBASE                        IBase;
    510     /** Status Port - Leds interface. */
     521    /** Status LUN: Leds interface. */
    511522    PDMILEDPORTS                    ILeds;
    512     /** Partner of ILeds. */
     523    /** Status LUN: Partner of ILeds. */
    513524    R3PTRTYPE(PPDMILEDCONNECTORS)   pLedsConnector;
    514525
     
    618629    uint32_t                        cMillisToSleep;
    619630
    620 } AHCI, *PAHCI;
    621 
    622 /* Scatter gather list entry. */
     631} AHCI;
     632/** Pointer to the state of an AHCI device. */
     633typedef AHCI *PAHCI;
     634
     635/**
     636 * Scatter gather list entry.
     637 */
    623638typedef struct
    624639{
     
    23712386
    23722387/**
    2373  * Queries an interface to the driver.
    2374  *
    2375  * @returns Pointer to interface.
    2376  * @returns NULL if the interface was not supported by the device.
    2377  * @param   pInterface          Pointer to ATADevState::IBase.
    2378  * @param   enmInterface        The requested interface identification.
    2379  */
    2380 static DECLCALLBACK(void *) ahciR3Status_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    2381 {
    2382     PAHCI pAhci = PDMIBASE_2_PAHCI(pInterface);
    2383     switch (enmInterface)
    2384     {
    2385         case PDMINTERFACE_BASE:
    2386             return &pAhci->IBase;
    2387         case PDMINTERFACE_LED_PORTS:
    2388             return &pAhci->ILeds;
    2389         default:
    2390             return NULL;
    2391     }
    2392 }
    2393 
    2394 /**
    2395  * Query interface method for the AHCI port.
    2396  */
    2397 static DECLCALLBACK(void *) ahciR3PortQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     2388 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     2389 */
     2390static DECLCALLBACK(void *) ahciR3Status_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
     2391{
     2392    PAHCI pThis = PDMIBASE_2_PAHCI(pInterface);
     2393    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2394        return &pThis->IBase;
     2395    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     2396        return &pThis->ILeds;
     2397    return NULL;
     2398}
     2399
     2400/**
     2401 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     2402 */
     2403static DECLCALLBACK(void *) ahciR3PortQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    23982404{
    23992405    PAHCIPort pAhciPort = PDMIBASE_2_PAHCIPORT(pInterface);
    2400     switch (enmInterface)
    2401     {
    2402         case PDMINTERFACE_BASE:
    2403             return &pAhciPort->IBase;
    2404         case PDMINTERFACE_BLOCK_PORT:
    2405             return &pAhciPort->IPort;
    2406         case PDMINTERFACE_BLOCK_ASYNC_PORT:
    2407             return &pAhciPort->IPortAsync;
    2408         case PDMINTERFACE_MOUNT_NOTIFY:
    2409             return &pAhciPort->IMountNotify;
    2410         default:
    2411             return NULL;
    2412     }
     2406    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2407        return &pAhciPort->IBase;
     2408    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_PORT) == 0)
     2409        return &pAhciPort->IPort;
     2410    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_ASYNC_PORT) == 0)
     2411        return &pAhciPort->IPortAsync;
     2412    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT_NOTIFY) == 0)
     2413        return &pAhciPort->IMountNotify;
     2414    return NULL;
    24132415}
    24142416
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r25900 r25966  
    115115*   Structures and Typedefs                                                    *
    116116*******************************************************************************/
    117 typedef struct ATADevState {
     117/**
     118 * The state of an ATA device.
     119 *
     120 * @implements PDMIBASE
     121 * @implements PDMIBLOCKPORT
     122 * @implements PDMIMOUNTNOTIFY
     123 */
     124typedef struct ATADevState
     125{
    118126    /** Flag indicating whether the current command uses LBA48 mode. */
    119127    bool fLBA48;
     
    454462} CHIPSET;
    455463
    456 typedef struct PCIATAState {
     464/**
     465 * The state of the ATA PCI device.
     466 *
     467 * @extends     PCIDEVICE
     468 * @implements  PDMILEDPORTS
     469 */
     470typedef struct PCIATAState
     471{
    457472    PCIDEVICE           dev;
    458473    /** The controllers. */
     
    460475    /** Pointer to device instance. */
    461476    PPDMDEVINSR3        pDevIns;
    462     /** Status Port - Base interface. */
     477    /** Status LUN: Base interface. */
    463478    PDMIBASE            IBase;
    464     /** Status Port - Leds interface. */
     479    /** Status LUN: Leds interface. */
    465480    PDMILEDPORTS        ILeds;
    466     /** Partner of ILeds. */
     481    /** Status LUN: Partner of ILeds. */
    467482    R3PTRTYPE(PPDMILEDCONNECTORS)   pLedsConnector;
    468483    /** Flag whether GC is enabled. */
     
    52145229
    52155230/**
    5216  * Queries an interface to the driver.
    5217  *
    5218  * @returns Pointer to interface.
    5219  * @returns NULL if the interface was not supported by the device.
    5220  * @param   pInterface          Pointer to ATADevState::IBase.
    5221  * @param   enmInterface        The requested interface identification.
     5231 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    52225232 */
    5223 static DECLCALLBACK(void *) ataStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     5233static DECLCALLBACK(void *) ataStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
    52245234{
    52255235    PCIATAState *pThis = PDMIBASE_2_PCIATASTATE(pInterface);
    5226     switch (enmInterface)
    5227     {
    5228         case PDMINTERFACE_BASE:
    5229             return &pThis->IBase;
    5230         case PDMINTERFACE_LED_PORTS:
    5231             return &pThis->ILeds;
    5232         default:
    5233             return NULL;
    5234     }
     5236    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     5237        return &pThis->IBase;
     5238    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     5239        return &pThis->ILeds;
     5240    return NULL;
    52355241}
    52365242
     
    52685274
    52695275/**
    5270  * Queries an interface to the driver.
    5271  *
    5272  * @returns Pointer to interface.
    5273  * @returns NULL if the interface was not supported by the device.
    5274  * @param   pInterface          Pointer to ATADevState::IBase.
    5275  * @param   enmInterface        The requested interface identification.
     5276 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    52765277 */
    5277 static DECLCALLBACK(void *)  ataQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     5278static DECLCALLBACK(void *)  ataQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    52785279{
    52795280    ATADevState *pIf = PDMIBASE_2_ATASTATE(pInterface);
    5280     switch (enmInterface)
    5281     {
    5282         case PDMINTERFACE_BASE:
    5283             return &pIf->IBase;
    5284         case PDMINTERFACE_BLOCK_PORT:
    5285             return &pIf->IPort;
    5286         case PDMINTERFACE_MOUNT_NOTIFY:
    5287             return &pIf->IMountNotify;
    5288         default:
    5289             return NULL;
    5290     }
     5281    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     5282        return &pIf->IBase;
     5283    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_PORT) == 0)
     5284        return &pIf->IPort;
     5285    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT_NOTIFY) == 0)
     5286        return &pIf->IMountNotify;
     5287    return NULL;
    52915288}
    52925289
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r25934 r25966  
    3737# include <iprt/cache.h>
    3838# include <iprt/param.h>
     39# include <iprt/uuid.h>
    3940#endif
    4041
     
    6263#define BUSLOGIC_SAVED_STATE_MINOR_VERSION 1
    6364
    64 /*
     65/**
    6566 * State of a device attached to the buslogic host adapter.
     67 *
     68 * @implements  PDMIBASE
     69 * @implements  PDMISCSIPORT
     70 * @implements  PDMILEDPORTS
    6671 */
    6772typedef struct BUSLOGICDEVICE
     
    256261#pragma pack()
    257262
    258 /*
     263/**
    259264 * Main BusLogic device state.
     265 *
     266 * @extends     PCIDEVICE
     267 * @implements  PDMILEDPORTS
    260268 */
    261269typedef struct BUSLOGIC
     
    369377    BUSLOGICDEVICE                  aDeviceStates[BUSLOGIC_MAX_DEVICES];
    370378
    371     /** The base interface */
     379    /** The base interface.
     380     * @todo use PDMDEVINS::IBase  */
    372381    PDMIBASE                       IBase;
    373382    /** Status Port - Leds interface. */
     
    23412350
    23422351/**
    2343  * Queries an interface to the driver.
    2344  *
    2345  * @returns Pointer to interface.
    2346  * @returns NULL if the interface was not supported by the device.
    2347  * @param   pInterface          Pointer to BUSLOGICDEVICE::IBase.
    2348  * @param   enmInterface        The requested interface identification.
    2349  */
    2350 static DECLCALLBACK(void *) buslogicDeviceQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     2352 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     2353 */
     2354static DECLCALLBACK(void *) buslogicDeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    23512355{
    23522356    PBUSLOGICDEVICE pDevice = PDMIBASE_2_PBUSLOGICDEVICE(pInterface);
    2353 
    2354     switch (enmInterface)
    2355     {
    2356         case PDMINTERFACE_SCSI_PORT:
    2357             return &pDevice->ISCSIPort;
    2358         case PDMINTERFACE_LED_PORTS:
    2359             return &pDevice->ILed;
    2360         default:
    2361             return NULL;
    2362     }
     2357    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2358        return &pDevice->IBase;
     2359    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_PORT) == 0)
     2360        return &pDevice->ISCSIPort;
     2361    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     2362        return &pDevice->ILed;
     2363    return NULL;
    23632364}
    23642365
     
    23842385
    23852386/**
    2386  * Queries an interface to the driver.
    2387  *
    2388  * @returns Pointer to interface.
    2389  * @returns NULL if the interface was not supported by the device.
    2390  * @param   pInterface          Pointer to ATADevState::IBase.
    2391  * @param   enmInterface        The requested interface identification.
    2392  */
    2393 static DECLCALLBACK(void *) buslogicStatusQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    2394 {
    2395     PBUSLOGIC pBusLogic = PDMIBASE_2_PBUSLOGIC(pInterface);
    2396     switch (enmInterface)
    2397     {
    2398         case PDMINTERFACE_BASE:
    2399             return &pBusLogic->IBase;
    2400         case PDMINTERFACE_LED_PORTS:
    2401             return &pBusLogic->ILeds;
    2402         default:
    2403             return NULL;
    2404     }
     2387 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     2388 */
     2389static DECLCALLBACK(void *) buslogicStatusQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     2390{
     2391    PBUSLOGIC pThis = PDMIBASE_2_PBUSLOGIC(pInterface);
     2392    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2393        return &pThis->IBase;
     2394    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     2395        return &pThis->ILeds;
     2396    return NULL;
    24052397}
    24062398
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r25732 r25966  
    3030#include <iprt/string.h>
    3131#ifdef IN_RING3
     32# include <iprt/cache.h>
     33# include <iprt/mem.h>
    3234# include <iprt/param.h>
    33 # include <iprt/alloc.h>
    34 # include <iprt/cache.h>
     35# include <iprt/uuid.h>
    3536#endif
    3637
     
    6364} LSILOGICSCSIREPLY, *PLSILOGICSCSIREPLY;
    6465
    65 /*
     66/**
    6667 * State of a device attached to the buslogic host adapter.
     68 *
     69 * @implements  PDMIBASE
     70 * @implements  PDMISCSIPORT
     71 * @implements  PDMILEDPORTS
    6772 */
    6873typedef struct LSILOGICDEVICE
     
    266271    /** Cache for allocated tasks. */
    267272    R3PTRTYPE(PRTOBJCACHE)         pTaskCache;
    268     /** The base interface */
     273    /** Status LUN: The base interface. */
    269274    PDMIBASE                       IBase;
    270     /** Status Port - Leds interface. */
     275    /** Status LUN: Leds interface. */
    271276    PDMILEDPORTS                   ILeds;
    272     /** Partner of ILeds. */
     277    /** Status LUN: Partner of ILeds. */
    273278    R3PTRTYPE(PPDMILEDCONNECTORS)  pLedsConnector;
    274279
     
    41884193}
    41894194
    4190 /**
    4191  * Queries an interface to the driver.
    4192  *
    4193  * @returns Pointer to interface.
    4194  * @returns NULL if the interface was not supported by the device.
    4195  * @param   pInterface          Pointer to LSILOGICDEVICE::IBase.
    4196  * @param   enmInterface        The requested interface identification.
    4197  */
    4198 static DECLCALLBACK(void *) lsilogicDeviceQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     4195
     4196/**
     4197 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     4198 */
     4199static DECLCALLBACK(void *) lsilogicDeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    41994200{
    42004201    PLSILOGICDEVICE pDevice = PDMIBASE_2_PLSILOGICDEVICE(pInterface);
    42014202
    4202     switch (enmInterface)
    4203     {
    4204         case PDMINTERFACE_SCSI_PORT:
    4205             return &pDevice->ISCSIPort;
    4206         case PDMINTERFACE_LED_PORTS:
    4207             return &pDevice->ILed;
    4208         default:
    4209             return NULL;
    4210     }
     4203    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     4204        return &pDevice->IBase;
     4205    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_PORT) == 0)
     4206        return &pDevice->ISCSIPort;
     4207    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     4208        return &pDevice->ILed;
     4209    return NULL;
    42114210}
    42124211
     
    42324231
    42334232/**
    4234  * Queries an interface to the driver.
    4235  *
    4236  * @returns Pointer to interface.
    4237  * @returns NULL if the interface was not supported by the device.
    4238  * @param   pInterface          Pointer to ATADevState::IBase.
    4239  * @param   enmInterface        The requested interface identification.
    4240  */
    4241 static DECLCALLBACK(void *) lsilogicStatusQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    4242 {
    4243     PLSILOGICSCSI pLsiLogic = PDMIBASE_2_PLSILOGICSCSI(pInterface);
    4244     switch (enmInterface)
    4245     {
    4246         case PDMINTERFACE_BASE:
    4247             return &pLsiLogic->IBase;
    4248         case PDMINTERFACE_LED_PORTS:
    4249             return &pLsiLogic->ILeds;
    4250         default:
    4251             return NULL;
    4252     }
     4233 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     4234 */
     4235static DECLCALLBACK(void *) lsilogicStatusQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     4236{
     4237    PLSILOGICSCSI pThis = PDMIBASE_2_PLSILOGICSCSI(pInterface);
     4238    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     4239        return &pThis->IBase;
     4240    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     4241        return &pThis->ILeds;
     4242    return NULL;
    42534243}
    42544244
  • trunk/src/VBox/Devices/Storage/DrvBlock.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox storage devices:
    4  * Generic block driver
     3 * VBox storage devices: Generic block driver
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2827#include <VBox/pdmdrv.h>
    2928#include <iprt/assert.h>
     29#include <iprt/string.h>
    3030#include <iprt/uuid.h>
    31 
    32 #include <string.h>
    3331
    3432#include "Builtins.h"
     
    5755#define VBOX_IGNORE_FLUSH
    5856
     57
    5958/*******************************************************************************
    6059*   Structures and Typedefs                                                    *
     
    6261/**
    6362 * Block driver instance data.
     63 *
     64 * @implements  PDMIBLOCK
     65 * @implements  PDMIBLOCKBIOS
     66 * @implements  PDMIMOUNT
     67 * @implements  PDMIMEDIAASYNCPORT
     68 * @implements  PDMIBLOCKASYNC
    6469 */
    6570typedef struct DRVBLOCK
     
    645650/* -=-=-=-=- IBase -=-=-=-=- */
    646651
    647 /** @copydoc PDMIBASE::pfnQueryInterface. */
    648 static DECLCALLBACK(void *)  drvblockQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     652/**
     653 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     654 */
     655static DECLCALLBACK(void *)  drvblockQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    649656{
    650657    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    651658    PDRVBLOCK   pThis = PDMINS_2_DATA(pDrvIns, PDRVBLOCK);
    652     switch (enmInterface)
    653     {
    654         case PDMINTERFACE_BASE:
    655             return &pDrvIns->IBase;
    656         case PDMINTERFACE_BLOCK:
    657             return &pThis->IBlock;
    658         case PDMINTERFACE_BLOCK_BIOS:
    659             return pThis->fBiosVisible ? &pThis->IBlockBios : NULL;
    660         case PDMINTERFACE_MOUNT:
    661             return pThis->fMountable ? &pThis->IMount : NULL;
    662         case PDMINTERFACE_BLOCK_ASYNC:
    663             return pThis->pDrvMediaAsync ? &pThis->IBlockAsync : NULL;
    664         case PDMINTERFACE_MEDIA_ASYNC_PORT:
    665             return pThis->pDrvBlockAsyncPort ? &pThis->IMediaAsyncPort : NULL;
    666         default:
    667             return NULL;
    668     }
     659
     660    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     661        return &pDrvIns->IBase;
     662    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK) == 0)
     663        return &pThis->IBlock;
     664    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_BIOS) == 0)
     665        return pThis->fBiosVisible ? &pThis->IBlockBios : NULL;
     666    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT) == 0)
     667        return pThis->fMountable ? &pThis->IMount : NULL;
     668    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_ASYNC) == 0)
     669        return pThis->pDrvMediaAsync ? &pThis->IBlockAsync : NULL;
     670    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA_ASYNC_PORT) == 0)
     671        return pThis->pDrvBlockAsyncPort ? &pThis->IMediaAsyncPort : NULL;
     672    return NULL;
    669673}
    670674
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r24008 r25966  
    563563/* -=-=-=-=- IBase -=-=-=-=- */
    564564
    565 /** @copydoc PDMIBASE::pfnQueryInterface. */
    566 static DECLCALLBACK(void *)  drvHostBaseQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    567 {
    568     PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    569     PDRVHOSTBASE   pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTBASE);
    570     switch (enmInterface)
    571     {
    572         case PDMINTERFACE_BASE:
    573             return &pDrvIns->IBase;
    574         case PDMINTERFACE_BLOCK:
    575             return &pThis->IBlock;
    576         case PDMINTERFACE_BLOCK_BIOS:
    577             return pThis->fBiosVisible ? &pThis->IBlockBios : NULL;
    578         case PDMINTERFACE_MOUNT:
    579             return &pThis->IMount;
    580         default:
    581             return NULL;
    582     }
     565/**
     566 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     567 */
     568static DECLCALLBACK(void *)  drvHostBaseQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     569{
     570    PPDMDRVINS   pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     571    PDRVHOSTBASE pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTBASE);
     572
     573    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     574        return &pDrvIns->IBase;
     575    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK) == 0)
     576        return &pThis->IBlock;
     577    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_BIOS) == 0)
     578        return pThis->fBiosVisible ? &pThis->IBlockBios : NULL;
     579    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT) == 0)
     580        return &pThis->IMount;
     581    return NULL;
    583582}
    584583
     
    588587#ifdef RT_OS_DARWIN
    589588/** The runloop input source name for the disk arbitration events. */
    590 #define MY_RUN_LOOP_MODE    CFSTR("drvHostBaseDA")
     589# define MY_RUN_LOOP_MODE    CFSTR("drvHostBaseDA") /** @todo r=bird: Check if this will cause trouble in the same way that the one in the USB code did. */
    591590
    592591/**
  • trunk/src/VBox/Devices/Storage/DrvHostBase.h

    r25728 r25966  
    3232/**
    3333 * Host base drive access driver instance data.
     34 *
     35 * @implements PDMIMOUNT
     36 * @implements PDMIBLOCKBIOS
     37 * @implements PDMIBLOCK
    3438 */
    3539typedef struct DRVHOSTBASE
  • trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox storage devices:
    4  * ISO image media driver
     3 * VBox storage devices: ISO image media driver
    54 */
    65
     
    2827#include <iprt/assert.h>
    2928#include <iprt/file.h>
    30 
    31 #include <string.h>
     29#include <iprt/string.h>
     30#include <iprt/uuid.h>
    3231
    3332#include "Builtins.h"
     33
    3434
    3535/*******************************************************************************
    3636*   Defined Constants And Macros                                               *
    3737*******************************************************************************/
    38 
    3938/** Converts a pointer to MEDIAISO::IMedia to a PRDVMEDIAISO. */
    4039#define PDMIMEDIA_2_DRVMEDIAISO(pInterface) ( (PDRVMEDIAISO)((uintptr_t)pInterface - RT_OFFSETOF(DRVMEDIAISO, IMedia)) )
     
    5352/**
    5453 * Block driver instance data.
     54 *
     55 * @implements PDMIMEDIA
    5556 */
    5657typedef struct DRVMEDIAISO
     
    8283static DECLCALLBACK(int) drvMediaISOBiosSetLCHSGeometry(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry);
    8384
    84 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     85static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    8586
    8687
     
    286287
    287288/**
    288  * Queries an interface to the driver.
    289  *
    290  * @returns Pointer to interface.
    291  * @returns NULL if the interface was not supported by the driver.
    292  * @param   pInterface          Pointer to this interface structure.
    293  * @param   enmInterface        The requested interface identification.
    294  * @thread  Any thread.
    295  */
    296 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     289 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     290 */
     291static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    297292{
    298293    PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    299294    PDRVMEDIAISO pThis = PDMINS_2_DATA(pDrvIns, PDRVMEDIAISO);
    300     switch (enmInterface)
    301     {
    302         case PDMINTERFACE_BASE:
    303             return &pDrvIns->IBase;
    304         case PDMINTERFACE_MEDIA:
    305             return &pThis->IMedia;
    306         default:
    307             return NULL;
    308     }
     295    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     296        return &pDrvIns->IBase;
     297    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA) == 0)
     298        return &pThis->IMedia;
     299    return NULL;
    309300}
    310301
  • trunk/src/VBox/Devices/Storage/DrvRawImage.cpp

    r25893 r25966  
     1/* $Id$ */
    12/** @file
    2  *
    3  * VBox storage devices:
    4  * Raw image driver
     3 * VBox storage devices: Raw image driver
    54 */
    65
    76/*
    8  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3029#include <iprt/file.h>
    3130#include <iprt/string.h>
     31#include <iprt/uuid.h>
    3232
    3333#include "Builtins.h"
     
    3737*   Defined Constants And Macros                                               *
    3838*******************************************************************************/
    39 
    4039/** Converts a pointer to RAWIMAGE::IMedia to a PRDVRAWIMAGE. */
    4140#define PDMIMEDIA_2_DRVRAWIMAGE(pInterface) ( (PDRVRAWIMAGE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWIMAGE, IMedia)) )
     
    5453/**
    5554 * Block driver instance data.
     55 *
     56 * @implements  PDMIMEDIA
    5657 */
    5758typedef struct DRVRAWIMAGE
     
    8586static DECLCALLBACK(int) drvRawImageBiosSetLCHSGeometry(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry);
    8687
    87 static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
     88static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, const char *pszIID);
    8889
    8990
     
    336337
    337338/**
    338  * Queries an interface to the driver.
    339  *
    340  * @returns Pointer to interface.
    341  * @returns NULL if the interface was not supported by the driver.
    342  * @param   pInterface          Pointer to this interface structure.
    343  * @param   enmInterface        The requested interface identification.
    344  * @thread  Any thread.
    345  */
    346 static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    347 {
    348     PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    349     PDRVRAWIMAGE pThis = PDMINS_2_DATA(pDrvIns, PDRVRAWIMAGE);
    350     switch (enmInterface)
    351     {
    352         case PDMINTERFACE_BASE:
    353             return &pDrvIns->IBase;
    354         case PDMINTERFACE_MEDIA:
    355             return &pThis->IMedia;
    356         default:
    357             return NULL;
    358     }
     339 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     340 */
     341static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     342{
     343    PPDMDRVINS      pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     344    PDRVRAWIMAGE    pThis   = PDMINS_2_DATA(pDrvIns, PDRVRAWIMAGE);
     345
     346    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     347        return &pDrvIns->IBase;
     348    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA) == 0)
     349        return &pThis->IMedia;
     350    return NULL;
    359351}
    360352
  • trunk/src/VBox/Devices/Storage/DrvSCSI.cpp

    r25893 r25966  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox storage drivers:
    5  * Generic SCSI command parser and execution driver
     3 * VBox storage drivers: Generic SCSI command parser and execution driver
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3230#include <VBox/scsi.h>
    3331#include <iprt/assert.h>
    34 #include <iprt/string.h>
    35 #include <iprt/alloc.h>
     32#include <iprt/mem.h>
    3633#include <iprt/req.h>
    3734#include <iprt/semaphore.h>
     35#include <iprt/string.h>
     36#include <iprt/uuid.h>
    3837
    3938#include "Builtins.h"
     
    4140/**
    4241 * SCSI driver instance data.
     42 *
     43 * @implements  PDMISCSICONNECTOR
     44 * @implements  PDMIBLOCKASYNCPORT
     45 * @implements  PDMIMOUNTNOTIFY
    4346 */
    4447typedef struct DRVSCSI
     
    6568    /** The block port interface. */
    6669    PDMIBLOCKPORT           IPort;
     70#if 0 /* these interfaces aren't implemented */
    6771    /** The optional block async port interface. */
    6872    PDMIBLOCKASYNCPORT      IPortAsync;
    6973    /** The mount notify interface. */
    7074    PDMIMOUNTNOTIFY         IMountNotify;
    71     /** The status LED state for this drive.
    72      *  used in case the device doesn't has a Led interface
    73      *  so we can use this to avoid if checks later on. */
     75#endif
     76    /** Fallback status LED state for this drive.
     77     * This is used in case the device doesn't has a LED interface. */
    7478    PDMLED                  Led;
    75     /** pointer to the Led to use. */
     79    /** Pointer to the status LED for this drive. */
    7680    PPDMLED                 pLed;
    7781
     
    793797/* -=-=-=-=- IBase -=-=-=-=- */
    794798
    795 /** @copydoc PDMIBASE::pfnQueryInterface. */
    796 static DECLCALLBACK(void *)  drvscsiQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     799/**
     800 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     801 */
     802static DECLCALLBACK(void *)  drvscsiQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    797803{
    798804    PPDMDRVINS  pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    799     PDRVSCSI    pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
    800     switch (enmInterface)
    801     {
    802         case PDMINTERFACE_BASE:
    803             return &pDrvIns->IBase;
    804         case PDMINTERFACE_SCSI_CONNECTOR:
    805             return &pThis->ISCSIConnector;
    806         case PDMINTERFACE_BLOCK_PORT:
    807             return &pThis->IPort;
    808         default:
    809             return NULL;
    810     }
     805    PDRVSCSI    pThis   = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
     806
     807    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     808        return &pDrvIns->IBase;
     809    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_CONNECTOR) == 0)
     810        return &pThis->ISCSIConnector;
     811    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_PORT) == 0)
     812        return &pThis->IPort;
     813    return NULL;
    811814}
    812815
  • trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp

    r25893 r25966  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox storage drivers:
    5  * Host SCSI access driver.
     3 * VBox storage drivers: Host SCSI access driver.
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2010 Sun Microsystems, Inc.
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3230#include <VBox/scsi.h>
    3331#include <iprt/assert.h>
     32#include <iprt/file.h>
     33#include <iprt/mem.h>
     34#include <iprt/req.h>
    3435#include <iprt/string.h>
    35 #include <iprt/alloc.h>
    36 #include <iprt/req.h>
    37 #include <iprt/file.h>
     36#include <iprt/uuid.h>
    3837
    3938#if defined(RT_OS_LINUX)
     
    4746/**
    4847 * SCSI driver instance data.
     48 *
     49 * @implements  PDMISCSICONNECTOR
    4950 */
    5051typedef struct DRVSCSIHOST
     
    5556    /** Pointer to the SCSI port interface of the device above. */
    5657    PPDMISCSIPORT           pDevScsiPort;
    57     /** The scsi connector interface .*/
     58    /** The SCSI connector interface .   */
    5859    PDMISCSICONNECTOR       ISCSIConnector;
    5960
     
    395396/* -=-=-=-=- IBase -=-=-=-=- */
    396397
    397 /** @copydoc PDMIBASE::pfnQueryInterface. */
    398 static DECLCALLBACK(void *)  drvscsihostQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
     398/**
     399 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     400 */
     401static DECLCALLBACK(void *)  drvscsihostQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    399402{
    400403    PPDMDRVINS   pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    401     PDRVSCSIHOST pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST);
    402     switch (enmInterface)
    403     {
    404         case PDMINTERFACE_BASE:
    405             return &pDrvIns->IBase;
    406         case PDMINTERFACE_SCSI_CONNECTOR:
    407             return &pThis->ISCSIConnector;
    408         default:
    409             return NULL;
    410     }
     404    PDRVSCSIHOST pThis   = PDMINS_2_DATA(pDrvIns, PDRVSCSIHOST);
     405
     406    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     407        return &pDrvIns->IBase;
     408    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_SCSI_CONNECTOR) == 0)
     409        return &pThis->ISCSIConnector;
     410    return NULL;
    411411}
    412412
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r25893 r25966  
    107107/**
    108108 * VBox disk container media main structure, private part.
     109 *
     110 * @implements  PDMIMEDIA
     111 * @implements  PDMIMEDIAASYNC
     112 * @implements  VDINTERFACEERROR
     113 * @implements  VDINTERFACETCPNET
     114 * @implements  VDINTERFACEASYNCIO
     115 * @implements  VDINTERFACECONFIG
    109116 */
    110117typedef struct VBOXDISK
     
    804811*******************************************************************************/
    805812
    806 /** @copydoc PDMIBASE::pfnQueryInterface */
    807 static DECLCALLBACK(void *) drvvdQueryInterface(PPDMIBASE pInterface,
    808                                                 PDMINTERFACE enmInterface)
    809 {
    810     PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface);
    811     PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    812     switch (enmInterface)
    813     {
    814         case PDMINTERFACE_BASE:
    815             return &pDrvIns->IBase;
    816         case PDMINTERFACE_MEDIA:
    817             return &pThis->IMedia;
    818         case PDMINTERFACE_MEDIA_ASYNC:
    819             return pThis->fAsyncIOSupported ? &pThis->IMediaAsync : NULL;
    820         default:
    821             return NULL;
    822     }
     813/**
     814 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     815 */
     816static DECLCALLBACK(void *) drvvdQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     817{
     818    PPDMDRVINS  pDrvIns = PDMIBASE_2_DRVINS(pInterface);
     819    PVBOXDISK   pThis   = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     820
     821    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     822        return &pDrvIns->IBase;
     823    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA) == 0)
     824        return &pThis->IMedia;
     825    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MEDIA_ASYNC) == 0)
     826        return pThis->fAsyncIOSupported ? &pThis->IMediaAsync : NULL;
     827    return NULL;
    823828}
    824829
  • trunk/src/VBox/Devices/Storage/fdc.c

    r22793 r25966  
    11#ifdef VBOX
     2/* $Id: $ */
    23/** @file
    3  *
    4  * VBox storage devices:
    5  * Floppy disk controller
     4 * VBox storage devices: Floppy disk controller
    65 */
    76
     
    5554#include <VBox/pdmdev.h>
    5655#include <iprt/assert.h>
     56#include <iprt/string.h>
    5757#include <iprt/uuid.h>
    58 #include <iprt/string.h>
    5958
    6059#include "Builtins.h"
     
    143142} fdisk_flags_t;
    144143
     144#ifdef VBOX
     145/**
     146 * The status for one drive.
     147 *
     148 * @implements  PDMIBASE
     149 * @implements  PDMIBLOCKPORT
     150 * @implements  PDMIMOUNTNOTIFY
     151 */
     152#endif
    145153typedef struct fdrive_t {
    146154#ifndef VBOX
     
    356364            /* @todo */ /** @todo r=bird: todo what exactly?!?!? */
    357365            {
    358                 uint64_t size = drv->pDrvBlock->pfnGetSize (drv->pDrvBlock);
    359                 nb_sectors = size / 512;
     366                uint64_t size2 = drv->pDrvBlock->pfnGetSize (drv->pDrvBlock);
     367                nb_sectors = size2 / 512;
    360368            }
    361369#endif /* VBOX */
     
    495503#define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT)
    496504
     505#ifdef VBOX
     506/**
     507 * Floppy controller state.
     508 *
     509 * @implements  PDMILEDPORTS
     510 */
     511#endif
    497512struct fdctrl_t {
    498513#ifndef VBOX
     
    540555    PPDMDEVINS pDevIns;
    541556
    542     /** Status Port - The base interface. */
     557    /** Status LUN: The base interface. */
    543558    PDMIBASE IBaseStatus;
    544     /** Status Port - The Leds interface. */
     559    /** Status LUN: The Leds interface. */
    545560    PDMILEDPORTS ILeds;
    546     /** Status Port - The Partner of ILeds. */
     561    /** Status LUN: The Partner of ILeds. */
    547562    PPDMILEDCONNECTORS pLedsConnector;
    548563#endif
     
    12431258            {
    12441259                uint32_t read;
    1245                 int rc = PDMDevHlpDMAWriteMemory(fdctrl->pDevIns, nchan,
    1246                                                  fdctrl->fifo + rel_pos,
    1247                                                  fdctrl->data_pos,
    1248                                                  len, &read);
     1260                int rc2 = PDMDevHlpDMAWriteMemory(fdctrl->pDevIns, nchan,
     1261                                                  fdctrl->fifo + rel_pos,
     1262                                                  fdctrl->data_pos,
     1263                                                  len, &read);
    12491264                dump (fdctrl->fifo + rel_pos, len);
    1250                 AssertMsgRC (rc, ("DMAWriteMemory -> %Rrc\n", rc));
     1265                AssertMsgRC (rc2, ("DMAWriteMemory -> %Rrc\n", rc2));
    12511266            }
    12521267#else
     
    12621277            {
    12631278                uint32_t written;
    1264                 int rc = PDMDevHlpDMAReadMemory(fdctrl->pDevIns, nchan,
    1265                                                 fdctrl->fifo + rel_pos,
    1266                                                 fdctrl->data_pos,
    1267                                                 len, &written);
    1268                 AssertMsgRC (rc, ("DMAReadMemory -> %Rrc\n", rc));
     1279                int rc2 = PDMDevHlpDMAReadMemory(fdctrl->pDevIns, nchan,
     1280                                                 fdctrl->fifo + rel_pos,
     1281                                                 fdctrl->data_pos,
     1282                                                 len, &written);
     1283                AssertMsgRC (rc2, ("DMAReadMemory -> %Rrc\n", rc2));
    12691284            }
    12701285#else
     
    13081323                int ret;
    13091324#ifdef VBOX
    1310                 int rc;
    13111325                uint32_t read;
    1312 
    1313                 rc = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf,
    1314                                              fdctrl->data_pos, len, &read);
    1315                 AssertMsg (RT_SUCCESS (rc), ("DMAReadMemory -> %Rrc\n", rc));
     1326                int rc2 = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf,
     1327                                                  fdctrl->data_pos, len, &read);
     1328                AssertMsg (RT_SUCCESS (rc2), ("DMAReadMemory -> %Rrc2\n", rc2));
    13161329#else
    13171330                DMA_read_memory (nchan, tmpbuf, fdctrl->data_pos, len);
     
    24852498
    24862499/**
    2487  * Queries an interface to the driver.
    2488  *
    2489  * @returns Pointer to interface.
    2490  * @returns NULL if the interface was not supported by the device.
    2491  * @param   pInterface          Pointer to IDEState::IBase.
    2492  * @param   enmInterface        The requested interface identification.
     2500 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    24932501 */
    2494 static DECLCALLBACK(void *) fdQueryInterface (PPDMIBASE pInterface,
    2495                                               PDMINTERFACE enmInterface)
    2496 {
    2497     fdrive_t *drv = PDMIBASE_2_FDRIVE(pInterface);
    2498     switch (enmInterface) {
    2499     case PDMINTERFACE_BASE:
    2500         return &drv->IBase;
    2501     case PDMINTERFACE_BLOCK_PORT:
    2502         return &drv->IPort;
    2503     case PDMINTERFACE_MOUNT_NOTIFY:
    2504         return &drv->IMountNotify;
    2505     default:
    2506         return NULL;
    2507     }
     2502static DECLCALLBACK(void *) fdQueryInterface (PPDMIBASE pInterface, const char *pszIID)
     2503{
     2504    fdrive_t *pDrive = PDMIBASE_2_FDRIVE(pInterface);
     2505    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2506        return &pDrive->IBase;
     2507    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_BLOCK_PORT) == 0)
     2508        return &pDrive->IPort;
     2509    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_MOUNT_NOTIFY) == 0)
     2510        return &pDrive->IMountNotify;
     2511    return NULL;
    25082512}
    25092513
     
    25322536
    25332537/**
    2534  * Queries an interface to the status LUN.
    2535  *
    2536  * @returns Pointer to interface.
    2537  * @returns NULL if the interface was not supported by the device.
    2538  * @param   pInterface          Pointer to IDEState::IBase.
    2539  * @param   enmInterface        The requested interface identification.
     2538 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    25402539 */
    2541 static DECLCALLBACK(void *) fdcStatusQueryInterface (PPDMIBASE pInterface,
    2542                                                      PDMINTERFACE enmInterface)
    2543 {
    2544     fdctrl_t *fdctrl = (fdctrl_t *)
    2545         ((uintptr_t)pInterface - RT_OFFSETOF (fdctrl_t, IBaseStatus));
    2546     switch (enmInterface) {
    2547     case PDMINTERFACE_BASE:
    2548         return &fdctrl->IBaseStatus;
    2549     case PDMINTERFACE_LED_PORTS:
    2550         return &fdctrl->ILeds;
    2551     default:
    2552         return NULL;
    2553     }
     2540static DECLCALLBACK(void *) fdcStatusQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     2541{
     2542    fdctrl_t *pThis = RT_FROM_MEMBER (pInterface, fdctrl_t, IBaseStatus);
     2543
     2544    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     2545        return &pThis->IBaseStatus;
     2546    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     2547        return &pThis->ILeds;
     2548    return NULL;
    25542549}
    25552550
  • trunk/src/VBox/Devices/VMMDev/VMMDev.cpp

    r25848 r25966  
    4242#ifndef IN_RC
    4343# include <iprt/mem.h>
     44#endif
     45#ifdef IN_RING3
     46# include <iprt/uuid.h>
    4447#endif
    4548
     
    18251828
    18261829/**
    1827  * Queries an interface to the driver.
    1828  *
    1829  * @returns Pointer to interface.
    1830  * @returns NULL if the interface was not supported by the driver.
    1831  * @param   pInterface          Pointer to this interface structure.
    1832  * @param   enmInterface        The requested interface identification.
    1833  * @thread  Any thread.
     1830 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
    18341831 */
    1835 static DECLCALLBACK(void *) vmmdevPortQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
    1836 {
    1837     VMMDevState *pThis = (VMMDevState*)((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, Base));
    1838     switch (enmInterface)
    1839     {
    1840         case PDMINTERFACE_BASE:
    1841             return &pThis->Base;
    1842         case PDMINTERFACE_VMMDEV_PORT:
    1843             return &pThis->Port;
     1832static DECLCALLBACK(void *) vmmdevPortQueryInterface(PPDMIBASE pInterface, const char *pszIID)
     1833{
     1834    VMMDevState *pThis = RT_FROM_MEMBER(pInterface, VMMDevState, Base);
     1835
     1836    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     1837        return &pThis->Base;
     1838    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_VMMDEV_PORT) == 0)
     1839        return &pThis->Port;
    18441840#ifdef VBOX_WITH_HGCM
    1845         case PDMINTERFACE_HGCM_PORT:
    1846             return &pThis->HGCMPort;
     1841    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_PORT) == 0)
     1842        return &pThis->HGCMPort;
    18471843#endif
    1848         case PDMINTERFACE_LED_PORTS:
    1849             /* Currently only for shared folders */
    1850             return &pThis->SharedFolders.ILeds;
    1851         default:
    1852             return NULL;
    1853     }
     1844    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     1845        /* Currently only for shared folders */
     1846        return &pThis->SharedFolders.ILeds;
     1847    return NULL;
    18541848}
    18551849
  • trunk/src/VBox/Devices/VMMDev/VMMDevState.h

    r25848 r25966  
    5151    /** Pointer to device instance. */
    5252    PPDMDEVINSR3 pDevIns;
    53     /** VMMDev port base interface. */
     53    /** LUN\#0 + Status: VMMDev port base interface. */
    5454    PDMIBASE Base;
    55     /** VMMDev port interface. */
     55    /** LUN\#0: VMMDev port interface. */
    5656    PDMIVMMDEVPORT Port;
    5757#ifdef VBOX_WITH_HGCM
    58     /** HGCM port interface. */
     58    /** LUN\#0: HGCM port interface. */
    5959    PDMIHGCMPORT HGCMPort;
    6060#endif
     
    188188#endif /* VBOX_WITH_HGCM */
    189189
    190     /* Shared folders LED */
     190    /** Status LUN: Shared folders LED */
    191191    struct
    192192    {
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r25830 r25966  
    22/** @file
    33 * Virtio - Virtio Common Functions (VRing, VQueue, Virtio PCI)
    4  *
    54 */
    65
    76/*
    8  * Copyright (C) 2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2009-2010 Sun Microsystems, Inc.
    98 *
    109 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2524
    2625#include <iprt/param.h>
     26#include <iprt/uuid.h>
    2727#include <VBox/pdmdev.h>
    2828#include "Virtio.h"
     
    522522
    523523#ifdef IN_RING3
    524 /**
    525  * Provides interfaces to the driver.
    526  *
    527  * @returns Pointer to interface. NULL if the interface is not supported.
    528  * @param   pInterface          Pointer to this interface structure.
    529  * @param   enmInterface        The requested interface identification.
    530  * @thread  EMT
    531  */
    532 void *vpciQueryInterface(struct PDMIBASE *pInterface, PDMINTERFACE enmInterface)
    533 {
    534     VPCISTATE *pState = IFACE_TO_STATE(pInterface, IBase);
    535     Assert(&pState->IBase == pInterface);
    536     switch (enmInterface)
    537     {
    538         case PDMINTERFACE_BASE:
    539             return &pState->IBase;
    540         case PDMINTERFACE_LED_PORTS:
    541             return &pState->ILeds;
    542         default:
    543             return NULL;
    544     }
     524
     525/**
     526 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     527 */
     528void *vpciQueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
     529{
     530    VPCISTATE *pThis = IFACE_TO_STATE(pInterface, IBase);
     531    Assert(&pThis->IBase == pInterface);
     532
     533    if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0)
     534        return &pThis->IBase;
     535    if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_LED_PORTS) == 0)
     536        return &pThis->ILeds;
     537    return NULL;
    545538}
    546539
     
    934927}
    935928
    936 
    937929#endif /* IN_RING3 */
    938930
  • trunk/src/VBox/Devices/VirtIO/Virtio.h

    r25158 r25966  
    22/** @file
    33 * Virtio.h - Virtio Declarations
    4  *
    54 */
    65
     
    162161};
    163162
     163
     164/**
     165 * The state of the VirtIO PCI device
     166 *
     167 * @implements  PDMILEDPORTS
     168 */
    164169struct VPCIState_st
    165170{
     
    172177#endif
    173178
     179    /** Status LUN: Base interface. */
    174180    PDMIBASE               IBase;
    175     PDMILEDPORTS           ILeds;                               /**< LED interface */
     181    /** Status LUN: LED port interface. */
     182    PDMILEDPORTS           ILeds;
     183    /** Status LUN: LED connector (peer). */
    176184    R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
    177185
     
    263271void  vpciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
    264272void  vpciReset(PVPCISTATE pState);
    265 void *vpciQueryInterface(struct PDMIBASE *pInterface,
    266                          PDMINTERFACE enmInterface);
     273void *vpciQueryInterface(struct PDMIBASE *pInterface, const char *pszIID);
    267274PVQUEUE vpciAddQueue(VPCISTATE* pState, unsigned uSize,
    268275                     void (*pfnCallback)(void *pvState, PVQUEUE pQueue),
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