Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
usbip_common.h File Reference
#include <sysfs/libsysfs.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  usbip_usb_interface
 
struct  usbip_usb_device
 

Macros

#define USBIDS_FILE   "/usr/share/hwdata/usb.ids"
 
#define VHCI_STATE_PATH   "/var/run/vhci_hcd"
 
#define USBIP_CORE_MOD_NAME   "usbip-core"
 
#define USBIP_HOST_DRV_NAME   "usbip-host"
 
#define USBIP_VHCI_DRV_NAME   "vhci_hcd"
 
#define PROGNAME   "usbip"
 
#define pr_fmt(fmt)   "%s: %s: " fmt "\n", PROGNAME
 
#define dbg_fmt(fmt)
 
#define err(fmt, args...)
 
#define info(fmt, args...)
 
#define dbg(fmt, args...)
 
#define BUG()
 
#define to_string(s)   #s
 

Enumerations

enum  usb_device_speed {
  USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH,
  USB_SPEED_VARIABLE, USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW, USB_SPEED_FULL,
  USB_SPEED_HIGH, USB_SPEED_WIRELESS, USB_SPEED_SUPER, USB_SPEED_UNKNOWN = 0,
  USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH
}
 
enum  usbip_device_status {
  SDEV_ST_AVAILABLE = 0x01, SDEV_ST_USED, SDEV_ST_ERROR, VDEV_ST_NULL,
  VDEV_ST_NOTASSIGNED, VDEV_ST_USED, VDEV_ST_ERROR
}
 

Functions

struct usbip_usb_interface __attribute__ ((packed))
 
void dump_usb_interface (struct usbip_usb_interface *)
 
void dump_usb_device (struct usbip_usb_device *)
 
int read_usb_device (struct sysfs_device *sdev, struct usbip_usb_device *udev)
 
int read_attr_value (struct sysfs_device *dev, const char *name, const char *format)
 
int read_usb_interface (struct usbip_usb_device *udev, int i, struct usbip_usb_interface *uinf)
 
const charusbip_speed_string (int num)
 
const charusbip_status_string (int32_t status)
 
int usbip_names_init (char *)
 
void usbip_names_free (void)
 
void usbip_names_get_product (char *buff, size_t size, uint16_t vendor, uint16_t product)
 
void usbip_names_get_class (char *buff, size_t size, uint8_t class, uint8_t subclass, uint8_t protocol)
 

Variables

int usbip_use_syslog
 
int usbip_use_stderr
 
int usbip_use_debug
 
uint8_t bInterfaceClass
 
uint8_t bInterfaceSubClass
 
uint8_t bInterfaceProtocol
 
uint8_t padding
 
char path [SYSFS_PATH_MAX]
 
char busid [SYSFS_BUS_ID_SIZE]
 
uint32_t busnum
 
uint32_t devnum
 
uint32_t speed
 
uint16_t idVendor
 
uint16_t idProduct
 
uint16_t bcdDevice
 
uint8_t bDeviceClass
 
uint8_t bDeviceSubClass
 
uint8_t bDeviceProtocol
 
uint8_t bConfigurationValue
 
uint8_t bNumConfigurations
 
uint8_t bNumInterfaces
 

Macro Definition Documentation

#define BUG ( )
Value:
do { \
err("sorry, it's a bug!"); \
abort(); \
} while (0)

Definition at line 73 of file usbip_common.h.

#define dbg (   fmt,
  args... 
)
Value:
do { \
if (usbip_use_debug) { \
syslog(LOG_DEBUG, dbg_fmt(fmt), ##args); \
} \
fprintf(stderr, dbg_fmt(fmt), ##args); \
} \
} \
} while (0)

Definition at line 61 of file usbip_common.h.

#define dbg_fmt (   fmt)
Value:
pr_fmt("%s:%d:[%s] " fmt), "debug", \
__FILE__, __LINE__, __FUNCTION__

Definition at line 38 of file usbip_common.h.

#define err (   fmt,
  args... 
)
Value:
do { \
syslog(LOG_ERR, pr_fmt(fmt), "error", ##args); \
} \
fprintf(stderr, pr_fmt(fmt), "error", ##args); \
} \
} while (0)

Definition at line 41 of file usbip_common.h.

#define info (   fmt,
  args... 
)
Value:
do { \
syslog(LOG_INFO, pr_fmt(fmt), "info", ##args); \
} \
fprintf(stderr, pr_fmt(fmt), "info", ##args); \
} \
} while (0)

Definition at line 51 of file usbip_common.h.

#define pr_fmt (   fmt)    "%s: %s: " fmt "\n", PROGNAME

Definition at line 37 of file usbip_common.h.

#define PROGNAME   "usbip"

Definition at line 35 of file usbip_common.h.

#define to_string (   s)    #s

Definition at line 130 of file usbip_common.h.

#define USBIDS_FILE   "/usr/share/hwdata/usb.ids"

Definition at line 19 of file usbip_common.h.

#define USBIP_CORE_MOD_NAME   "usbip-core"

Definition at line 27 of file usbip_common.h.

#define USBIP_HOST_DRV_NAME   "usbip-host"

Definition at line 28 of file usbip_common.h.

#define USBIP_VHCI_DRV_NAME   "vhci_hcd"

Definition at line 29 of file usbip_common.h.

#define VHCI_STATE_PATH   "/var/run/vhci_hcd"

Definition at line 23 of file usbip_common.h.

Enumeration Type Documentation

Enumerator:
USB_SPEED_UNKNOWN 
USB_SPEED_LOW 
USB_SPEED_FULL 
USB_SPEED_HIGH 
USB_SPEED_VARIABLE 
USB_SPEED_UNKNOWN 
USB_SPEED_LOW 
USB_SPEED_FULL 
USB_SPEED_HIGH 
USB_SPEED_WIRELESS 
USB_SPEED_SUPER 
USB_SPEED_UNKNOWN 
USB_SPEED_LOW 
USB_SPEED_FULL 
USB_SPEED_HIGH 

Definition at line 79 of file usbip_common.h.

Enumerator:
SDEV_ST_AVAILABLE 
SDEV_ST_USED 
SDEV_ST_ERROR 
VDEV_ST_NULL 
VDEV_ST_NOTASSIGNED 
VDEV_ST_USED 
VDEV_ST_ERROR 

Definition at line 87 of file usbip_common.h.

Function Documentation

mcontroller : adapter info structure for old mimd_t apps

: base address : irq number : number of logical drives : pci bus : pci device : pci function : pci id : vendor id : slot number : unique id

Definition at line 171 of file esd_usb2.c.

void dump_usb_device ( struct usbip_usb_device )

Definition at line 80 of file usbip_common.c.

void dump_usb_interface ( struct usbip_usb_interface )

Definition at line 70 of file usbip_common.c.

int read_attr_value ( struct sysfs_device *  dev,
const char name,
const char format 
)

Definition at line 112 of file usbip_common.c.

int read_usb_device ( struct sysfs_device *  sdev,
struct usbip_usb_device udev 
)

Definition at line 187 of file usbip_common.c.

int read_usb_interface ( struct usbip_usb_device udev,
int  i,
struct usbip_usb_interface uinf 
)

Definition at line 215 of file usbip_common.c.

void usbip_names_free ( void  )

Definition at line 243 of file usbip_common.c.

void usbip_names_get_class ( char buff,
size_t  size,
uint8_t  class,
uint8_t  subclass,
uint8_t  protocol 
)

Definition at line 264 of file usbip_common.c.

void usbip_names_get_product ( char buff,
size_t  size,
uint16_t  vendor,
uint16_t  product 
)

Definition at line 248 of file usbip_common.c.

int usbip_names_init ( char )

Definition at line 238 of file usbip_common.c.

const char* usbip_speed_string ( int  num)

Definition at line 54 of file usbip_common.c.

const char* usbip_status_string ( int32_t  status)

Definition at line 45 of file usbip_common.c.

Variable Documentation

uint16_t bcdDevice

Definition at line 138 of file usbip_common.h.

uint8_t bConfigurationValue

Definition at line 143 of file usbip_common.h.

__u8 bDeviceClass

Definition at line 140 of file usbip_common.h.

__u8 bDeviceProtocol

Definition at line 142 of file usbip_common.h.

__u8 bDeviceSubClass

Definition at line 141 of file usbip_common.h.

uint8_t bInterfaceClass

Definition at line 109 of file usbip_common.h.

uint8_t bInterfaceProtocol

Definition at line 111 of file usbip_common.h.

uint8_t bInterfaceSubClass

Definition at line 110 of file usbip_common.h.

__u8 bNumConfigurations

Definition at line 144 of file usbip_common.h.

uint8_t bNumInterfaces

Definition at line 145 of file usbip_common.h.

char busid[SYSFS_BUS_ID_SIZE]

Definition at line 130 of file usbip_common.h.

uint32_t busnum

Definition at line 132 of file usbip_common.h.

uint32_t devnum

Definition at line 133 of file usbip_common.h.

uint16_t idProduct

Definition at line 137 of file usbip_common.h.

uint16_t idVendor

Definition at line 136 of file usbip_common.h.

uint8_t padding

Definition at line 112 of file usbip_common.h.

Definition at line 129 of file usbip_common.h.

uint32_t speed

Definition at line 134 of file usbip_common.h.

int usbip_use_debug

Definition at line 13 of file usbip_common.c.

int usbip_use_stderr

Definition at line 12 of file usbip_common.c.

int usbip_use_syslog

Definition at line 11 of file usbip_common.c.