VirtualBox

Ignore:
Timestamp:
Aug 31, 2010 1:00:46 PM (14 years ago)
Author:
vboxsync
Message:

Main/linux/USB: moved a vector container-based implementation detail out of the interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/HostHardwareLinux.h

    r31652 r32142  
    110110
    111111
    112 /** Vector type for the list of interfaces. */
    113 #define VECTOR_TYPE       char *
    114 #define VECTOR_TYPENAME   USBInterfaceList
    115 static inline void USBInterfaceListCleanup(char **ppsz)
    116 {
    117     RTStrFree(*ppsz);
    118 }
    119 #define VECTOR_DESTRUCTOR USBInterfaceListCleanup
    120 #include "vector.h"
    121 
    122112/** Structure describing a host USB device */
    123113typedef struct USBDeviceInfo
     
    128118     * method. */
    129119    char *mSysfsPath;
    130     /** Type for the list of interfaces. */
    131     USBInterfaceList mInterfaces;
     120    /** List of interfaces.  Only one simulaneous traversal is possible. */
     121    struct USBInterfaceList *mInterfaces;
    132122} USBDeviceInfo;
    133123
    134 
    135124/** Destructor. */
    136 static inline void USBDevInfoCleanup(USBDeviceInfo *pSelf)
    137 {
    138     RTStrFree(pSelf->mDevice);
    139     RTStrFree(pSelf->mSysfsPath);
    140     pSelf->mDevice = pSelf->mSysfsPath = NULL;
    141     USBInterfaceList_cleanup(&pSelf->mInterfaces);
    142 }
    143 
     125void USBDevInfoCleanup(USBDeviceInfo *pSelf);
    144126
    145127/** Constructor - the strings will be duplicated. */
    146 static inline int USBDevInfoInit(USBDeviceInfo *pSelf, const char *aDevice,
    147                                  const char *aSystemID)
    148 {
    149     pSelf->mDevice = aDevice ? RTStrDup(aDevice) : NULL;
    150     pSelf->mSysfsPath = aSystemID ? RTStrDup(aSystemID) : NULL;
    151     if (   !USBInterfaceList_init(&pSelf->mInterfaces)
    152         || (aDevice && !pSelf->mDevice) || (aSystemID && ! pSelf->mSysfsPath))
    153     {
    154         USBDevInfoCleanup(pSelf);
    155         return 0;
    156     }
    157     return 1;
    158 }
     128int USBDevInfoInit(USBDeviceInfo *pSelf, const char *aDevice,
     129                   const char *aSystemID);
     130
     131/**
     132 * Return the first in a list of USB device interfaces (that is, its sysfs
     133 * path), or NULL if there are none.
     134 */
     135char *USBDevInfoFirstInterface(struct USBInterfaceList *pInterfaces);
     136
     137/**
     138 * Return the next in a list of USB device interfaces (that is, its sysfs
     139 * path), or NULL if there are none.
     140 */
     141char *USBDevInfoNextInterface(struct USBInterfaceList *pInterfaces);
    159142
    160143
     
    195178 */
    196179int USBDevInfoUpdateDevices(VBoxMainUSBDeviceInfo *pSelf);
    197 
    198180
    199181/** Get the first element in the list of USB devices. */
Note: See TracChangeset for help on using the changeset viewer.

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