Changeset 25966 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jan 22, 2010 11:15:43 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56818
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 1 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r25770 r25966 206 206 /** Pointer to the attached audio driver. */ 207 207 PPDMIBASE pDrvBase; 208 /** The base interface . */208 /** The base interface for LUN\#0. */ 209 209 PDMIBASE IBase; 210 210 /** Base port of the I/O space region. */ … … 1538 1538 1539 1539 /** 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} 1547 1541 */ 1548 1542 static 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); 1554 1546 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; 1562 1551 } 1563 1552 -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r24265 r25966 36 36 #include <iprt/assert.h> 37 37 #include <iprt/string.h> 38 #include <iprt/uuid.h> 38 39 #include "../vl_vbox.h" 39 40 … … 188 189 PTMTIMER pTimer; 189 190 PPDMIBASE pDrvBase; 191 /** LUN\#0: Base interface. */ 190 192 PDMIBASE IBase; 191 193 #endif … … 1770 1772 } 1771 1773 1774 /** 1775 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1776 */ 1772 1777 static 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); 1777 1781 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; 1785 1786 } 1786 1787 -
trunk/src/VBox/Devices/Audio/audio.c
r25893 r25966 1926 1926 1927 1927 /** 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} 1935 1929 */ 1936 static DECLCALLBACK(void *) drvAudioQueryInterface(PPDMIBASE pInterface, 1937 PDMINTERFACE enmInterface) 1930 static DECLCALLBACK(void *) drvAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID) 1938 1931 { 1939 1932 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; 1950 1939 } 1951 1940 -
trunk/src/VBox/Devices/Audio/audiosniffer.c
r12978 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox audio device: 4 * Audio sniffer device 3 * VBox audio device: Audio sniffer device 5 4 */ 6 5 … … 108 107 */ 109 108 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 113 109 static DECLCALLBACK(int) iface_Setup (PPDMIAUDIOSNIFFERPORT pInterface, bool fEnable, bool fKeepHostAudio) 114 110 { 115 AUDIOSNIFFERSTATE *pThis = IAUDIOSNIFFERPORT_2_AUDIOSNIFFERSTATE(pInterface);111 AUDIOSNIFFERSTATE *pThis = RT_FROM_MEMBER(pInterface, AUDIOSNIFFERSTATE, Port); 116 112 117 113 Assert(g_pData == pThis); … … 124 120 125 121 /** 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 */ 124 static 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; 146 132 } 147 133 -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r25732 r25966 134 134 #include <iprt/time.h> 135 135 #include <iprt/string.h> 136 #include <iprt/uuid.h> 136 137 137 138 #include <VBox/VMMDev.h> … … 4733 4734 4734 4735 /** 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} 4742 4737 */ 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; 4738 static 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; 4752 4745 #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; 4759 4750 } 4760 4751 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r25062 r25966 303 303 PDMCRITSECT lock; 304 304 305 /** The display port base interface. */305 /** LUN\#0: The display port base interface. */ 306 306 PDMIBASE Base; 307 /** The display port interface. */307 /** LUN\#0: The display port interface. */ 308 308 PDMIDISPLAYPORT Port; 309 309 # if HC_ARCH_BITS == 32 … … 311 311 # endif 312 312 #if defined(VBOX_WITH_HGSMI) && defined(VBOX_WITH_VIDEOHWACCEL) 313 /** VBVA callbacks interface */313 /** LUN\#0: VBVA callbacks interface */ 314 314 PDMDDISPLAYVBVACALLBACKS VBVACallbacks; 315 315 #else -
trunk/src/VBox/Devices/Input/DevPS2.cpp
r25732 r25966 53 53 #include <VBox/pdmdev.h> 54 54 #include <iprt/assert.h> 55 #include <iprt/uuid.h> 55 56 56 57 #include "../Builtins.h" … … 221 222 /** 222 223 * Keyboard port - LUN#0. 224 * 225 * @implements PDMIBASE 226 * @implements PDMIKEYBOARDPORT 223 227 */ 224 228 struct … … 237 241 /** 238 242 * Mouse port - LUN#1. 243 * 244 * @implements PDMIBASE 245 * @implements PDMIMOUSEPORT 239 246 */ 240 247 struct … … 1349 1356 1350 1357 /** 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 */ 1360 static 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; 1370 1368 } 1371 1369 1372 1370 1373 1371 /* -=-=-=-=-=- 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)) )1377 1372 1378 1373 /** … … 1385 1380 static DECLCALLBACK(int) kbdKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode) 1386 1381 { 1387 KBDState *pThis = IKEYBOARDPORT_2_KBDSTATE(pInterface);1382 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Keyboard.Port); 1388 1383 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 1389 1384 AssertReleaseRC(rc); 1385 1390 1386 pc_kbd_put_keycode(pThis, u8KeyCode); 1387 1391 1388 PDMCritSectLeave(&pThis->CritSect); 1392 1389 return VINF_SUCCESS; … … 1397 1394 1398 1395 /** 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 */ 1398 static 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; 1418 1406 } 1419 1407 1420 1408 1421 1409 /* -=-=-=-=-=- 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)) )1425 1410 1426 1411 /** … … 1436 1421 static DECLCALLBACK(int) kbdMousePutEvent(PPDMIMOUSEPORT pInterface, int32_t i32DeltaX, int32_t i32DeltaY, int32_t i32DeltaZ, int32_t i32DeltaW, uint32_t fButtonStates) 1437 1422 { 1438 KBDState *pThis = IMOUSEPORT_2_KBDSTATE(pInterface);1423 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.Port); 1439 1424 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 1440 1425 AssertReleaseRC(rc); 1426 1441 1427 pc_kbd_mouse_event(pThis, i32DeltaX, i32DeltaY, i32DeltaZ, i32DeltaW, fButtonStates); 1428 1442 1429 PDMCritSectLeave(&pThis->CritSect); 1443 1430 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox input devices: 4 * Keyboard queue driver 3 * VBox input devices: Keyboard queue driver 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 27 #include <VBox/pdmdrv.h> 29 28 #include <iprt/assert.h> 29 #include <iprt/uuid.h> 30 30 31 31 #include "Builtins.h" … … 38 38 /** 39 39 * Keyboard queue driver instance data. 40 * 41 * @implements PDMIKEYBOARDCONNECTOR 42 * @implements PDMIKEYBOARDPORT 40 43 */ 41 44 typedef struct DRVKBDQUEUE … … 75 78 76 79 /** 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 */ 82 static 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; 99 94 } 100 95 -
trunk/src/VBox/Devices/Input/DrvMouseQueue.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox input devices: 4 * Mouse queue driver 3 * VBox input devices: Mouse queue driver 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 27 #include <VBox/pdmdrv.h> 29 28 #include <iprt/assert.h> 29 #include <iprt/uuid.h> 30 30 31 31 #include "Builtins.h" … … 38 38 /** 39 39 * Mouse queue driver instance data. 40 * 41 * @implements PDMIMOUSECONNECTOR 42 * @implements PDMIMOUSEPORT 40 43 */ 41 44 typedef struct DRVMOUSEQUEUE … … 78 81 79 82 /** 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 */ 85 static 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; 102 96 } 103 97 -
trunk/src/VBox/Devices/Network/DevE1000.cpp
r25876 r25966 51 51 #include <iprt/semaphore.h> 52 52 #include <iprt/string.h> 53 #include <iprt/uuid.h> 53 54 #include <VBox/pdmdev.h> 54 55 #include <VBox/tm.h> … … 832 833 /** 833 834 * Device state structure. Holds the current state of device. 835 * 836 * @implements PDMINETWORKPORT 837 * @implements PDMINETWORKCONFIG 838 * @implements PDMILEDPORTS 834 839 */ 835 840 struct E1kState_st … … 4455 4460 4456 4461 /** 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 */ 4464 static 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; 4481 4478 } 4482 4479 -
trunk/src/VBox/Devices/Network/DevINIP.cpp
r25728 r25966 47 47 #include <VBox/pdmdev.h> 48 48 #include <VBox/tm.h> 49 #include <iprt/assert.h> 49 50 #include <iprt/string.h> 50 #include <iprt/ assert.h>51 #include <iprt/uuid.h> 51 52 52 53 #include "../Builtins.h" … … 67 68 /** 68 69 * Internal Network IP stack device instance data. 70 * 71 * @implements PDMIBASE 72 * @implements PDMINETWORKPORT 69 73 */ 70 74 typedef struct DEVINTNETIP 71 75 { 72 /** The base interface . */76 /** The base interface for LUN\#0. */ 73 77 PDMIBASE IBase; 74 /** The network port this device provides . */78 /** The network port this device provides (LUN\#0). */ 75 79 PDMINETWORKPORT INetworkPort; 76 80 /** The base interface of the network driver below us. */ … … 387 391 388 392 /** 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} 396 394 */ 397 395 static 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; 410 404 } 411 405 -
trunk/src/VBox/Devices/Network/DevPCNet.cpp
r25780 r25966 68 68 # include <iprt/mem.h> 69 69 # include <iprt/semaphore.h> 70 # include <iprt/uuid.h> 70 71 #endif 71 72 … … 109 110 typedef struct PCNetState_st PCNetState; 110 111 112 /** 113 * PCNET state. 114 * 115 * @extends PCIDEVICE 116 * @implements PDMIBASE 117 * @implements PDMINETWORKPORT 118 * @implements PDMINETWORKCONFIG 119 * @implements PDMILEDPORTS 120 */ 111 121 struct PCNetState_st 112 122 { … … 197 207 /** Pointer to the attached network driver. */ 198 208 R3PTRTYPE(PPDMIBASE) pDrvBase; 199 /** The base interface. */209 /** LUN\#0 + status LUN: The base interface. */ 200 210 PDMIBASE IBase; 201 /** The network port interface. */211 /** LUN\#0: The network port interface. */ 202 212 PDMINETWORKPORT INetworkPort; 203 /** The network config port interface. */213 /** LUN\#0: The network config port interface. */ 204 214 PDMINETWORKCONFIG INetworkConfig; 205 215 /** Base address of the MMIO region. */ … … 221 231 /** The LED. */ 222 232 PDMLED Led; 223 /** The LED ports. */233 /** Status LUN: The LED ports. */ 224 234 PDMILEDPORTS ILeds; 225 235 /** Partner of ILeds. */ … … 4471 4481 4472 4482 /** 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 */ 4485 static DECLCALLBACK(void *) pcnetQueryInterface(struct PDMIBASE *pInterface, const char *pszIID) 4486 { 4487 PCNetState *pThis = RT_FROM_MEMBER(pInterface, PCNetState, IBase); 4484 4488 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; 4498 4498 } 4499 4499 -
trunk/src/VBox/Devices/Network/DevVirtioNet.cpp
r25955 r25966 2 2 /** @file 3 3 * DevVirtioNet - Virtio Network Device 4 *5 4 */ 6 5 … … 29 28 #ifdef IN_RING3 30 29 # include <iprt/mem.h> 30 # include <iprt/uuid.h> 31 31 #endif /* IN_RING3 */ 32 32 #include "../Builtins.h" … … 107 107 /** 108 108 * Device state structure. Holds the current state of device. 109 */ 110 109 * 110 * @extends VPCISTATE 111 * @implements PDMINETWORKPORT 112 * @implements PDMINETWORKCONFIG 113 */ 111 114 struct VNetState_st 112 115 { … … 578 581 579 582 /** 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 */ 585 static 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); 600 595 } 601 596 … … 858 853 } 859 854 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), 861 856 vringReadAvailIndex(&pState->VPCI, &pState->pTxQueue->VRing) - pState->pTxQueue->uNextAvailIndex)); 862 857 … … 965 960 u32MicroDiff, pState->u32AvgDiff, pState->u32MinDiff, pState->u32MaxDiff)); 966 961 967 // Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState))); 962 // Log3(("%s vnetTxTimer: Expired\n", INSTANCE(pState))); 968 963 vnetTransmitPendingPackets(pState, pState->pTxQueue); 969 964 if (RT_FAILURE(vnetCsEnter(pState, VERR_SEM_BUSY))) … … 1461 1456 1462 1457 /* Initialize PCI part first. */ 1463 pState->VPCI.IBase.pfnQueryInterface 1458 pState->VPCI.IBase.pfnQueryInterface = vnetQueryInterface; 1464 1459 rc = vpciConstruct(pDevIns, &pState->VPCI, iInstance, 1465 1460 VNET_NAME_FMT, VNET_PCI_SUBSYSTEM_ID, -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r25893 r25966 39 39 #include <iprt/time.h> 40 40 #include <iprt/thread.h> 41 #include <iprt/uuid.h> 41 42 42 43 #include "../Builtins.h" … … 63 64 /** 64 65 * Block driver instance data. 66 * 67 * @implements PDMINETWORKCONNECTOR 65 68 */ 66 69 typedef struct DRVINTNET … … 576 579 577 580 /** 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 */ 583 static DECLCALLBACK(void *) drvIntNetQueryInterface(PPDMIBASE pInterface, const char *pszIID) 587 584 { 588 585 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; 599 593 } 600 594 -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r25893 r25966 5 5 6 6 /* 7 * Copyright (C) 2006-20 09Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 37 37 #include <iprt/cidr.h> 38 38 #include <iprt/stream.h> 39 #include <iprt/uuid.h> 39 40 40 41 #include "Builtins.h" … … 118 119 /** 119 120 * NAT network transport driver instance data. 121 * 122 * @implements PDMINETWORKCONNECTOR 120 123 */ 121 124 typedef struct DRVNAT … … 803 806 804 807 /** 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 */ 810 static 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; 826 820 } 827 821 … … 1039 1033 N_("Configuration error: the above device/driver didn't " 1040 1034 "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); 1044 1037 if (!pThis->pConfig) 1045 1038 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, -
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox network devices: 4 * Network sniffer filter driver 3 * DrvNetSniffer - Network sniffer filter driver. 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 29 #include <VBox/log.h> 31 30 #include <iprt/assert.h> 31 #include <iprt/critsect.h> 32 32 #include <iprt/file.h> 33 33 #include <iprt/process.h> 34 34 #include <iprt/string.h> 35 35 #include <iprt/time.h> 36 #include <iprt/ critsect.h>36 #include <iprt/uuid.h> 37 37 #include <VBox/param.h> 38 38 … … 46 46 /** 47 47 * Block driver instance data. 48 * 49 * @implements PDMINETWORKCONNECTOR 50 * @implements PDMINETWORKPORT 51 * @implements PDMINETWORKCONFIG 48 52 */ 49 53 typedef struct DRVNETSNIFFER … … 248 252 249 253 /** 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 */ 256 static 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; 275 269 } 276 270 -
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r25893 r25966 1 /* *$Id$ */1 /* $Id$ */ 2 2 /** @file 3 * Universial TAP network transport driver.3 * DrvTAP - Universial TAP network transport driver. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 #include <VBox/pdmdrv.h> 28 28 29 #include <iprt/asm.h> 29 30 #include <iprt/assert.h> 30 31 #include <iprt/ctype.h> 31 32 #include <iprt/file.h> 33 #include <iprt/path.h> 34 #include <iprt/semaphore.h> 32 35 #include <iprt/string.h> 33 #include <iprt/path.h>34 36 #include <iprt/thread.h> 35 #include <iprt/asm.h> 36 #include <iprt/semaphore.h> 37 #include <iprt/uuid.h> 37 38 #ifdef RT_OS_SOLARIS 38 39 # include <iprt/process.h> … … 80 81 *******************************************************************************/ 81 82 /** 82 * Block driver instance data. 83 * TAP driver instance data. 84 * 85 * @implements PDMINETWORKCONNECTOR 83 86 */ 84 87 typedef struct DRVTAP … … 774 777 775 778 /** 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 */ 781 static 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; 797 791 } 798 792 -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r25928 r25966 33 33 # include <iprt/alloc.h> 34 34 # include <iprt/string.h> 35 # include <iprt/uuid.h> 35 36 #endif /* IN_RING3 */ 36 37 … … 1935 1936 1936 1937 /** 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} 1944 1939 */ 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 } 1940 static 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; 1957 1948 } 1958 1949 -
trunk/src/VBox/Devices/PC/DrvACPI.cpp
r25893 r25966 33 33 #include <iprt/assert.h> 34 34 #include <iprt/string.h> 35 #include <iprt/uuid.h> 35 36 36 37 #ifdef RT_OS_LINUX … … 66 67 /** 67 68 * ACPI driver instance data. 69 * 70 * @implements PDMIACPICONNECTOR 68 71 */ 69 72 typedef struct DRVACPI … … 79 82 80 83 /** 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} 88 85 */ 89 static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)86 static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, const char *pszIID) 90 87 { 91 88 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 92 89 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; 102 96 } 103 97 … … 117 111 { 118 112 /* 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. */ 122 117 { 123 118 *pPowerSource = PDM_ACPI_POWER_SOURCE_BATTERY; -
trunk/src/VBox/Devices/PC/DrvAcpiCpu.cpp
r25893 r25966 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 #include <iprt/assert.h> 30 30 #include <iprt/string.h> 31 #include <iprt/uuid.h> 31 32 32 33 #include "Builtins.h" 33 34 35 34 36 /** 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} 42 38 */ 43 static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)39 static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, const char *pszIID) 44 40 { 45 41 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; 54 45 } 55 46 -
trunk/src/VBox/Devices/Parallel/DevParallel.cpp
r25732 r25966 93 93 * Structures and Typedefs * 94 94 *******************************************************************************/ 95 /** 96 * Parallel device state. 97 * 98 * @implements PDMIBASE 99 * @implements PDMIHOSTPARALLELPORT 100 */ 95 101 typedef struct ParallelState 96 102 { … … 105 111 PPDMDEVINSRC pDevInsRC; 106 112 RTRCPTR Alignment0; /**< Alignment. */ 107 /** The base interface. */113 /** LUN\#0: The base interface. */ 108 114 PDMIBASE IBase; 109 /** The host device port interface. */115 /** LUN\#0: The host device port interface. */ 110 116 PDMIHOSTPARALLELPORT IHostParallelPort; 111 117 /** Pointer to the attached base driver. */ … … 644 650 } 645 651 646 /** @copydoc PIBASE::pfnqueryInterface */ 647 static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 652 /** 653 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 654 */ 655 static DECLCALLBACK(void *) parallelQueryInterface(PPDMIBASE pInterface, const char *pszIID) 648 656 { 649 657 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; 659 663 } 660 664 -
trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
r25893 r25966 7 7 8 8 /* 9 * Copyright (C) 2006-20 07Sun Microsystems, Inc.9 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 #include <iprt/asm.h> 31 31 #include <iprt/assert.h> 32 #include <iprt/file.h> 33 #include <iprt/semaphore.h> 32 34 #include <iprt/stream.h> 33 #include <iprt/semaphore.h> 34 #include <iprt/file.h> 35 #include <iprt/uuid.h> 35 36 36 37 #ifdef RT_OS_LINUX … … 48 49 #include "Builtins.h" 49 50 51 50 52 /******************************************************************************* 51 53 * Structures and Typedefs * … … 53 55 /** 54 56 * Host parallel port driver instance data. 57 * @implements PDMIHOSTPARALLELCONNECTOR 55 58 */ 56 59 typedef struct DRVHOSTPARALLEL … … 62 65 /** Our host device interface. */ 63 66 PDMIHOSTPARALLELCONNECTOR IHostParallelConnector; 64 /** Our host device port interface. */65 PDMIHOSTPARALLELPORT IHostParallelPort;66 67 /** Device Path */ 67 char 68 char *pszDevicePath; 68 69 /** Device Handle */ 69 70 RTFILE FileDevice; … … 78 79 /** Converts a pointer to DRVHOSTPARALLEL::IHostDeviceConnector to a PDRHOSTPARALLEL. */ 79 80 #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 82 82 83 83 /* -=-=-=-=- IBase -=-=-=-=- */ 84 84 85 85 /** 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 */ 88 static 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; 106 98 } 107 99 -
trunk/src/VBox/Devices/Serial/DevSerial.cpp
r25732 r25966 121 121 * Structures and Typedefs * 122 122 *******************************************************************************/ 123 /** 124 * Serial device. 125 * 126 * @implements PDMIBASE 127 * @implements PDMICHARPORT 128 */ 123 129 struct SerialState 124 130 { … … 133 139 PPDMDEVINSRC pDevInsRC; 134 140 RTRCPTR Alignment0; /**< Alignment. */ 135 /** The base interface. */141 /** LUN\#0: The base interface. */ 136 142 PDMIBASE IBase; 137 /** The character port interface. */143 /** LUN\#0: The character port interface. */ 138 144 PDMICHARPORT ICharPort; 139 145 /** Pointer to the attached base driver. */ … … 726 732 #endif /* VBOX_SERIAL_PCI */ 727 733 728 729 /** @copydoc PIBASE::pfnqueryInterface */ 730 static DECLCALLBACK(void *) serialQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 734 /** 735 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 736 */ 737 static DECLCALLBACK(void *) serialQueryInterface(PPDMIBASE pInterface, const char *pszIID) 731 738 { 732 739 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; 742 745 } 743 746 -
trunk/src/VBox/Devices/Serial/DrvChar.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox stream I/O devices: 4 * Generic char driver 3 * VBox stream I/O devices: Generic char driver 5 4 */ 6 5 … … 32 31 #include <iprt/stream.h> 33 32 #include <iprt/semaphore.h> 33 #include <iprt/uuid.h> 34 34 35 35 #include "Builtins.h" 36 36 37 37 38 /******************************************************************************* 39 * Defined Constants And Macros * 40 *******************************************************************************/ 38 41 /** Size of the send fifo queue (in bytes) */ 39 42 #define CHAR_MAX_SEND_QUEUE 0x80 40 43 #define CHAR_MAX_SEND_QUEUE_MASK 0x7f 41 44 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 42 49 /******************************************************************************* 43 50 * Structures and Typedefs * 44 51 *******************************************************************************/ 45 46 52 /** 47 53 * Char driver instance data. 54 * 55 * @implements PDMICHAR 48 56 */ 49 57 typedef struct DRVCHAR … … 79 87 80 88 81 /** Converts a pointer to DRVCHAR::IChar to a PDRVCHAR. */82 #define PDMICHAR_2_DRVCHAR(pInterface) ( (PDRVCHAR)((uintptr_t)pInterface - RT_OFFSETOF(DRVCHAR, IChar)) )83 89 84 90 … … 86 92 87 93 /** 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 */ 96 static DECLCALLBACK(void *) drvCharQueryInterface(PPDMIBASE pInterface, const char *pszIID) 96 97 { 97 98 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 98 99 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; 108 106 } 109 107 -
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r25893 r25966 34 34 #include <iprt/asm.h> 35 35 #include <iprt/assert.h> 36 #include <iprt/file.h> 37 #include <iprt/mem.h> 36 38 #include <iprt/semaphore.h> 37 #include <iprt/file.h> 38 #include <iprt/alloc.h> 39 #include <iprt/uuid.h> 39 40 40 41 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) … … 93 94 /** 94 95 * Char driver instance data. 96 * 97 * @implements PDMICHAR 95 98 */ 96 99 typedef struct DRVHOSTSERIAL … … 169 172 170 173 /** 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} 177 175 */ 178 static DECLCALLBACK(void *) drvHostSerialQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)176 static DECLCALLBACK(void *) drvHostSerialQueryInterface(PPDMIBASE pInterface, const char *pszIID) 179 177 { 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; 191 186 } 192 187 -
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox stream devices: 4 * Named pipe stream 3 * VBox stream drivers: Named pipe stream 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 33 32 #include <iprt/string.h> 34 33 #include <iprt/semaphore.h> 34 #include <iprt/uuid.h> 35 35 36 36 #include "Builtins.h" 37 37 38 38 #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 47 48 48 49 /******************************************************************************* 49 50 * Defined Constants And Macros * 50 51 *******************************************************************************/ 51 52 52 /** Converts a pointer to DRVNAMEDPIPE::IMedia to a PDRVNAMEDPIPE. */ 53 53 #define PDMISTREAM_2_DRVNAMEDPIPE(pInterface) ( (PDRVNAMEDPIPE)((uintptr_t)pInterface - RT_OFFSETOF(DRVNAMEDPIPE, IStream)) ) … … 55 55 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */ 56 56 #define PDMIBASE_2_DRVINS(pInterface) ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) ) 57 57 58 58 59 /******************************************************************************* … … 61 62 /** 62 63 * Named pipe driver instance data. 64 * 65 * @implements PDMISTREAM 63 66 */ 64 67 typedef struct DRVNAMEDPIPE … … 278 281 279 282 /** 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 */ 285 static 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; 301 294 } 302 295 -
trunk/src/VBox/Devices/Serial/DrvRawFile.cpp
r25893 r25966 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 #include <iprt/assert.h> 29 29 #include <iprt/file.h> 30 #include <iprt/mem.h> 31 #include <iprt/semaphore.h> 30 32 #include <iprt/stream.h> 31 #include <iprt/alloc.h>32 33 #include <iprt/string.h> 33 #include <iprt/ semaphore.h>34 #include <iprt/uuid.h> 34 35 35 36 #include "Builtins.h" … … 39 40 * Defined Constants And Macros * 40 41 *******************************************************************************/ 41 42 42 /** Converts a pointer to DRVRAWFILE::IMedia to a PDRVRAWFILE. */ 43 43 #define PDMISTREAM_2_DRVRAWFILE(pInterface) ( (PDRVRAWFILE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWFILE, IStream)) ) … … 45 45 /** Converts a pointer to PDMDRVINS::IBase to a PPDMDRVINS. */ 46 46 #define PDMIBASE_2_DRVINS(pInterface) ( (PPDMDRVINS)((uintptr_t)pInterface - RT_OFFSETOF(PDMDRVINS, IBase)) ) 47 47 48 48 49 /******************************************************************************* … … 51 52 /** 52 53 * Raw file output driver instance data. 54 * 55 * @implements PDMISTREAM 53 56 */ 54 57 typedef struct DRVRAWFILE … … 65 68 66 69 67 /*******************************************************************************68 * Internal Functions *69 *******************************************************************************/70 70 71 71 … … 96 96 97 97 /** 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 */ 100 static 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; 119 110 } 120 111 -
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r25823 r25966 292 292 } DEVPORTNOTIFIERQUEUEITEM, *PDEVPORTNOTIFIERQUEUEITEM; 293 293 294 295 /** 296 * @implements PDMIBASE 297 * @implements PDMIBLOCKPORT 298 * @implements PDMIBLOCKASYNCPORT 299 * @implements PDMIMOUNTNOTIFY 300 */ 294 301 typedef struct AHCIPort 295 302 { … … 486 493 uint32_t Alignment7; 487 494 488 } AHCIPort, *PAHCIPort; 489 490 /* 495 } AHCIPort; 496 /** Pointer to the state of an AHCI port. */ 497 typedef AHCIPort *PAHCIPort; 498 499 /** 491 500 * Main AHCI device state. 501 * 502 * @implements PDMILEDPORTS 492 503 */ 493 504 typedef struct AHCI … … 506 517 #endif 507 518 508 /** The base interface*/519 /** Status LUN: The base interface. */ 509 520 PDMIBASE IBase; 510 /** Status Port -Leds interface. */521 /** Status LUN: Leds interface. */ 511 522 PDMILEDPORTS ILeds; 512 /** Partner of ILeds. */523 /** Status LUN: Partner of ILeds. */ 513 524 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 514 525 … … 618 629 uint32_t cMillisToSleep; 619 630 620 } AHCI, *PAHCI; 621 622 /* Scatter gather list entry. */ 631 } AHCI; 632 /** Pointer to the state of an AHCI device. */ 633 typedef AHCI *PAHCI; 634 635 /** 636 * Scatter gather list entry. 637 */ 623 638 typedef struct 624 639 { … … 2371 2386 2372 2387 /** 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 */ 2390 static 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 */ 2403 static DECLCALLBACK(void *) ahciR3PortQueryInterface(PPDMIBASE pInterface, const char *pszIID) 2398 2404 { 2399 2405 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; 2413 2415 } 2414 2416 -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r25900 r25966 115 115 * Structures and Typedefs * 116 116 *******************************************************************************/ 117 typedef struct ATADevState { 117 /** 118 * The state of an ATA device. 119 * 120 * @implements PDMIBASE 121 * @implements PDMIBLOCKPORT 122 * @implements PDMIMOUNTNOTIFY 123 */ 124 typedef struct ATADevState 125 { 118 126 /** Flag indicating whether the current command uses LBA48 mode. */ 119 127 bool fLBA48; … … 454 462 } CHIPSET; 455 463 456 typedef struct PCIATAState { 464 /** 465 * The state of the ATA PCI device. 466 * 467 * @extends PCIDEVICE 468 * @implements PDMILEDPORTS 469 */ 470 typedef struct PCIATAState 471 { 457 472 PCIDEVICE dev; 458 473 /** The controllers. */ … … 460 475 /** Pointer to device instance. */ 461 476 PPDMDEVINSR3 pDevIns; 462 /** Status Port -Base interface. */477 /** Status LUN: Base interface. */ 463 478 PDMIBASE IBase; 464 /** Status Port -Leds interface. */479 /** Status LUN: Leds interface. */ 465 480 PDMILEDPORTS ILeds; 466 /** Partner of ILeds. */481 /** Status LUN: Partner of ILeds. */ 467 482 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 468 483 /** Flag whether GC is enabled. */ … … 5214 5229 5215 5230 /** 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} 5222 5232 */ 5223 static DECLCALLBACK(void *) ataStatus_QueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)5233 static DECLCALLBACK(void *) ataStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID) 5224 5234 { 5225 5235 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; 5235 5241 } 5236 5242 … … 5268 5274 5269 5275 /** 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} 5276 5277 */ 5277 static DECLCALLBACK(void *) ataQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)5278 static DECLCALLBACK(void *) ataQueryInterface(PPDMIBASE pInterface, const char *pszIID) 5278 5279 { 5279 5280 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; 5291 5288 } 5292 5289 -
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r25934 r25966 37 37 # include <iprt/cache.h> 38 38 # include <iprt/param.h> 39 # include <iprt/uuid.h> 39 40 #endif 40 41 … … 62 63 #define BUSLOGIC_SAVED_STATE_MINOR_VERSION 1 63 64 64 /* 65 /** 65 66 * State of a device attached to the buslogic host adapter. 67 * 68 * @implements PDMIBASE 69 * @implements PDMISCSIPORT 70 * @implements PDMILEDPORTS 66 71 */ 67 72 typedef struct BUSLOGICDEVICE … … 256 261 #pragma pack() 257 262 258 /* 263 /** 259 264 * Main BusLogic device state. 265 * 266 * @extends PCIDEVICE 267 * @implements PDMILEDPORTS 260 268 */ 261 269 typedef struct BUSLOGIC … … 369 377 BUSLOGICDEVICE aDeviceStates[BUSLOGIC_MAX_DEVICES]; 370 378 371 /** The base interface */ 379 /** The base interface. 380 * @todo use PDMDEVINS::IBase */ 372 381 PDMIBASE IBase; 373 382 /** Status Port - Leds interface. */ … … 2341 2350 2342 2351 /** 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 */ 2354 static DECLCALLBACK(void *) buslogicDeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID) 2351 2355 { 2352 2356 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; 2363 2364 } 2364 2365 … … 2384 2385 2385 2386 /** 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 */ 2389 static 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; 2405 2397 } 2406 2398 -
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r25732 r25966 30 30 #include <iprt/string.h> 31 31 #ifdef IN_RING3 32 # include <iprt/cache.h> 33 # include <iprt/mem.h> 32 34 # include <iprt/param.h> 33 # include <iprt/alloc.h> 34 # include <iprt/cache.h> 35 # include <iprt/uuid.h> 35 36 #endif 36 37 … … 63 64 } LSILOGICSCSIREPLY, *PLSILOGICSCSIREPLY; 64 65 65 /* 66 /** 66 67 * State of a device attached to the buslogic host adapter. 68 * 69 * @implements PDMIBASE 70 * @implements PDMISCSIPORT 71 * @implements PDMILEDPORTS 67 72 */ 68 73 typedef struct LSILOGICDEVICE … … 266 271 /** Cache for allocated tasks. */ 267 272 R3PTRTYPE(PRTOBJCACHE) pTaskCache; 268 /** The base interface*/273 /** Status LUN: The base interface. */ 269 274 PDMIBASE IBase; 270 /** Status Port -Leds interface. */275 /** Status LUN: Leds interface. */ 271 276 PDMILEDPORTS ILeds; 272 /** Partner of ILeds. */277 /** Status LUN: Partner of ILeds. */ 273 278 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 274 279 … … 4188 4193 } 4189 4194 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 */ 4199 static DECLCALLBACK(void *) lsilogicDeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4199 4200 { 4200 4201 PLSILOGICDEVICE pDevice = PDMIBASE_2_PLSILOGICDEVICE(pInterface); 4201 4202 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; 4211 4210 } 4212 4211 … … 4232 4231 4233 4232 /** 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 */ 4235 static 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; 4253 4243 } 4254 4244 -
trunk/src/VBox/Devices/Storage/DrvBlock.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox storage devices: 4 * Generic block driver 3 * VBox storage devices: Generic block driver 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 27 #include <VBox/pdmdrv.h> 29 28 #include <iprt/assert.h> 29 #include <iprt/string.h> 30 30 #include <iprt/uuid.h> 31 32 #include <string.h>33 31 34 32 #include "Builtins.h" … … 57 55 #define VBOX_IGNORE_FLUSH 58 56 57 59 58 /******************************************************************************* 60 59 * Structures and Typedefs * … … 62 61 /** 63 62 * Block driver instance data. 63 * 64 * @implements PDMIBLOCK 65 * @implements PDMIBLOCKBIOS 66 * @implements PDMIMOUNT 67 * @implements PDMIMEDIAASYNCPORT 68 * @implements PDMIBLOCKASYNC 64 69 */ 65 70 typedef struct DRVBLOCK … … 645 650 /* -=-=-=-=- IBase -=-=-=-=- */ 646 651 647 /** @copydoc PDMIBASE::pfnQueryInterface. */ 648 static DECLCALLBACK(void *) drvblockQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 652 /** 653 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 654 */ 655 static DECLCALLBACK(void *) drvblockQueryInterface(PPDMIBASE pInterface, const char *pszIID) 649 656 { 650 657 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 651 658 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; 669 673 } 670 674 -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r24008 r25966 563 563 /* -=-=-=-=- IBase -=-=-=-=- */ 564 564 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 */ 568 static 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; 583 582 } 584 583 … … 588 587 #ifdef RT_OS_DARWIN 589 588 /** 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. */ 591 590 592 591 /** -
trunk/src/VBox/Devices/Storage/DrvHostBase.h
r25728 r25966 32 32 /** 33 33 * Host base drive access driver instance data. 34 * 35 * @implements PDMIMOUNT 36 * @implements PDMIBLOCKBIOS 37 * @implements PDMIBLOCK 34 38 */ 35 39 typedef struct DRVHOSTBASE -
trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox storage devices: 4 * ISO image media driver 3 * VBox storage devices: ISO image media driver 5 4 */ 6 5 … … 28 27 #include <iprt/assert.h> 29 28 #include <iprt/file.h> 30 31 #include < string.h>29 #include <iprt/string.h> 30 #include <iprt/uuid.h> 32 31 33 32 #include "Builtins.h" 33 34 34 35 35 /******************************************************************************* 36 36 * Defined Constants And Macros * 37 37 *******************************************************************************/ 38 39 38 /** Converts a pointer to MEDIAISO::IMedia to a PRDVMEDIAISO. */ 40 39 #define PDMIMEDIA_2_DRVMEDIAISO(pInterface) ( (PDRVMEDIAISO)((uintptr_t)pInterface - RT_OFFSETOF(DRVMEDIAISO, IMedia)) ) … … 53 52 /** 54 53 * Block driver instance data. 54 * 55 * @implements PDMIMEDIA 55 56 */ 56 57 typedef struct DRVMEDIAISO … … 82 83 static DECLCALLBACK(int) drvMediaISOBiosSetLCHSGeometry(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry); 83 84 84 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);85 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID); 85 86 86 87 … … 286 287 287 288 /** 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 */ 291 static DECLCALLBACK(void *) drvMediaISOQueryInterface(PPDMIBASE pInterface, const char *pszIID) 297 292 { 298 293 PPDMDRVINS pDrvIns = PDMIBASE_2_DRVINS(pInterface); 299 294 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; 309 300 } 310 301 -
trunk/src/VBox/Devices/Storage/DrvRawImage.cpp
r25893 r25966 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox storage devices: 4 * Raw image driver 3 * VBox storage devices: Raw image driver 5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 29 #include <iprt/file.h> 31 30 #include <iprt/string.h> 31 #include <iprt/uuid.h> 32 32 33 33 #include "Builtins.h" … … 37 37 * Defined Constants And Macros * 38 38 *******************************************************************************/ 39 40 39 /** Converts a pointer to RAWIMAGE::IMedia to a PRDVRAWIMAGE. */ 41 40 #define PDMIMEDIA_2_DRVRAWIMAGE(pInterface) ( (PDRVRAWIMAGE)((uintptr_t)pInterface - RT_OFFSETOF(DRVRAWIMAGE, IMedia)) ) … … 54 53 /** 55 54 * Block driver instance data. 55 * 56 * @implements PDMIMEDIA 56 57 */ 57 58 typedef struct DRVRAWIMAGE … … 85 86 static DECLCALLBACK(int) drvRawImageBiosSetLCHSGeometry(PPDMIMEDIA pInterface, PCPDMMEDIAGEOMETRY pLCHSGeometry); 86 87 87 static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);88 static DECLCALLBACK(void *) drvRawImageQueryInterface(PPDMIBASE pInterface, const char *pszIID); 88 89 89 90 … … 336 337 337 338 /** 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 */ 341 static 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; 359 351 } 360 352 -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r25893 r25966 1 1 /* $Id$ */ 2 2 /** @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 6 4 */ 7 5 8 6 /* 9 * Copyright (C) 2006-20 09Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 10 8 * 11 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 30 #include <VBox/scsi.h> 33 31 #include <iprt/assert.h> 34 #include <iprt/string.h> 35 #include <iprt/alloc.h> 32 #include <iprt/mem.h> 36 33 #include <iprt/req.h> 37 34 #include <iprt/semaphore.h> 35 #include <iprt/string.h> 36 #include <iprt/uuid.h> 38 37 39 38 #include "Builtins.h" … … 41 40 /** 42 41 * SCSI driver instance data. 42 * 43 * @implements PDMISCSICONNECTOR 44 * @implements PDMIBLOCKASYNCPORT 45 * @implements PDMIMOUNTNOTIFY 43 46 */ 44 47 typedef struct DRVSCSI … … 65 68 /** The block port interface. */ 66 69 PDMIBLOCKPORT IPort; 70 #if 0 /* these interfaces aren't implemented */ 67 71 /** The optional block async port interface. */ 68 72 PDMIBLOCKASYNCPORT IPortAsync; 69 73 /** The mount notify interface. */ 70 74 PDMIMOUNTNOTIFY IMountNotify; 71 /** The status LED state for this drive. 72 * used in case the device doesn't has a Led interface73 * 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. */ 74 78 PDMLED Led; 75 /** pointer to the Led to use. */79 /** Pointer to the status LED for this drive. */ 76 80 PPDMLED pLed; 77 81 … … 793 797 /* -=-=-=-=- IBase -=-=-=-=- */ 794 798 795 /** @copydoc PDMIBASE::pfnQueryInterface. */ 796 static DECLCALLBACK(void *) drvscsiQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 799 /** 800 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 801 */ 802 static DECLCALLBACK(void *) drvscsiQueryInterface(PPDMIBASE pInterface, const char *pszIID) 797 803 { 798 804 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; 811 814 } 812 815 -
trunk/src/VBox/Devices/Storage/DrvSCSIHost.cpp
r25893 r25966 1 1 /* $Id$ */ 2 2 /** @file 3 * 4 * VBox storage drivers: 5 * Host SCSI access driver. 3 * VBox storage drivers: Host SCSI access driver. 6 4 */ 7 5 8 6 /* 9 * Copyright (C) 2006-20 09Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 10 8 * 11 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 30 #include <VBox/scsi.h> 33 31 #include <iprt/assert.h> 32 #include <iprt/file.h> 33 #include <iprt/mem.h> 34 #include <iprt/req.h> 34 35 #include <iprt/string.h> 35 #include <iprt/alloc.h> 36 #include <iprt/req.h> 37 #include <iprt/file.h> 36 #include <iprt/uuid.h> 38 37 39 38 #if defined(RT_OS_LINUX) … … 47 46 /** 48 47 * SCSI driver instance data. 48 * 49 * @implements PDMISCSICONNECTOR 49 50 */ 50 51 typedef struct DRVSCSIHOST … … 55 56 /** Pointer to the SCSI port interface of the device above. */ 56 57 PPDMISCSIPORT pDevScsiPort; 57 /** The scsi connector interface .*/58 /** The SCSI connector interface . */ 58 59 PDMISCSICONNECTOR ISCSIConnector; 59 60 … … 395 396 /* -=-=-=-=- IBase -=-=-=-=- */ 396 397 397 /** @copydoc PDMIBASE::pfnQueryInterface. */ 398 static DECLCALLBACK(void *) drvscsihostQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 398 /** 399 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 400 */ 401 static DECLCALLBACK(void *) drvscsihostQueryInterface(PPDMIBASE pInterface, const char *pszIID) 399 402 { 400 403 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; 411 411 } 412 412 -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r25893 r25966 107 107 /** 108 108 * 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 109 116 */ 110 117 typedef struct VBOXDISK … … 804 811 *******************************************************************************/ 805 812 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 */ 816 static 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; 823 828 } 824 829 -
trunk/src/VBox/Devices/Storage/fdc.c
r22793 r25966 1 1 #ifdef VBOX 2 /* $Id: $ */ 2 3 /** @file 3 * 4 * VBox storage devices: 5 * Floppy disk controller 4 * VBox storage devices: Floppy disk controller 6 5 */ 7 6 … … 55 54 #include <VBox/pdmdev.h> 56 55 #include <iprt/assert.h> 56 #include <iprt/string.h> 57 57 #include <iprt/uuid.h> 58 #include <iprt/string.h>59 58 60 59 #include "Builtins.h" … … 143 142 } fdisk_flags_t; 144 143 144 #ifdef VBOX 145 /** 146 * The status for one drive. 147 * 148 * @implements PDMIBASE 149 * @implements PDMIBLOCKPORT 150 * @implements PDMIMOUNTNOTIFY 151 */ 152 #endif 145 153 typedef struct fdrive_t { 146 154 #ifndef VBOX … … 356 364 /* @todo */ /** @todo r=bird: todo what exactly?!?!? */ 357 365 { 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; 360 368 } 361 369 #endif /* VBOX */ … … 495 503 #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT) 496 504 505 #ifdef VBOX 506 /** 507 * Floppy controller state. 508 * 509 * @implements PDMILEDPORTS 510 */ 511 #endif 497 512 struct fdctrl_t { 498 513 #ifndef VBOX … … 540 555 PPDMDEVINS pDevIns; 541 556 542 /** Status Port -The base interface. */557 /** Status LUN: The base interface. */ 543 558 PDMIBASE IBaseStatus; 544 /** Status Port -The Leds interface. */559 /** Status LUN: The Leds interface. */ 545 560 PDMILEDPORTS ILeds; 546 /** Status Port -The Partner of ILeds. */561 /** Status LUN: The Partner of ILeds. */ 547 562 PPDMILEDCONNECTORS pLedsConnector; 548 563 #endif … … 1243 1258 { 1244 1259 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); 1249 1264 dump (fdctrl->fifo + rel_pos, len); 1250 AssertMsgRC (rc , ("DMAWriteMemory -> %Rrc\n", rc));1265 AssertMsgRC (rc2, ("DMAWriteMemory -> %Rrc\n", rc2)); 1251 1266 } 1252 1267 #else … … 1262 1277 { 1263 1278 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)); 1269 1284 } 1270 1285 #else … … 1308 1323 int ret; 1309 1324 #ifdef VBOX 1310 int rc;1311 1325 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)); 1316 1329 #else 1317 1330 DMA_read_memory (nchan, tmpbuf, fdctrl->data_pos, len); … … 2485 2498 2486 2499 /** 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} 2493 2501 */ 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 } 2502 static 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; 2508 2512 } 2509 2513 … … 2532 2536 2533 2537 /** 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} 2540 2539 */ 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 } 2540 static 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; 2554 2549 } 2555 2550 -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r25848 r25966 42 42 #ifndef IN_RC 43 43 # include <iprt/mem.h> 44 #endif 45 #ifdef IN_RING3 46 # include <iprt/uuid.h> 44 47 #endif 45 48 … … 1825 1828 1826 1829 /** 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} 1834 1831 */ 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; 1832 static 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; 1844 1840 #ifdef VBOX_WITH_HGCM 1845 case PDMINTERFACE_HGCM_PORT:1846 1841 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_HGCM_PORT) == 0) 1842 return &pThis->HGCMPort; 1847 1843 #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; 1854 1848 } 1855 1849 -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r25848 r25966 51 51 /** Pointer to device instance. */ 52 52 PPDMDEVINSR3 pDevIns; 53 /** VMMDev port base interface. */53 /** LUN\#0 + Status: VMMDev port base interface. */ 54 54 PDMIBASE Base; 55 /** VMMDev port interface. */55 /** LUN\#0: VMMDev port interface. */ 56 56 PDMIVMMDEVPORT Port; 57 57 #ifdef VBOX_WITH_HGCM 58 /** HGCM port interface. */58 /** LUN\#0: HGCM port interface. */ 59 59 PDMIHGCMPORT HGCMPort; 60 60 #endif … … 188 188 #endif /* VBOX_WITH_HGCM */ 189 189 190 /* Shared folders LED */190 /** Status LUN: Shared folders LED */ 191 191 struct 192 192 { -
trunk/src/VBox/Devices/VirtIO/Virtio.cpp
r25830 r25966 2 2 /** @file 3 3 * Virtio - Virtio Common Functions (VRing, VQueue, Virtio PCI) 4 *5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2009 Sun Microsystems, Inc.7 * Copyright (C) 2009-2010 Sun Microsystems, Inc. 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 24 26 25 #include <iprt/param.h> 26 #include <iprt/uuid.h> 27 27 #include <VBox/pdmdev.h> 28 28 #include "Virtio.h" … … 522 522 523 523 #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 */ 528 void *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; 545 538 } 546 539 … … 934 927 } 935 928 936 937 929 #endif /* IN_RING3 */ 938 930 -
trunk/src/VBox/Devices/VirtIO/Virtio.h
r25158 r25966 2 2 /** @file 3 3 * Virtio.h - Virtio Declarations 4 *5 4 */ 6 5 … … 162 161 }; 163 162 163 164 /** 165 * The state of the VirtIO PCI device 166 * 167 * @implements PDMILEDPORTS 168 */ 164 169 struct VPCIState_st 165 170 { … … 172 177 #endif 173 178 179 /** Status LUN: Base interface. */ 174 180 PDMIBASE IBase; 175 PDMILEDPORTS ILeds; /**< LED interface */ 181 /** Status LUN: LED port interface. */ 182 PDMILEDPORTS ILeds; 183 /** Status LUN: LED connector (peer). */ 176 184 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector; 177 185 … … 263 271 void vpciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta); 264 272 void vpciReset(PVPCISTATE pState); 265 void *vpciQueryInterface(struct PDMIBASE *pInterface, 266 PDMINTERFACE enmInterface); 273 void *vpciQueryInterface(struct PDMIBASE *pInterface, const char *pszIID); 267 274 PVQUEUE vpciAddQueue(VPCISTATE* pState, unsigned uSize, 268 275 void (*pfnCallback)(void *pvState, PVQUEUE pQueue),
Note:
See TracChangeset
for help on using the changeset viewer.