VirtualBox

Changeset 37596 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
Jun 22, 2011 7:30:06 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72442
Message:

*: RTFILE becomes a pointer, RTFileOpen++ expands it's flags paramter from uint32_t to uint64_t.

Location:
trunk/src/VBox/Devices/USB
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/USBProxyDevice.h

    r33590 r37596  
    207207         * The Linux and Darwin backends are making use of this. */
    208208        void *pv;
    209         RTFILE File;
     209        RTFILE hFile;
    210210        int fd;
    211211        struct vrdp_priv
  • trunk/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp

    r36797 r37596  
    9494{
    9595    /** The open file. */
    96     RTFILE                 File;
     96    RTFILE                 hFile;
    9797    /** Software endpoint structures */
    9898    USBENDPOINTFBSD        aSwEndpoint[USBFBSD_MAXENDPOINTS];
     
    133133    do
    134134    {
    135         rc = ioctl(pDevFBSD->File, iCmd, pvArg);
     135        rc = ioctl(RTFileToNative(pDevFBSD->hFile), iCmd, pvArg);
    136136        if (rc >= 0)
    137137            return VINF_SUCCESS;
     
    369369     * Try open the device node.
    370370     */
    371     RTFILE File;
    372 
    373     rc = RTFileOpen(&File, pszAddress, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     371    RTFILE hFile;
     372    rc = RTFileOpen(&hFile, pszAddress, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    374373    if (RT_SUCCESS(rc))
    375374    {
    376375        /*
    377              * Allocate and initialize the linux backend data.
    378              */
    379         PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)
    380         RTMemAllocZ(sizeof(USBPROXYDEVFBSD));
    381 
     376         * Allocate and initialize the linux backend data.
     377         */
     378        PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)RTMemAllocZ(sizeof(USBPROXYDEVFBSD));
    382379        if (pDevFBSD)
    383380        {
    384             pDevFBSD->File = File;
     381            pDevFBSD->hFile = hFile;
    385382            pProxyDev->Backend.pv = pDevFBSD;
    386383
     
    388385            if (RT_SUCCESS(rc))
    389386            {
    390                 LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns "
    391                          "successfully File=%d iActiveCfg=%d\n",
    392                          pProxyDev, pszAddress,
    393                          pDevFBSD->File, pProxyDev->iActiveCfg));
     387                LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns successfully hFile=%RTfile iActiveCfg=%d\n",
     388                         pProxyDev, pszAddress, pDevFBSD->hFile, pProxyDev->iActiveCfg));
    394389
    395390                return VINF_SUCCESS;
     
    401396            rc = VERR_NO_MEMORY;
    402397
    403         RTFileClose(File);
     398        RTFileClose(hFile);
    404399    }
    405400    else if (rc == VERR_ACCESS_DENIED)
     
    455450static void usbProxyFreeBSDClose(PUSBPROXYDEV pProxyDev)
    456451{
    457     PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD) pProxyDev->Backend.pv;
     452    PUSBPROXYDEVFBSD pDevFBSD = (PUSBPROXYDEVFBSD)pProxyDev->Backend.pv;
    458453
    459454    LogFlow(("usbProxyFreeBSDClose: pProxyDev=%s\n", pProxyDev->pUsbIns->pszName));
     
    464459    usbProxyFreeBSDFsUnInit(pProxyDev);
    465460
    466     RTFileClose(pDevFBSD->File);
    467 
    468     pDevFBSD->File = NIL_RTFILE;
     461    RTFileClose(pDevFBSD->hFile);
     462    pDevFBSD->hFile = NIL_RTFILE;
    469463
    470464    RTMemFree(pDevFBSD);
    471 
    472465    pProxyDev->Backend.pv = NULL;
    473466
     
    991984    {
    992985        /* Poll for finished transfers */
    993         PollFd.fd = (int)pDevFBSD->File;
     986        PollFd.fd = RTFileToNative(pDevFBSD->hFile);
    994987        PollFd.events = POLLIN | POLLRDNORM;
    995988        PollFd.revents = 0;
  • trunk/src/VBox/Devices/USB/linux/USBProxyDevice-linux.cpp

    r35346 r37596  
    137137{
    138138    /** The open file. */
    139     RTFILE              File;
     139    RTFILE              hFile;
    140140    /** Critical section protecting the two lists. */
    141141    RTCRITSECT          CritSect;
     
    194194        do
    195195        {
    196             rc = ioctl(pDevLnx->File, iCmd, pvArg);
     196            rc = ioctl(RTFileToNative(pDevLnx->hFile), iCmd, pvArg);
    197197            if (rc >= 0)
    198198                return rc;
     
    236236        pUrbLnx = pUrbLnx->pNext;
    237237
    238         ioctl(pDevLnx->File, USBDEVFS_DISCARDURB, &pCur->KUrb); /* not sure if this is required.. */
     238        ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_DISCARDURB, &pCur->KUrb); /* not sure if this is required.. */
    239239        if (!pCur->KUrb.status)
    240240            pCur->KUrb.status = -ENODEV;
     
    596596{
    597597    PUSBPROXYDEVLNX pDevLnx = (PUSBPROXYDEVLNX)pProxyDev->Backend.pv;
    598     AssertReturn(pDevLnx->File != NIL_RTFILE, -1);
    599     return pDevLnx->File;
     598    AssertReturn(pDevLnx->hFile != NIL_RTFILE, -1);
     599    return RTFileToNative(pDevLnx->hFile);
    600600}
    601601
     
    653653     * Try open the device node.
    654654     */
    655     RTFILE File;
    656     int rc = RTFileOpen(&File, pszDevNode, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     655    RTFILE hFile;
     656    int rc = RTFileOpen(&hFile, pszDevNode, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    657657    if (RT_SUCCESS(rc))
    658658    {
     
    666666            memcpy(&pDevLnx->szPath[0], pszPath, cchPath);
    667667            pDevLnx->szPath[cchPath] = '\0';
    668             pDevLnx->File = File;
     668            pDevLnx->hFile = hFile;
    669669            rc = RTCritSectInit(&pDevLnx->CritSect);
    670670            if (RT_SUCCESS(rc))
     
    672672                pProxyDev->Backend.pv = pDevLnx;
    673673
    674                 LogFlow(("usbProxyLinuxOpen(%p, %s): returns successfully File=%d iActiveCfg=%d\n",
    675                          pProxyDev, pszAddress, pDevLnx->File, pProxyDev->iActiveCfg));
     674                LogFlow(("usbProxyLinuxOpen(%p, %s): returns successfully File=%RTfile iActiveCfg=%d\n",
     675                         pProxyDev, pszAddress, pDevLnx->hFile, pProxyDev->iActiveCfg));
    676676
    677677                return VINF_SUCCESS;
     
    682682        else
    683683            rc = VERR_NO_MEMORY;
    684         RTFileClose(File);
     684        RTFileClose(hFile);
    685685    }
    686686    else if (rc == VERR_ACCESS_DENIED)
     
    812812    }
    813813
    814     RTFileClose(pDevLnx->File);
    815     pDevLnx->File = NIL_RTFILE;
     814    RTFileClose(pDevLnx->hFile);
     815    pDevLnx->hFile = NIL_RTFILE;
    816816
    817817    RTMemFree(pDevLnx);
     
    12781278    unsigned        cTries = 0;
    12791279
    1280     while (ioctl(pDevLnx->File, USBDEVFS_SUBMITURB, &pCur->KUrb))
     1280    while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_SUBMITURB, &pCur->KUrb))
    12811281    {
    12821282        if (errno == EINTR)
     
    15161516     */
    15171517    cTries = 0;
    1518     while (ioctl(pDevLnx->File, USBDEVFS_SUBMITURB, &pUrbLnx->KUrb))
     1518    while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_SUBMITURB, &pUrbLnx->KUrb))
    15191519    {
    15201520        if (errno == EINTR)
     
    17601760            {
    17611761                struct pollfd pfd;
    1762                 int rc;
    1763 
    1764                 pfd.fd = pDevLnx->File;
     1762                pfd.fd = RTFileToNative(pDevLnx->hFile);
    17651763                pfd.events = POLLOUT | POLLWRNORM /* completed async */
    17661764                           | POLLERR | POLLHUP    /* disconnected */;
    17671765                pfd.revents = 0;
    1768                 rc = poll(&pfd, 1, cMillies);
     1766                int rc = poll(&pfd, 1, cMillies);
    17691767                Log(("usbProxyLinuxUrbReap: poll rc = %d\n", rc));
    17701768                if (rc >= 1)
     
    17901788        {
    17911789            struct usbdevfs_urb *pKUrb;
    1792             while (ioctl(pDevLnx->File, USBDEVFS_REAPURBNDELAY, &pKUrb))
     1790            while (ioctl(RTFileToNative(pDevLnx->hFile), USBDEVFS_REAPURBNDELAY, &pKUrb))
    17931791                if (errno != EINTR)
    17941792                {
  • trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp

    r35346 r37596  
    8080    char                          *pszDevicePath;
    8181    /** The connection to the client driver. */
    82     RTFILE                         File;
     82    RTFILE                         hFile;
    8383    /** Pointer to the proxy device instance. */
    8484    PUSBPROXYDEV                   pProxyDev;
     
    196196static void usbProxySolarisCloseFile(PUSBPROXYDEVSOL pDevSol)
    197197{
    198     if (pDevSol->File != NIL_RTFILE)
    199     {
    200         RTFileClose(pDevSol->File);
    201         pDevSol->File = NIL_RTFILE;
    202     }
     198    RTFileClose(pDevSol->hFile);
     199    pDevSol->hFile = NIL_RTFILE;
    203200}
    204201
     
    215212static int usbProxySolarisIOCtl(PUSBPROXYDEVSOL pDevSol, unsigned Function, void *pvData, size_t cbData)
    216213{
    217     if (RT_UNLIKELY(pDevSol->File == NIL_RTFILE))
     214    if (RT_UNLIKELY(pDevSol->hFile == NIL_RTFILE))
    218215    {
    219216        LogFlow((USBPROXY ":usbProxySolarisIOCtl connection to driver gone!\n"));
     
    228225
    229226    int Ret = -1;
    230     int rc = RTFileIoCtl(pDevSol->File, Function, &Req, sizeof(Req), &Ret);
     227    int rc = RTFileIoCtl(pDevSol->hFile, Function, &Req, sizeof(Req), &Ret);
    231228    if (RT_SUCCESS(rc))
    232229    {
     
    327324                         * Open the client driver.
    328325                         */
    329                         RTFILE File;
    330                         rc = RTFileOpen(&File, pDevSol->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     326                        RTFILE hFile;
     327                        rc = RTFileOpen(&hFile, pDevSol->pszDevicePath, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    331328                        if (RT_SUCCESS(rc))
    332329                        {
    333                             pDevSol->File = File;
     330                            pDevSol->hFile = hFile;
    334331                            pDevSol->pProxyDev = pProxyDev;
    335332
     
    363360                            }
    364361
    365                             RTFileClose(pDevSol->File);
    366                             pDevSol->File = NIL_RTFILE;
     362                            RTFileClose(pDevSol->hFile);
     363                            pDevSol->hFile = NIL_RTFILE;
    367364                            pDevSol->pProxyDev = NULL;
    368365                        }
     
    721718        {
    722719            struct pollfd pfd;
    723             int rc;
    724 
    725             pfd.fd = pDevSol->File;
     720            pfd.fd = RTFileToNative(pDevSol->hFile);
    726721            pfd.events = POLLIN;
    727722            pfd.revents = 0;
    728             rc = poll(&pfd, 1, cMillies);
    729 
     723            int rc = poll(&pfd, 1, cMillies);
    730724            if (rc > 0)
    731725            {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette