Ticket #1: dev.diff

File dev.diff, 23.8 KB (added by Valery V. Sedletski, 9 years ago)

Devices (device support)

  • \src\VBox\Devices/Makefile.kmk

    diff -urN vbox-clean-bk\src\VBox\Devices/Makefile.kmk vbox-clean\src\VBox\Devices/Makefile.kmk
    old new  
    538538   $(PATH_SDK_$(VBOX_WINDDK)_LIB)/dsound.lib
    539539 endif
    540540
     541 ifeq ($(KBUILD_TARGET),os2)
     542   VBoxDD_LIBS += $(PATH_STAGE_LIB)/VBox-os2-poll$(VBOX_SUFF_LIB)
     543   VBoxDD_INCS += $(PATH_SUB_CURRENT)/src/libs/poll-os2
     544 endif
     545
    541546 ifeq ($(KBUILD_TARGET),linux)
    542547  VBoxDD_SOURCES += \
    543548        Audio/DrvHostOSSAudio.cpp
  • \src\VBox\Devices/Network/DrvNAT.cpp

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/DrvNAT.cpp vbox-clean\src\VBox\Devices/Network/DrvNAT.cpp
    old new  
    4242#include <iprt/string.h>
    4343#include <iprt/stream.h>
    4444#include <iprt/uuid.h>
     45#ifdef RT_OS_OS2
     46#include <iprt/socket.h>
     47#include <resolv.h>
     48#endif
    4549
    4650#include "VBoxDD.h"
    4751
     
    171175    PDMNETWORKLINKSTATE     enmLinkStateWant;
    172176
    173177#ifndef RT_OS_WINDOWS
     178#ifndef RT_OS_OS2
    174179    /** The write end of the control pipe. */
    175180    RTPIPE                  hPipeWrite;
    176181    /** The read end of the control pipe. */
    177182    RTPIPE                  hPipeRead;
     183#else
     184    /** The write end of the control pipe. */
     185    RTSOCKET                hPipeWrite;
     186    /** The read end of the control pipe. */
     187    RTSOCKET                hPipeRead;
     188#endif
    178189# if HC_ARCH_BITS == 32
    179190    uint32_t                u32Padding;
    180191# endif
     
    610621#ifndef RT_OS_WINDOWS
    611622    /* kick poll() */
    612623    size_t cbIgnored;
     624#ifndef RT_OS_OS2
    613625    rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
    614626#else
     627    rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     628#endif
     629
     630#else
    615631    /* kick WSAWaitForMultipleEvents */
    616632    rc = WSASetEvent(pThis->hWakeupEvent);
    617633#endif
     
    784800
    785801        /* don't pass the management pipe */
    786802        slirp_select_fill(pThis->pNATState, &nFDs, &polls[1]);
    787 
     803#ifndef RT_OS_OS2
    788804        polls[0].fd = RTPipeToNative(pThis->hPipeRead);
     805#else
     806            polls[0].fd = RTSocketToNative(pThis->hPipeRead);
     807#endif
    789808        /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */
    790809        polls[0].events = POLLRDNORM | POLLPRI | POLLRDBAND;
    791810        polls[0].revents = 0;
     
    825844                 * pipe.*/
    826845                char ch;
    827846                size_t cbRead;
     847#ifndef RT_OS_OS2
    828848                RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     849#else
     850                        RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     851#endif
    829852            }
    830853        }
    831854        /* process _all_ outstanding requests but don't wait */
     
    16111634            /*
    16121635             * Create the control pipe.
    16131636             */
     1637#ifndef RT_OS_OS2
    16141638            rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    16151639            AssertRCReturn(rc, rc);
    16161640#else
     1641                int so[2];
     1642
     1643                /* Create a pair of connected local sockets */
     1644                rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     1645
     1646            AssertRCReturn(rc, rc);
     1647                RTSocketFromNative(&pThis->hPipeRead,  so[0]);
     1648                RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     1649#endif
     1650
     1651#else
    16171652            pThis->hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */
    16181653            slirp_register_external_event(pThis->pNATState, pThis->hWakeupEvent,
    16191654                                          VBOX_WAKEUP_EVENT_INDEX);
  • \src\VBox\Devices/Network/DrvTAP.cpp

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/DrvTAP.cpp vbox-clean\src\VBox\Devices/Network/DrvTAP.cpp
    old new  
    3939# include <iprt/process.h>
    4040# include <iprt/env.h>
    4141#endif
     42#ifdef RT_OS_OS2
     43#include <iprt/socket.h>
     44#endif
    4245
    4346#include <sys/ioctl.h>
    4447#include <sys/poll.h>
     
    9699    char                   *pszSetupApplication;
    97100    /** TAP terminate application. */
    98101    char                   *pszTerminateApplication;
     102#ifndef RT_OS_OS2
    99103    /** The write end of the control pipe. */
    100104    RTPIPE                  hPipeWrite;
    101105    /** The read end of the control pipe. */
    102106    RTPIPE                  hPipeRead;
     107#else
     108    /** The write end of the control pipe. */
     109    RTSOCKET                hPipeWrite;
     110    /** The read end of the control pipe. */
     111    RTSOCKET                hPipeRead;
     112#endif
    103113    /** Reader thread. */
    104114    PPDMTHREAD              pThread;
    105115
     
    347357        aFDs[0].fd      = RTFileToNative(pThis->hFileDevice);
    348358        aFDs[0].events  = POLLIN | POLLPRI;
    349359        aFDs[0].revents = 0;
     360#ifndef RT_OS_OS2
    350361        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
     362#else
     363        aFDs[1].fd      = RTSocketToNative(pThis->hPipeRead);
     364#endif
    351365        aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
    352366        aFDs[1].revents = 0;
    353367        STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
     
    431445            /* drain the pipe */
    432446            char ch;
    433447            size_t cbRead;
     448#ifndef RT_OS_OS2
    434449            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     450#else
     451                RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     452#endif
    435453        }
    436454        else
    437455        {
     
    468486    PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
    469487
    470488    size_t cbIgnored;
     489#ifndef RT_OS_OS2
    471490    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     491#else
     492    int rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     493#endif
    472494    AssertRC(rc);
    473495
    474496    return VINF_SUCCESS;
     
    772794     * Terminate the control pipe.
    773795     */
    774796    int rc;
     797#ifndef RT_OS_OS2
    775798    if (pThis->hPipeWrite != NIL_RTPIPE)
    776799    {
    777800        rc = RTPipeClose(pThis->hPipeWrite); AssertRC(rc);
     
    782805        rc = RTPipeClose(pThis->hPipeRead); AssertRC(rc);
    783806        pThis->hPipeRead = NIL_RTPIPE;
    784807    }
     808#else
     809    if (pThis->hPipeWrite != NIL_RTSOCKET)
     810    {
     811        rc = RTSocketClose(pThis->hPipeWrite); AssertRC(rc);
     812        pThis->hPipeWrite = NIL_RTSOCKET;
     813    }
     814    if (pThis->hPipeRead != NIL_RTSOCKET)
     815    {
     816        rc = RTSocketClose(pThis->hPipeRead); AssertRC(rc);
     817        pThis->hPipeRead = NIL_RTSOCKET;
     818    }
     819#endif
    785820
    786821#ifdef RT_OS_SOLARIS
    787822    /** @todo r=bird: This *does* need checking against ConsoleImpl2.cpp if used on non-solaris systems. */
     
    849884     */
    850885    pThis->pDrvIns                      = pDrvIns;
    851886    pThis->hFileDevice                  = NIL_RTFILE;
     887#ifndef RT_OS_OS2
    852888    pThis->hPipeWrite                   = NIL_RTPIPE;
    853889    pThis->hPipeRead                    = NIL_RTPIPE;
     890#else
     891    pThis->hPipeWrite                   = NIL_RTSOCKET;
     892    pThis->hPipeRead                    = NIL_RTSOCKET;
     893#endif
    854894    pThis->pszDeviceName                = NULL;
    855895#ifdef RT_OS_SOLARIS
    856896    pThis->iIPFileDes                   = -1;
     
    9831023    /*
    9841024     * Create the control pipe.
    9851025     */
     1026#ifndef RT_OS_OS2
    9861027    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    9871028    AssertRCReturn(rc, rc);
     1029#else
     1030    int so[2];
    9881031
     1032    /* Create a pair of connected local sockets */
     1033    rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     1034    AssertRCReturn(rc, rc);
     1035
     1036    RTSocketFromNative(&pThis->hPipeRead, so[0]);
     1037    RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     1038#endif
    9891039    /*
    9901040     * Create the async I/O thread.
    9911041     */
  • \src\VBox\Devices/Network/DrvVDE.cpp

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/DrvVDE.cpp vbox-clean\src\VBox\Devices/Network/DrvVDE.cpp
    old new  
    3838#include <iprt/string.h>
    3939#include <iprt/thread.h>
    4040#include <iprt/uuid.h>
     41#ifdef RT_OS_OS2
     42#include <iprt/socket.h>
     43#endif
    4144
    4245#include <sys/ioctl.h>
    4346#include <sys/poll.h>
     
    6669    PPDMDRVINS              pDrvIns;
    6770    /** The configured VDE device name. */
    6871    char                   *pszDeviceName;
     72#ifndef RT_OS_OS2
    6973    /** The write end of the control pipe. */
    7074    RTPIPE                  hPipeWrite;
    7175    /** The read end of the control pipe. */
    7276    RTPIPE                  hPipeRead;
     77#else
     78    /** The write end of the control pipe. */
     79    RTSOCKET                hPipeWrite;
     80    /** The read end of the control pipe. */
     81    RTSOCKET                hPipeRead;
     82#endif
    7383    /** Reader thread. */
    7484    PPDMTHREAD              pThread;
    7585    /** The connection to the VDE switch */
     
    320330        aFDs[0].fd      = vde_datafd(pThis->pVdeConn);
    321331        aFDs[0].events  = POLLIN | POLLPRI;
    322332        aFDs[0].revents = 0;
     333#ifndef RT_OS_OS2
    323334        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
     335#else
     336        aFDs[1].fd      = RTSocketToNative(pThis->hPipeRead);
     337#endif
    324338        aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
    325339        aFDs[1].revents = 0;
    326340        STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
     
    402416            /* drain the pipe */
    403417            char ch;
    404418            size_t cbRead;
     419#ifndef RT_OS_OS2
    405420            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     421#else
     422            RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     423#endif
    406424        }
    407425        else
    408426        {
     
    439457    PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
    440458
    441459    size_t cbIgnored;
     460#ifndef RT_OS_OS2
    442461    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     462#else
     463    int rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     464#endif
    443465    AssertRC(rc);
    444466
    445467    return VINF_SUCCESS;
     
    480502    /*
    481503     * Terminate the control pipe.
    482504     */
     505#ifndef RT_OS_OS2
    483506    if (pThis->hPipeWrite != NIL_RTPIPE)
    484507    {
    485508        RTPipeClose(pThis->hPipeWrite);
     
    490513        RTPipeClose(pThis->hPipeRead);
    491514        pThis->hPipeRead = NIL_RTPIPE;
    492515    }
     516#else
     517    if (pThis->hPipeWrite != NIL_RTSOCKET)
     518    {
     519        RTSocketClose(pThis->hPipeWrite);
     520        pThis->hPipeWrite = NIL_RTSOCKET;
     521    }
     522    if (pThis->hPipeRead != NIL_RTSOCKET)
     523    {
     524        RTSocketClose(pThis->hPipeRead);
     525        pThis->hPipeRead = NIL_RTSOCKET;
     526    }
     527#endif
    493528
    494529    MMR3HeapFree(pThis->pszDeviceName);
    495530    pThis->pszDeviceName = NULL;
     
    535570     */
    536571    pThis->pDrvIns                              = pDrvIns;
    537572    pThis->pszDeviceName                        = NULL;
     573#ifndef RT_OS_OS2
    538574    pThis->hPipeRead                            = NIL_RTPIPE;
    539575    pThis->hPipeWrite                           = NIL_RTPIPE;
     576#else
     577    pThis->hPipeRead                            = NIL_RTSOCKET;
     578    pThis->hPipeWrite                           = NIL_RTSOCKET;
     579#endif
    540580
    541581    /* IBase */
    542582    pDrvIns->IBase.pfnQueryInterface            = drvVDEQueryInterface;
     
    608648    /*
    609649     * Create the control pipe.
    610650     */
     651#ifndef RT_OS_OS2
    611652    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    612653    AssertRCReturn(rc, rc);
     654#else
     655    int so[2];
     656
     657    /* Create a pair of connected local sockets */
     658    rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     659    AssertRCReturn(rc, rc);
     660
     661    RTSocketFromNative(&pThis->hPipeRead, so[0]);
     662    RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     663#endif
    613664
    614665    /*
    615666     * Create the async I/O thread.
  • \src\VBox\Devices/Network/slirp/resolv_conf_parser.c

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/slirp/resolv_conf_parser.c vbox-clean\src\VBox\Devices/Network/slirp/resolv_conf_parser.c
    old new  
    299299                }
    300300
    301301                break;
     302#if !defined(RT_OS_OS2)
    302303            case tok_ipv6:
    303304            case tok_ipv6_port:
    304305                {
     
    316317                }
    317318
    318319                break;
     320#endif
    319321            default: /* loop condition doesn't let enter enything */
    320322                AssertMsgFailed(("shouldn't ever happen tok:%d, %s", tok,
    321323                                 isprint(tok) ? parser->rcpp_str_buffer : "#"));
  • \src\VBox\Devices/Network/slirp/slirp_dns.c

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/slirp/slirp_dns.c vbox-clean\src\VBox\Devices/Network/slirp/slirp_dns.c
    old new  
    161161
    162162    /* XXX: perhaps IPv6 shouldn't be ignored if we're using DNS proxy */
    163163    st.rcps_flags = RCPSF_IGNORE_IPV6;
     164#ifndef RT_OS_OS2
    164165    rc = rcp_parse(&st, RESOLV_CONF_FILE);
     166#else
     167    char *etc = getenv("ETC");
     168    char fn[256];
     169
     170    if (! etc)
     171            return -1;
     172
     173    strcpy(fn, etc);
     174    strcat(fn, "\resolv2");
     175
     176    rc = rcp_parse(&st, fn);
     177#endif
    165178
    166179    if (rc < 0)
    167180        return -1;
  • \src\VBox\Devices/Network/slirp/slirp.c

    diff -urN vbox-clean-bk\src\VBox\Devices/Network/slirp/slirp.c vbox-clean\src\VBox\Devices/Network/slirp/slirp.c
    old new  
    21092109        int rc;
    21102110
    21112111        rcp_state.rcps_flags |= RCPSF_IGNORE_IPV6;
     2112#ifndef RT_OS_OS2
    21122113        rc = rcp_parse(&rcp_state, RESOLV_CONF_FILE);
     2114#else
     2115            char *etc = getenv("ETC");
     2116            char fn[256];
     2117
     2118        if (! etc)
     2119                return VERR_FILE_NOT_FOUND;
     2120
     2121            strcpy(fn, etc);
     2122            strcat(fn, "\resolv2");
     2123
     2124        rc = rcp_parse(&rcp_state, fn);
     2125#endif
    21132126        LogRelFunc(("NAT: rcp_parse:%Rrc old domain:%s new domain:%s\n",
    21142127                    rc, LIST_EMPTY(&pData->pDomainList)
    21152128                      ? "(null)"
  • \src\VBox\Devices/Storage/DevATA.cpp

    diff -urN vbox-clean-bk\src\VBox\Devices/Storage/DevATA.cpp vbox-clean\src\VBox\Devices/Storage/DevATA.cpp
    old new  
    44994499                cBusy = 0;
    45004500                PDMCritSectLeave(&pCtl->lock);
    45014501
    4502 #ifndef RT_OS_WINDOWS
     4502#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
    45034503                /*
    45044504                 * The thread might be stuck in an I/O operation
    45054505                 * due to a high I/O load on the host. (see @bugref{3301})
  • \src\VBox\Devices/Storage/VSCSI/VSCSIVpdPages.h

    diff -urN vbox-clean-bk\src\VBox\Devices/Storage/VSCSI/VSCSIVpdPages.h vbox-clean\src\VBox\Devices/Storage/VSCSI/VSCSIVpdPages.h
    old new  
    6565    uint8_t  abVpdPages[1];
    6666} VSCSIVPDPAGESUPPORTEDPAGES;
    6767#pragma pack()
     68#ifndef RT_OS_OS2 // skip the check
    6869AssertCompileSize(VSCSIVPDPAGESUPPORTEDPAGES, VSCSI_VPD_SUPPORTED_PAGES_SIZE+1);
     70#endif
    6971typedef VSCSIVPDPAGESUPPORTEDPAGES *PVSCSIVPDPAGESUPPORTEDPAGES;
    7072typedef const VSCSIVPDPAGESUPPORTEDPAGES *PCVSCSIVPDPAGESUPPORTEDPAGES;
    7173
     
    99101    uint8_t  abReserved[56];
    100102} VSCSIVPDPAGEBLOCKCHARACTERISTICS;
    101103#pragma pack()
     104#ifndef RT_OS_OS2 // skip the check
    102105AssertCompileSize(VSCSIVPDPAGEBLOCKCHARACTERISTICS, VSCSI_VPD_BLOCK_CHARACTERISTICS_SIZE);
     106#endif
    103107typedef VSCSIVPDPAGEBLOCKCHARACTERISTICS *PVSCSIVPDPAGEBLOCKCHARACTERISTICS;
    104108typedef const VSCSIVPDPAGEBLOCKCHARACTERISTICS *PCVSCSIVPDPAGEBLOCKCHARACTERISTICS;
    105109
  • \src\VBox\Devices/USB/os2/USBProxyDevice-os2.cpp

    diff -urN vbox-clean-bk\src\VBox\Devices/USB/os2/USBProxyDevice-os2.cpp vbox-clean\src\VBox\Devices/USB/os2/USBProxyDevice-os2.cpp
    old new  
    174174 */
    175175static PUSBPROXYURBOS2 usbProxyOs2UrbAlloc(PUSBPROXYDEV pProxyDev)
    176176{
    177     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     177    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    178178    PUSBPROXYURBOS2 pUrbOs2;
    179179
    180180    RTCritSectEnter(&pDevOs2->CritSect);
     
    216216 */
    217217static void usbProxyOs2UrbFree(PUSBPROXYDEV pProxyDev, PUSBPROXYURBOS2 pUrbOs2)
    218218{
    219     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     219    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    220220
    221221    RTCritSectEnter(&pDevOs2->CritSect);
    222222
     
    260260static DECLCALLBACK(int) usbProxyOs2AsyncThread(RTTHREAD Thread, void *pvProxyDev)
    261261{
    262262    PUSBPROXYDEV pProxyDev = (PUSBPROXYDEV)pvProxyDev;
    263     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     263    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    264264    size_t cbLow = 0;
    265265    void *pvLow = NULL;
    266266
     
    429429 * @param   pszAddress      The path to the device.
    430430 * @param   pvBackend       Backend specific pointer, unused for the linux backend.
    431431 */
    432 static int usbProxyOs2Open(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend)
     432static DECLCALLBACK(int) usbProxyOs2Open(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend)
    433433{
    434434    LogFlow(("usbProxyOs2Open: pProxyDev=%p pszAddress=%s\n", pProxyDev, pszAddress));
    435435    int rc;
     
    468468        const char chValue = *psz;
    469469        AssertReleaseReturn(psz[1] == '=', VERR_INTERNAL_ERROR);
    470470        uint64_t u64Value;
    471         int rc = RTStrToUInt64Ex(psz + 2, (char **)&psz, 0, &u64Value);
     471            rc = RTStrToUInt64Ex(psz + 2, (char **)&psz, 0, &u64Value);
    472472        AssertReleaseRCReturn(rc, rc);
    473473        AssertReleaseReturn(!*psz || *psz == ';', rc);
    474474        switch (chValue)
     
    506506                rc = RTSemEventCreate(&pDevOs2->EventSyncWait);
    507507                if (RT_SUCCESS(rc))
    508508                {
    509                     pProxyDev->Backend.pv = pDevOs2;
     509                            pProxyDev->pvInstanceDataR3 = pDevOs2;
    510510
    511511                    /** @todo
    512512                     * Determine the active configuration.
     
    542542        rc = VERR_VUSB_USBFS_PERMISSION; /** @todo fix me */
    543543
    544544    Log(("usbProxyOs2Open(%p, %s) failed, rc=%Rrc! urc=%d\n", pProxyDev, pszAddress, rc, urc)); NOREF(urc);
    545     pProxyDev->Backend.pv = NULL;
     545    pProxyDev->pvInstanceDataR3 = NULL;
    546546
    547547    NOREF(pvBackend);
    548548    return rc;
     
    552552/**
    553553 * Closes the proxy device.
    554554 */
    555 static void usbProxyOs2Close(PUSBPROXYDEV pProxyDev)
     555static DECLCALLBACK(void) usbProxyOs2Close(PUSBPROXYDEV pProxyDev)
    556556{
    557557    LogFlow(("usbProxyOs2Close: pProxyDev=%s\n", pProxyDev->pUsbIns->pszName));
    558     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     558    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    559559    Assert(pDevOs2);
    560560    if (!pDevOs2)
    561561        return;
     
    590590    pDevOs2->hDevice = 0;
    591591
    592592    RTMemFree(pDevOs2);
    593     pProxyDev->Backend.pv = NULL;
     593    pProxyDev->pvInstanceDataR3 = NULL;
    594594    LogFlow(("usbProxyOs2Close: returns\n"));
    595595}
    596596
     
    601601 * @returns VBox status code.
    602602 * @param   pDev    The device to reset.
    603603 */
    604 static int usbProxyOs2Reset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux)
     604static DECLCALLBACK(int) usbProxyOs2Reset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux)
    605605{
    606606    return VINF_SUCCESS;
    607607}
     
    617617 * @param   pProxyDev       The device instance data.
    618618 * @param   iCfg            The configuration to set.
    619619 */
    620 static int usbProxyOs2SetConfig(PUSBPROXYDEV pProxyDev, int iCfg)
     620static DECLCALLBACK(int) usbProxyOs2SetConfig(PUSBPROXYDEV pProxyDev, int iCfg)
    621621{
    622     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     622    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    623623    LogFlow(("usbProxyOs2SetConfig: pProxyDev=%s cfg=%#x\n",
    624624             pProxyDev->pUsbIns->pszName, iCfg));
    625625
     
    644644 * Claims an interface.
    645645 * @returns success indicator.
    646646 */
    647 static int usbProxyOs2ClaimInterface(PUSBPROXYDEV pProxyDev, int iIf)
     647static DECLCALLBACK(int) usbProxyOs2ClaimInterface(PUSBPROXYDEV pProxyDev, int iIf)
    648648{
    649649    LogFlow(("usbProxyOs2ClaimInterface: pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, iIf));
    650650    return true;
     
    655655 * Releases an interface.
    656656 * @returns success indicator.
    657657 */
    658 static int usbProxyOs2ReleaseInterface(PUSBPROXYDEV pProxyDev, int iIf)
     658static DECLCALLBACK(int) usbProxyOs2ReleaseInterface(PUSBPROXYDEV pProxyDev, int iIf)
    659659{
    660660    LogFlow(("usbProxyOs2ReleaseInterface: pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, iIf));
    661661    return true;
     
    667667 *
    668668 * @returns success indicator.
    669669 */
    670 static int usbProxyOs2SetInterface(PUSBPROXYDEV pProxyDev, int iIf, int iAlt)
     670static DECLCALLBACK(int) usbProxyOs2SetInterface(PUSBPROXYDEV pProxyDev, int iIf, int iAlt)
    671671{
    672672    LogFlow(("usbProxyOs2SetInterface: pProxyDev=%p iIf=%#x iAlt=%#x\n", pProxyDev, iIf, iAlt));
    673673    return true;
     
    677677/**
    678678 * Clears the halted endpoint 'EndPt'.
    679679 */
    680 static bool usbProxyOs2ClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int EndPt)
     680static DECLCALLBACK(int) usbProxyOs2ClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int EndPt)
    681681{
    682     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     682    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    683683    LogFlow(("usbProxyOs2ClearHaltedEp: pProxyDev=%s EndPt=%x\n", pProxyDev->pUsbIns->pszName, EndPt));
    684684
    685685    /*
     
    702702/**
    703703 * @copydoc USBPROXYBACK::pfnUrbQueue
    704704 */
    705 static int usbProxyOs2UrbQueue(PVUSBURB pUrb)
     705static DECLCALLBACK(int) usbProxyOs2UrbQueue(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb)
    706706{
    707     PUSBPROXYDEV    pProxyDev = (PUSBPROXYDEV)pUrb->pDev;
    708     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     707    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    709708    LogFlow(("usbProxyOs2UrbQueue: pProxyDev=%s pUrb=%p EndPt=%d cbData=%d\n",
    710709             pProxyDev->pUsbIns->pszName, pUrb, pUrb->EndPt, pUrb->cbData));
    711710
     
    771770 * @param   pProxyDev   The device.
    772771 * @param   cMillies    Number of milliseconds to wait. Use 0 to not wait at all.
    773772 */
    774 static PVUSBURB usbProxyOs2UrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)
     773static DECLCALLBACK(PVUSBURB) usbProxyOs2UrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)
    775774{
    776775    PVUSBURB pUrb = NULL;
    777     PUSBPROXYDEVOS2 pDevOs2 = (PUSBPROXYDEVOS2)pProxyDev->Backend.pv;
     776    PUSBPROXYDEVOS2 pDevOs2 = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVOS2);
    778777
    779778    RTCritSectEnter(&pDevOs2->CritSect);
    780779    for (;;)
     
    818817 * Cancels the URB.
    819818 * The URB requires reaping, so we don't change its state.
    820819 */
    821 static void usbProxyOs2UrbCancel(PVUSBURB pUrb)
     820static DECLCALLBACK(int) usbProxyOs2UrbCancel(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb)
    822821{
    823822#if 0
    824     PUSBPROXYDEV pProxyDev = (PUSBPROXYDEV)pUrb->pDev;
    825823    PUSBPROXYURBOS2 pUrbOs2 = (PUSBPROXYURBOS2)pUrb->Dev.pvProxyUrb;
    826824    if (pUrbOs2->pSplitHead)
    827825    {
     
    850848                 pUrb, errno, pProxyDev->pUsbIns->pszName));
    851849    }
    852850#endif
     851    return 0;
    853852}
    854853
     854static DECLCALLBACK(int) usbProxyOs2Wakeup(PUSBPROXYDEV pProxyDev)
     855{
     856    return 1; // (???)
     857}
    855858
    856859/**
    857860 * The Linux USB Proxy Backend.
    858861 */
    859862extern const USBPROXYBACK g_USBProxyDeviceHost =
    860863{
    861     "host",
     864    "host", /* pszName */
     865    sizeof(USBPROXYDEVOS2), /* cbBackend */
    862866    usbProxyOs2Open,
    863     NULL,
     867    NULL, /* usbProxyOs2Init */
    864868    usbProxyOs2Close,
    865869    usbProxyOs2Reset,
    866870    usbProxyOs2SetConfig,
     
    871875    usbProxyOs2UrbQueue,
    872876    usbProxyOs2UrbCancel,
    873877    usbProxyOs2UrbReap,
     878    NULL, /* usbProxyOs2Wakeup */
    874879    0
    875880};
    876