summaryrefslogtreecommitdiffstats
path: root/drivers/staging/usbip/userspace/libsrc/usbip_common.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 23:26:34 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 23:26:34 -0700
commit138051659902da7e6a09d379fee5dade2a80fcfd (patch)
treee0a90e27451b1fcd812675092d30c1059369cb87 /drivers/staging/usbip/userspace/libsrc/usbip_common.h
parentd5ef642355bdd9b383ff5c18cbc6102a06eecbaf (diff)
parente1703b329f7c7ea82ea181dc4c50020f25061a2c (diff)
downloadop-kernel-dev-138051659902da7e6a09d379fee5dade2a80fcfd.zip
op-kernel-dev-138051659902da7e6a09d379fee5dade2a80fcfd.tar.gz
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (741 commits) staging:iio:meter:ade7753 should be 16 bit read not 8 bit for mode register. staging:iio:kfifo_buf fix double initialization of the ring device structure. staging:iio:accel:lis3l02dq: fix incorrect pointer passed to spi_set_drvdata. staging:iio:imu fix missing register table index for some channels spectra: enable device before poking it staging: rts_pstor: Fix a miswriting staging/lirc_bt829: Return -ENODEV when no hardware is found. staging/lirc_parallel: remove pointless prototypes. staging/lirc_parallel: fix panic on rmmod staging:iio:adc:ad7476: Incorrect pointer into spi_set_drvdata. Staging: zram: Fix kunmapping order Revert "gma500: Fix dependencies" gma500: Add medfield header gma500: wire up the mrst i2c bus from chip_info gma500: Fix DPU build gma500: Clean up the DPU config and make it runtime gma500: resync with Medfield progress gma500: Use the mrst helpers and power control for mode commit gma500@ Fix backlight range error gma500: More Moorestown muddle meddling means MM maybe might modeset ... Fix up fairly trivial conflicts all over, mostly due to header file cleanup conflicts, but some deleted files and some just context changes: - Documentation/feature-removal-schedule.txt - drivers/staging/bcm/headers.h - drivers/staging/brcm80211/brcmfmac/dhd_linux.c - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c - drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h - drivers/staging/brcm80211/brcmfmac/wl_iw.c - drivers/staging/et131x/et131x_netdev.c - drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c - drivers/staging/rtl8192e/r8192E.h - drivers/staging/usbip/userspace/src/utils.h
Diffstat (limited to 'drivers/staging/usbip/userspace/libsrc/usbip_common.h')
-rw-r--r--drivers/staging/usbip/userspace/libsrc/usbip_common.h138
1 files changed, 68 insertions, 70 deletions
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.h b/drivers/staging/usbip/userspace/libsrc/usbip_common.h
index c254b54..eedefbd 100644
--- a/drivers/staging/usbip/userspace/libsrc/usbip_common.h
+++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.h
@@ -2,21 +2,18 @@
* Copyright (C) 2005-2007 Takahiro Hirofuchi
*/
-#ifndef _USBIP_COMMON_H
-#define _USBIP_COMMON_H
+#ifndef __USBIP_COMMON_H
+#define __USBIP_COMMON_H
+
+#include <sysfs/libsysfs.h>
-#include <unistd.h>
#include <stdint.h>
-#include <syslog.h>
-#include <errno.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
-#include <sysfs/libsysfs.h>
-#include <netdb.h>
-#include <sys/socket.h>
+#include <syslog.h>
+#include <unistd.h>
#ifndef USBIDS_FILE
#define USBIDS_FILE "/usr/share/hwdata/usb.ids"
@@ -26,7 +23,59 @@
#define VHCI_STATE_PATH "/var/run/vhci_hcd"
#endif
-//#include <linux/usb_ch9.h>
+/* kernel module names */
+#define USBIP_CORE_MOD_NAME "usbip-core"
+#define USBIP_HOST_DRV_NAME "usbip-host"
+#define USBIP_VHCI_DRV_NAME "vhci_hcd"
+
+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__, __FUNCTION__
+
+#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)
+
enum usb_device_speed {
USB_SPEED_UNKNOWN = 0, /* enumerating */
USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
@@ -51,66 +100,14 @@ enum usbip_device_status{
VDEV_ST_ERROR
};
-extern int usbip_use_syslog;
-extern int usbip_use_stderr;
-extern int usbip_use_debug ;
-
-#define err(fmt, args...) do { \
- if (usbip_use_syslog) { \
- syslog(LOG_ERR, "usbip err: %13s:%4d (%-12s) " fmt "\n", \
- __FILE__, __LINE__, __FUNCTION__, ##args); \
- } \
- if (usbip_use_stderr) { \
- fprintf(stderr, "usbip err: %13s:%4d (%-12s) " fmt "\n", \
- __FILE__, __LINE__, __FUNCTION__, ##args); \
- } \
-} while (0)
-
-#define notice(fmt, args...) do { \
- if (usbip_use_syslog) { \
- syslog(LOG_DEBUG, "usbip: " fmt, ##args); \
- } \
- if (usbip_use_stderr) { \
- fprintf(stderr, "usbip: " fmt "\n", ##args); \
- } \
-} while (0)
-
-#define info(fmt, args...) do { \
- if (usbip_use_syslog) { \
- syslog(LOG_DEBUG, fmt, ##args); \
- } \
- if (usbip_use_stderr) { \
- fprintf(stderr, fmt "\n", ##args); \
- } \
-} while (0)
-
-#define dbg(fmt, args...) do { \
- if (usbip_use_debug) { \
- if (usbip_use_syslog) { \
- syslog(LOG_DEBUG, "usbip dbg: %13s:%4d (%-12s) " fmt, \
- __FILE__, __LINE__, __FUNCTION__, ##args); \
- } \
- if (usbip_use_stderr) { \
- fprintf(stderr, "usbip dbg: %13s:%4d (%-12s) " fmt "\n", \
- __FILE__, __LINE__, __FUNCTION__, ##args); \
- } \
- } \
-} while (0)
-
-
-#define BUG() do { err("sorry, it's a bug"); abort(); } while (0)
-
-
-struct usb_interface {
+struct usbip_usb_interface {
uint8_t bInterfaceClass;
uint8_t bInterfaceSubClass;
uint8_t bInterfaceProtocol;
uint8_t padding; /* alignment */
} __attribute__((packed));
-
-
-struct usb_device {
+struct usbip_usb_device {
char path[SYSFS_PATH_MAX];
char busid[SYSFS_BUS_ID_SIZE];
@@ -132,11 +129,12 @@ struct usb_device {
#define to_string(s) #s
-void dump_usb_interface(struct usb_interface *);
-void dump_usb_device(struct usb_device *);
-int read_usb_device(struct sysfs_device *sdev, struct usb_device *udev);
+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 usb_device *udev, int i, struct usb_interface *uinf);
+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);
@@ -146,4 +144,4 @@ 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
+#endif /* __USBIP_COMMON_H */
OpenPOWER on IntegriCloud