/* * Copyright (C) 2005-2007 Takahiro Hirofuchi */ #ifndef __USBIP_COMMON_H #define __USBIP_COMMON_H #include #include #include #include #include #include #include #include #include #ifndef USBIDS_FILE #define USBIDS_FILE "/usr/share/hwdata/usb.ids" #endif #ifndef VHCI_STATE_PATH #define VHCI_STATE_PATH "/var/run/vhci_hcd" #endif #define VUDC_DEVICE_DESCR_FILE "dev_desc" /* kernel module names */ #define USBIP_CORE_MOD_NAME "usbip-core" #define USBIP_HOST_DRV_NAME "usbip-host" #define USBIP_DEVICE_DRV_NAME "usbip-vudc" #define USBIP_VHCI_DRV_NAME "vhci_hcd" /* sysfs constants */ #define SYSFS_MNT_PATH "/sys" #define SYSFS_BUS_NAME "bus" #define SYSFS_BUS_TYPE "usb" #define SYSFS_DRIVERS_NAME "drivers" #define SYSFS_PATH_MAX 256 #define SYSFS_BUS_ID_SIZE 32 extern int usbip_use_syslog; extern int usbip_use_stderr; extern int usbip_use_debug ; #define PROGNAME "usbip" #define pr_fmt(fmt) "%s: %s: " fmt "\n", PROGNAME #define dbg_fmt(fmt) pr_fmt("%s:%d:[%s] " fmt), "debug", \ __FILE__, __LINE__, __func__ #define err(fmt, args...) \ do { \ if (usbip_use_syslog) { \ syslog(LOG_ERR, pr_fmt(fmt), "error", ##args); \ } \ if (usbip_use_stderr) { \ fprintf(stderr, pr_fmt(fmt), "error", ##args); \ } \ } while (0) #define info(fmt, args...) \ do { \ if (usbip_use_syslog) { \ syslog(LOG_INFO, pr_fmt(fmt), "info", ##args); \ } \ if (usbip_use_stderr) { \ fprintf(stderr, pr_fmt(fmt), "info", ##args); \ } \ } while (0) #define dbg(fmt, args...) \ do { \ if (usbip_use_debug) { \ if (usbip_use_syslog) { \ syslog(LOG_DEBUG, dbg_fmt(fmt), ##args); \ } \ if (usbip_use_stderr) { \ fprintf(stderr, dbg_fmt(fmt), ##args); \ } \ } \ } while (0) #define BUG() \ do { \ err("sorry, it's a bug!"); \ abort(); \ } while (0) struct usbip_usb_interface { uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; uint8_t padding; /* alignment */ } __attribute__((packed)); struct usbip_usb_device { 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; } __attribute__((packed)); #define to_string(s) #s void dump_usb_interface(struct usbip_usb_interface *); void dump_usb_device(struct usbip_usb_device *); int read_usb_device(struct udev_device *sdev, struct usbip_usb_device *udev); int read_attr_value(struct udev_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 char *usbip_speed_string(int num); const char *usbip_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); #endif /* __USBIP_COMMON_H */ space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-12 21:58:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-12 21:58:13 -0800
commite7aa8c2eb11ba69b1b69099c3c7bd6be3087b0ba (patch)
treef63906f41699c8e38af9d12b063e2ceab0286ef2 /Documentation/fault-injection
parente34bac726d27056081d0250c0e173e4b155aa340 (diff)
parent868c97a846a73e937d835b09b8c885a69df50ec8 (diff)
Merge tag 'docs-4.10' of git://git.lwn.net/linuxHEADmaster
Pull documentation update from Jonathan Corbet: "These are the documentation changes for 4.10. It's another busy cycle for the docs tree, as the sphinx conversion continues. Highlights include: - Further work on PDF output, which remains a bit of a pain but should be more solid now. - Five more DocBook template files converted to Sphinx. Only 27 to go... Lots of plain-text files have also been converted and integrated. - Images in binary formats have been replaced with more source-friendly versions. - Various bits of organizational work, including the renaming of various files discussed at the kernel summit. - New documentation for the device_link mechanism. ... and, of course, lots of typo fixes and small updates" * tag 'docs-4.10' of git://git.lwn.net/linux: (193 commits) dma-buf: Extract dma-buf.rst Update Documentation/00-INDEX docs: 00-INDEX: document directories/files with no docs docs: 00-INDEX: remove non-existing entries docs: 00-INDEX: add missing entries for documentation files/dirs docs: 00-INDEX: consolidate process/ and admin-guide/ description scripts: add a script to check if Documentation/00-INDEX is sane Docs: change sh -> awk in REPORTING-BUGS Documentation/core-api/device_link: Add initial documentation core-api: remove an unexpected unident ppc/idle: Add documentation for powersave=off Doc: Correct typo, "Introdution" => "Introduction" Documentation/atomic_ops.txt: convert to ReST markup Documentation/local_ops.txt: convert to ReST markup Documentation/assoc_array.txt: convert to ReST markup docs-rst: parse-headers.pl: cleanup the documentation docs-rst: fix media cleandocs target docs-rst: media/Makefile: reorganize the rules docs-rst: media: build SVG from graphviz files docs-rst: replace bayer.png by a SVG image ...
Diffstat (limited to 'Documentation/fault-injection')