VirtualBox

Changeset 31911 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Aug 24, 2010 11:56:45 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65121
Message:

make the VBOX_WITH_NEW_USB_CODE_ON_SOLARIS code mandatory

Location:
trunk/src/VBox/HostDrivers/VBoxUSB
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/Makefile.kmk

    r31898 r31911  
    3434USBLib_SDKS.win       = WINPSDK W2K3DDK
    3535USBLib_DEFS           = IN_USBLIB
    36 USBLib_DEFS.solaris  = $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS)
    3736USBLib_DEFS.os2       = STATIC_USBCALLS
    3837USBLib_SOURCES        = \
  • trunk/src/VBox/HostDrivers/VBoxUSB/solaris/Makefile.kmk

    r31898 r31911  
    3232SYSMODS.solaris         += vboxusbmon
    3333vboxusbmon_TEMPLATE      = VBOXR0DRV
    34 vboxusbmon_DEFS          = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) \
    35         $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS,)
     34vboxusbmon_DEFS          = IN_RT_R0 VBOX_SVN_REV=$(VBOX_SVN_REV)
    3635vboxusbmon_DEPS         += $(VBOX_SVN_REV_KMK)
    37 vboxusbmon_INCS         := . .. \
    38         $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),include/,)
     36vboxusbmon_INCS         := . .. include
    3937vboxusbmon_LDFLAGS      += -N drv/vboxdrv -N misc/usba
    4038vboxusbmon_SOURCES       = \
     
    4341        ../VBoxUSBFilterMgr.cpp
    4442
    45 ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    4643#
    4744# vboxusb - The Solaris Generic USB Client Kernel module.
     
    4946SYSMODS.solaris         += vboxusb
    5047vboxusb_TEMPLATE         = VBOXR0DRV
    51 vboxusb_DEFS             = IN_RT_R0 IN_SUP_R0 VBOX_SVN_REV=$(VBOX_SVN_REV) \
    52         $(if $(VBOX_WITH_NEW_USB_CODE_ON_SOLARIS),VBOX_WITH_NEW_USB_CODE_ON_SOLARIS,)
     48vboxusb_DEFS             = IN_RT_R0 IN_SUP_R0 VBOX_SVN_REV=$(VBOX_SVN_REV)
    5349vboxusb_DEPS            += $(VBOX_SVN_REV_KMK)
    5450vboxusb_INCS            := . include/
     
    5652vboxusb_SOURCES          = \
    5753        VBoxUSB-solaris.c
    58 endif
    5954
    6055include $(KBUILD_PATH)/subfooter.kmk
  • trunk/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c

    r31898 r31911  
    3333#include <iprt/mem.h>
    3434#include <iprt/semaphore.h>
    35 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    36 # include <iprt/path.h>
    37 #endif
     35#include <iprt/path.h>
    3836
    3937#define USBDRV_MAJOR_VER    2
     
    144142};
    145143
    146 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    147144/**
    148145 * Client driver info.
     
    154151    struct vboxusbmon_client_t *pNext;                      /* Pointer to next client */
    155152} vboxusbmon_client_t;
    156 #endif
    157153
    158154/**
     
    172168/** Global Mutex. */
    173169static kmutex_t g_VBoxUSBMonSolarisMtx;
    174 
    175 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    176170/** Number of userland clients that have kept us open. */
    177171static uint64_t g_cVBoxUSBMonSolarisClient = 0;
    178172/** Global list of client drivers registered with us. */
    179173vboxusbmon_client_t *g_pVBoxUSBMonSolarisClients = 0;
    180 #endif
    181 
    182174/** Opaque pointer to list of soft states. */
    183175static void *g_pVBoxUSBMonSolarisState;
     
    188180static int vboxUSBMonSolarisProcessIOCtl(int iFunction, void *pvState, void *pvData, size_t cbData, size_t *pcbReturnedData);
    189181static int vboxUSBMonSolarisResetDevice(char *pszDevicePath, bool fReattach);
    190 #ifndef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    191 static int vboxUSBMonSolarisGetDeviceInstance(char *pszDevicePath, int32_t *pInstance);
    192 #endif
    193182
    194183
     
    196185*   Monitor Global Hooks                                                       *
    197186*******************************************************************************/
    198 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    199187static int vboxUSBMonSolarisClientInfo(vboxusbmon_state_t *pState, PVBOXUSB_CLIENT_INFO pClientInfo);
    200188int VBoxUSBMonSolarisRegisterClient(dev_info_t *pClientDip, PVBOXUSB_CLIENT_INFO pClientInfo);
     
    202190int VBoxUSBMonSolarisElectDriver(usb_dev_descr_t *pDevDesc, usb_dev_str_t *pDevStrings, char *pszDevicePath, int Bus, int Port,
    203191                                char **ppszDrv, void *pvReserved);
    204 #endif
    205192
    206193
     
    352339        case DDI_DETACH:
    353340        {
    354 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    355341            /*
    356342             * Free all registered clients' info.
     
    365351            }
    366352            mutex_exit(&g_VBoxUSBMonSolarisMtx);
    367 #endif
    368353
    369354            vboxusbmon_state_t *pState = ddi_get_driver_private(g_pDip);
     
    447432    }
    448433
    449 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    450434    mutex_enter(&g_VBoxUSBMonSolarisMtx);
    451435    if (!g_cVBoxUSBMonSolarisClient)
     
    463447    g_cVBoxUSBMonSolarisClient++;
    464448    mutex_exit(&g_VBoxUSBMonSolarisMtx);
    465 #endif
    466449
    467450    for (iOpenInstance = 0; iOpenInstance < 4096; iOpenInstance++)
     
    477460    {
    478461        LogRel((DEVICE_NAME ":VBoxUSBMonSolarisOpen: too many open instances."));
    479 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    480462        mutex_enter(&g_VBoxUSBMonSolarisMtx);
    481463        g_cVBoxUSBMonSolarisClient--;
    482464        mutex_exit(&g_VBoxUSBMonSolarisMtx);
    483 #endif
    484465        return ENXIO;
    485466    }
     
    508489    }
    509490
    510 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    511491    mutex_enter(&g_VBoxUSBMonSolarisMtx);
    512492    g_cVBoxUSBMonSolarisClient--;
     
    527507    else
    528508        mutex_exit(&g_VBoxUSBMonSolarisMtx);
    529 #endif
    530509
    531510    /*
     
    771750        }
    772751
    773 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    774752        case VBOXUSBMON_IOCTL_CLIENT_INFO:
    775753        {
     
    782760            break;
    783761        }
    784 #else
    785         case VBOXUSBMON_IOCTL_DEVICE_INSTANCE:
    786         {
    787             CHECKRET_MIN_SIZE("DEVICE_INSTANCE", sizeof(VBOXUSBREQ_DEVICE_INSTANCE));
    788 
    789             VBOXUSBREQ_DEVICE_INSTANCE *pReq = (VBOXUSBREQ_DEVICE_INSTANCE *)pvData;
    790             rc = vboxUSBMonSolarisGetDeviceInstance(pReq->szDevicePath, (int32_t *)pReq->pInstance);
    791             *pcbReturnedData = cbData;
    792             LogFlow((DEVICE_NAME ":vboxUSBMonSolarisProcessIOCtl: DEVICE_INSTANCE returned %d\n", rc));
    793             break;
    794         }
    795 #endif
    796762
    797763        case VBOXUSBMON_IOCTL_GET_VERSION:
     
    825791    LogFlowFunc((DEVICE_NAME ":vboxUSBMonSolarisResetDevice pszDevicePath=%s fReattach=%d\n", pszDevicePath, fReattach));
    826792
    827 #ifdef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    828793    /*
    829794     * Try grabbing the dev_info_t.
     
    878843    }
    879844
    880 #else
    881     /*
    882      * Try grabbing the dev_info_t.
    883      */
    884     dev_info_t *pDeviceInfo = e_ddi_hold_devi_by_path(pszDevicePath, 0);
    885     if (pDeviceInfo)
    886     {
    887         /*
    888          * Try re-enumerating the device.
    889          */
    890         rc = usb_reset_device(pDeviceInfo, fReattach ? USB_RESET_LVL_REATTACH : USB_RESET_LVL_DEFAULT);
    891         LogFlow((DEVICE_NAME ":usb_reset_device for %s level=%s returned %d\n", pszDevicePath, fReattach ? "ReAttach" : "Default", rc));
    892 
    893         ddi_release_devi(pDeviceInfo);
    894         switch (rc)
    895         {
    896             case USB_SUCCESS:         rc = VINF_SUCCESS;                break;
    897             case USB_INVALID_PERM:    rc = VERR_PERMISSION_DENIED;      break;
    898             case USB_INVALID_ARGS:    rc = VERR_INVALID_PARAMETER;      break;
    899 
    900             /* @todo find better codes for these (especially USB_BUSY) */
    901             case USB_BUSY:
    902             case USB_INVALID_CONTEXT:
    903             case USB_FAILURE:         rc = VERR_GENERAL_FAILURE;        break;
    904 
    905             default:                  rc = VERR_UNRESOLVED_ERROR;       break;
    906         }
    907     }
    908     else
    909     {
    910         rc = VERR_INVALID_HANDLE;
    911         LogRel(("vboxUSBMonSolarisResetDevice: Cannot obtain dev_info_t for Device %s\n", pszDevicePath));
    912     }
    913 #endif
    914 
    915845    return rc;
    916846}
    917 
    918 #ifndef VBOX_WITH_NEW_USB_CODE_ON_SOLARIS
    919 
    920 static int vboxUSBMonSolarisGetDeviceInstance(char *pszDevicePath, int32_t *pInstance)
    921 {
    922     LogFlowFunc((DEVICE_NAME ":vboxUSBMonSolarisGetDeviceInstance pszDevicePath=%s pInstance=%p\n", pszDevicePath, pInstance));
    923 
    924     AssertPtrReturn(pInstance, VERR_INVALID_POINTER);
    925 
    926     /*
    927      * Try grabbing the dev_info_t.
    928      */
    929     dev_info_t *pDeviceInfo = e_ddi_hold_devi_by_path(pszDevicePath, 0);
    930     if (pDeviceInfo)
    931     {
    932         /*
    933          * Get device instance.
    934          */
    935         *pInstance = ddi_get_instance(pDeviceInfo);
    936         ddi_release_devi(pDeviceInfo);
    937         LogFlow(("vboxUSBMonSolarisGetDeviceInstance: instance %d\n", *pInstance));
    938         return VINF_SUCCESS;
    939     }
    940     else
    941         LogRel(("vboxUSBMonSolarisGetDeviceInstance: Cannot obtain dev_info_t for Device %s\n", pszDevicePath));
    942     return VERR_INVALID_HANDLE;
    943 }
    944 
    945 #else /* VBOX_WITH_NEW_USB_CODE_ON_SOLARIS */
    946847
    947848static int vboxUSBMonSolarisClientInfo(vboxusbmon_state_t *pState, PVBOXUSB_CLIENT_INFO pClientInfo)
     
    11501051    return USB_SUCCESS;
    11511052}
    1152 
    1153 #endif
    1154 
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