Ticket #1: dev.2.diff

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

Device drivers

  • \src\VBox\Devices/Makefile.kmk

    diff -urN vbox-trunk-bk\src\VBox\Devices/Makefile.kmk vbox-trunk\src\VBox\Devices/Makefile.kmk
    old new  
    553553   Audio/DrvHostDSound.cpp
    554554 endif
    555555
     556 ifeq ($(KBUILD_TARGET),os2)
     557   VBoxDD_LIBS += $(PATH_STAGE_LIB)/VBox-os2-poll$(VBOX_SUFF_LIB)
     558   VBoxDD_INCS += $(PATH_SUB_CURRENT)/src/libs/poll-os2
     559 endif
     560
    556561 ifeq ($(KBUILD_TARGET),linux)
    557562  VBoxDD_SOURCES += \
    558563        Audio/DrvHostOSSAudio.cpp
  • \src\VBox\Devices/Network/DrvNAT.cpp

    diff -urN vbox-trunk-bk\src\VBox\Devices/Network/DrvNAT.cpp vbox-trunk\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
     
    172176    PDMNETWORKLINKSTATE     enmLinkStateWant;
    173177
    174178#ifndef RT_OS_WINDOWS
     179#ifndef RT_OS_OS2
    175180    /** The write end of the control pipe. */
    176181    RTPIPE                  hPipeWrite;
    177182    /** The read end of the control pipe. */
    178183    RTPIPE                  hPipeRead;
     184#else
     185    /** The write end of the control pipe. */
     186    RTSOCKET                hPipeWrite;
     187    /** The read end of the control pipe. */
     188    RTSOCKET                hPipeRead;
     189#endif
    179190# if HC_ARCH_BITS == 32
    180191    uint32_t                u32Padding;
    181192# endif
     
    611622#ifndef RT_OS_WINDOWS
    612623    /* kick poll() */
    613624    size_t cbIgnored;
     625#ifndef RT_OS_OS2
    614626    rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
    615627#else
     628    rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     629#endif
     630
     631#else
    616632    /* kick WSAWaitForMultipleEvents */
    617633    rc = WSASetEvent(pThis->hWakeupEvent);
    618634#endif
     
    790806        /* don't pass the management pipe */
    791807        slirp_select_fill(pThis->pNATState, &nFDs, &polls[1]);
    792808
     809#ifndef RT_OS_OS2
    793810        polls[0].fd = RTPipeToNative(pThis->hPipeRead);
     811#else
     812            polls[0].fd = RTSocketToNative(pThis->hPipeRead);
     813#endif
    794814        /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */
    795815        polls[0].events = POLLRDNORM | POLLPRI | POLLRDBAND;
    796816        polls[0].revents = 0;
     
    830850                 * pipe.*/
    831851                char ch;
    832852                size_t cbRead;
     853#ifndef RT_OS_OS2
    833854                RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     855#else
     856                        RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     857#endif
    834858            }
    835859        }
    836860        /* process _all_ outstanding requests but don't wait */
     
    16051629            /*
    16061630             * Create the control pipe.
    16071631             */
     1632#ifndef RT_OS_OS2
    16081633            rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    16091634            AssertRCReturn(rc, rc);
    16101635#else
     1636                int so[2];
     1637
     1638                /* Create a pair of connected local sockets */
     1639                rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     1640
     1641            AssertRCReturn(rc, rc);
     1642                RTSocketFromNative(&pThis->hPipeRead,  so[0]);
     1643                RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     1644#endif
     1645
     1646#else
    16111647            pThis->hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */
    16121648            slirp_register_external_event(pThis->pNATState, pThis->hWakeupEvent,
    16131649                                          VBOX_WAKEUP_EVENT_INDEX);
  • \src\VBox\Devices/Network/DrvTAP.cpp

    diff -urN vbox-trunk-bk\src\VBox\Devices/Network/DrvTAP.cpp vbox-trunk\src\VBox\Devices/Network/DrvTAP.cpp
    old new  
    4040# include <iprt/process.h>
    4141# include <iprt/env.h>
    4242#endif
     43#ifdef RT_OS_OS2
     44#include <iprt/socket.h>
     45#endif
    4346
    4447#include <sys/ioctl.h>
    4548#include <sys/poll.h>
     
    97100    char                   *pszSetupApplication;
    98101    /** TAP terminate application. */
    99102    char                   *pszTerminateApplication;
     103#ifndef RT_OS_OS2
    100104    /** The write end of the control pipe. */
    101105    RTPIPE                  hPipeWrite;
    102106    /** The read end of the control pipe. */
    103107    RTPIPE                  hPipeRead;
     108#else
     109    /** The write end of the control pipe. */
     110    RTSOCKET                hPipeWrite;
     111    /** The read end of the control pipe. */
     112    RTSOCKET                hPipeRead;
     113#endif
    104114    /** Reader thread. */
    105115    PPDMTHREAD              pThread;
    106116
     
    348358        aFDs[0].fd      = RTFileToNative(pThis->hFileDevice);
    349359        aFDs[0].events  = POLLIN | POLLPRI;
    350360        aFDs[0].revents = 0;
     361#ifndef RT_OS_OS2
    351362        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
     363#else
     364        aFDs[1].fd      = RTSocketToNative(pThis->hPipeRead);
     365#endif
    352366        aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
    353367        aFDs[1].revents = 0;
    354368        STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
     
    432446            /* drain the pipe */
    433447            char ch;
    434448            size_t cbRead;
     449#ifndef RT_OS_OS2
    435450            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     451#else
     452                RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     453#endif
    436454        }
    437455        else
    438456        {
     
    469487    PDRVTAP pThis = PDMINS_2_DATA(pDrvIns, PDRVTAP);
    470488
    471489    size_t cbIgnored;
     490#ifndef RT_OS_OS2
    472491    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     492#else
     493    int rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     494#endif
    473495    AssertRC(rc);
    474496
    475497    return VINF_SUCCESS;
     
    773795     * Terminate the control pipe.
    774796     */
    775797    int rc;
     798#ifndef RT_OS_OS2
    776799    if (pThis->hPipeWrite != NIL_RTPIPE)
    777800    {
    778801        rc = RTPipeClose(pThis->hPipeWrite); AssertRC(rc);
     
    783806        rc = RTPipeClose(pThis->hPipeRead); AssertRC(rc);
    784807        pThis->hPipeRead = NIL_RTPIPE;
    785808    }
     809#else
     810    if (pThis->hPipeWrite != NIL_RTSOCKET)
     811    {
     812        rc = RTSocketClose(pThis->hPipeWrite); AssertRC(rc);
     813        pThis->hPipeWrite = NIL_RTSOCKET;
     814    }
     815    if (pThis->hPipeRead != NIL_RTSOCKET)
     816    {
     817        rc = RTSocketClose(pThis->hPipeRead); AssertRC(rc);
     818        pThis->hPipeRead = NIL_RTSOCKET;
     819    }
     820#endif
    786821
    787822#ifdef RT_OS_SOLARIS
    788823    /** @todo r=bird: This *does* need checking against ConsoleImpl2.cpp if used on non-solaris systems. */
     
    850885     */
    851886    pThis->pDrvIns                      = pDrvIns;
    852887    pThis->hFileDevice                  = NIL_RTFILE;
     888#ifndef RT_OS_OS2
    853889    pThis->hPipeWrite                   = NIL_RTPIPE;
    854890    pThis->hPipeRead                    = NIL_RTPIPE;
     891#else
     892    pThis->hPipeWrite                   = NIL_RTSOCKET;
     893    pThis->hPipeRead                    = NIL_RTSOCKET;
     894#endif
    855895    pThis->pszDeviceName                = NULL;
    856896#ifdef RT_OS_SOLARIS
    857897    pThis->iIPFileDes                   = -1;
     
    9841024    /*
    9851025     * Create the control pipe.
    9861026     */
     1027#ifndef RT_OS_OS2
    9871028    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    9881029    AssertRCReturn(rc, rc);
     1030#else
     1031    int so[2];
    9891032
     1033    /* Create a pair of connected local sockets */
     1034    rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     1035    AssertRCReturn(rc, rc);
     1036
     1037    RTSocketFromNative(&pThis->hPipeRead, so[0]);
     1038    RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     1039#endif
    9901040    /*
    9911041     * Create the async I/O thread.
    9921042     */
  • \src\VBox\Devices/Network/DrvVDE.cpp

    diff -urN vbox-trunk-bk\src\VBox\Devices/Network/DrvVDE.cpp vbox-trunk\src\VBox\Devices/Network/DrvVDE.cpp
    old new  
    3939#include <iprt/string.h>
    4040#include <iprt/thread.h>
    4141#include <iprt/uuid.h>
     42#ifdef RT_OS_OS2
     43#include <iprt/socket.h>
     44#endif
    4245
    4346#include <sys/ioctl.h>
    4447#include <sys/poll.h>
     
    6770    PPDMDRVINS              pDrvIns;
    6871    /** The configured VDE device name. */
    6972    char                   *pszDeviceName;
     73#ifndef RT_OS_OS2
    7074    /** The write end of the control pipe. */
    7175    RTPIPE                  hPipeWrite;
    7276    /** The read end of the control pipe. */
    7377    RTPIPE                  hPipeRead;
     78#else
     79    /** The write end of the control pipe. */
     80    RTSOCKET                hPipeWrite;
     81    /** The read end of the control pipe. */
     82    RTSOCKET                hPipeRead;
     83#endif
    7484    /** Reader thread. */
    7585    PPDMTHREAD              pThread;
    7686    /** The connection to the VDE switch */
     
    321331        aFDs[0].fd      = vde_datafd(pThis->pVdeConn);
    322332        aFDs[0].events  = POLLIN | POLLPRI;
    323333        aFDs[0].revents = 0;
     334#ifndef RT_OS_OS2
    324335        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
     336#else
     337        aFDs[1].fd      = RTSocketToNative(pThis->hPipeRead);
     338#endif
    325339        aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
    326340        aFDs[1].revents = 0;
    327341        STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a);
     
    403417            /* drain the pipe */
    404418            char ch;
    405419            size_t cbRead;
     420#ifndef RT_OS_OS2
    406421            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
     422#else
     423            RTSocketRead(pThis->hPipeRead, &ch, 1, &cbRead);
     424#endif
    407425        }
    408426        else
    409427        {
     
    440458    PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
    441459
    442460    size_t cbIgnored;
     461#ifndef RT_OS_OS2
    443462    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
     463#else
     464    int rc = RTSocketWrite(pThis->hPipeWrite, "", 1);
     465#endif
    444466    AssertRC(rc);
    445467
    446468    return VINF_SUCCESS;
     
    481503    /*
    482504     * Terminate the control pipe.
    483505     */
     506#ifndef RT_OS_OS2
    484507    if (pThis->hPipeWrite != NIL_RTPIPE)
    485508    {
    486509        RTPipeClose(pThis->hPipeWrite);
     
    491514        RTPipeClose(pThis->hPipeRead);
    492515        pThis->hPipeRead = NIL_RTPIPE;
    493516    }
     517#else
     518    if (pThis->hPipeWrite != NIL_RTSOCKET)
     519    {
     520        RTSocketClose(pThis->hPipeWrite);
     521        pThis->hPipeWrite = NIL_RTSOCKET;
     522    }
     523    if (pThis->hPipeRead != NIL_RTSOCKET)
     524    {
     525        RTSocketClose(pThis->hPipeRead);
     526        pThis->hPipeRead = NIL_RTSOCKET;
     527    }
     528#endif
    494529
    495530    MMR3HeapFree(pThis->pszDeviceName);
    496531    pThis->pszDeviceName = NULL;
     
    536571     */
    537572    pThis->pDrvIns                              = pDrvIns;
    538573    pThis->pszDeviceName                        = NULL;
     574#ifndef RT_OS_OS2
    539575    pThis->hPipeRead                            = NIL_RTPIPE;
    540576    pThis->hPipeWrite                           = NIL_RTPIPE;
     577#else
     578    pThis->hPipeRead                            = NIL_RTSOCKET;
     579    pThis->hPipeWrite                           = NIL_RTSOCKET;
     580#endif
    541581
    542582    /* IBase */
    543583    pDrvIns->IBase.pfnQueryInterface            = drvVDEQueryInterface;
     
    609649    /*
    610650     * Create the control pipe.
    611651     */
     652#ifndef RT_OS_OS2
    612653    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
    613654    AssertRCReturn(rc, rc);
     655#else
     656    int so[2];
     657
     658    /* Create a pair of connected local sockets */
     659    rc = socketpair(AF_LOCAL, SOCK_STREAM, 0, (int *)so);
     660    AssertRCReturn(rc, rc);
     661
     662    RTSocketFromNative(&pThis->hPipeRead, so[0]);
     663    RTSocketFromNative(&pThis->hPipeWrite, so[1]);
     664#endif
    614665
    615666    /*
    616667     * Create the async I/O thread.
  • \src\VBox\Devices/Network/slirp/resolv_conf_parser.c

    diff -urN vbox-trunk-bk\src\VBox\Devices/Network/slirp/resolv_conf_parser.c vbox-trunk\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-trunk-bk\src\VBox\Devices/Network/slirp/slirp_dns.c vbox-trunk\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-trunk-bk\src\VBox\Devices/Network/slirp/slirp.c vbox-trunk\src\VBox\Devices/Network/slirp/slirp.c
    old new  
    20332033        int rc;
    20342034
    20352035        rcp_state.rcps_flags |= RCPSF_IGNORE_IPV6;
     2036#ifndef RT_OS_OS2
    20362037        rc = rcp_parse(&rcp_state, RESOLV_CONF_FILE);
     2038#else
     2039        char *etc = getenv("ETC");
     2040        char fn[256];
     2041
     2042        if (! etc)
     2043                return VERR_FILE_NOT_FOUND;
     2044
     2045        strcpy(fn, etc);
     2046        strcat(fn, "\resolv2");
     2047
     2048        rc = rcp_parse(&rcp_state, fn);
     2049#endif
    20372050        LogRelFunc(("NAT: rcp_parse:%Rrc old domain:%s new domain:%s\n",
    20382051                    rc, LIST_EMPTY(&pData->pDomainList)
    20392052                      ? "(null)"
  • \src\VBox\Devices/Storage/DevATA.cpp

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

    diff -urN vbox-trunk-bk\src\VBox\Devices/Storage/VSCSI/VSCSIVpdPages.h vbox-trunk\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-trunk-bk\src\VBox\Devices/USB/os2/USBProxyDevice-os2.cpp vbox-trunk\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