staging/usbip: add new uapi header usbip.h
v2 cover staging/usbip: add new uapi header usbip.h
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. Adding an usbip uapi header file will define the kernel - userspace interface for this device status. This new uapi file is added under usbip/uapi to keep the staging tree code self-contained. When usbip moves to mainline drivers, this file should be moved under uapi/linux
usbip kernel and userspace are changed to use this new header file.
Shuah Khan (3):
staging/usbip: add uapi header to export usbip kernel interfaces staging/usbip: change usbip to include new uapi usbip.h staging/usbip: change usbip userspace to include new uapi usbip.h
drivers/staging/usbip/uapi/usbip.h | 26 ++++++++++++++++++++ drivers/staging/usbip/usbip_common.h | 19 ++------------ .../staging/usbip/userspace/libsrc/usbip_common.h | 18 +------------- 3 files changed, 29 insertions(+), 34 deletions(-) create mode 100644 drivers/staging/usbip/uapi/usbip.h
Signature · 1 line
1.7.10.4
PATCH v2 1/3 staging/usbip: add uapi header to export usbip kernel interfaces
usbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. Adding an usbip uapi header file will define the kernel - userspace interface for this device status. This new uapi file is added under usbip/uapi to keep the staging tree code self-contained. When usbip moves to mainline drivers, this file should be moved under uapi/linux
--- drivers/staging/usbip/uapi/usbip.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 drivers/staging/usbip/uapi/usbip.h
drivers/staging/usbip/uapi/usbip.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* usbip.h +* +* USBIP uapi defines and function prototypes etc. +*/ + +#ifndef _UAPI_LINUX_USBIP_H +#define _UAPI_LINUX_USBIP_H + +/* usbip device status - exported in usbip device sysfs status */ +enum usbip_device_status { +/* sdev is available. */ +SDEV_ST_AVAILABLE =0x01 , +/* sdev is now used. */ +SDEV_ST_USED , +/* sdev is unusable because of a fatal error. */ +SDEV_ST_ERROR , + +/* vdev does not connect a remote device. */ +VDEV_ST_NULL , +/* vdev is used, but the USB address is not assigned yet */ +VDEV_ST_NOTASSIGNED , +VDEV_ST_USED , +VDEV_ST_ERROR +}; +#endif /* _UAPI_LINUX_USBIP_H */
Signature · 1 line
1.7.10.4
PATCH v2 2/3 staging/usbip: change usbip to include new uapi usbip.h
In reply to Shuah Khanusbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. A new uapi usbip.h now defines the usbip device status for kernel and userspace to use. Change usbip kernel space to include uapi usbip.h for usbip device status.
--- drivers/staging/usbip/usbip_common.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/staging/usbip/usbip_common.h +2 -17
@@ -29,6 +29,7 @@#include <linux/types.h> #include <linux/usb.h> #include <linux/wait.h> +#include "uapi/usbip.h" #define USBIP_VERSION "1.0.0"
@@ -235,22 +236,6 @@ enum usbip_side { USBIP_STUB, }; -enum usbip_status { -/* sdev is available. */ -SDEV_ST_AVAILABLE =0x01 , -/* sdev is now used. */ -SDEV_ST_USED , -/* sdev is unusable because of a fatal error. */ -SDEV_ST_ERROR , - -/* vdev does not connect a remote device. */ -VDEV_ST_NULL , -/* vdev is used, but the USB address is not assigned yet */ -VDEV_ST_NOTASSIGNED , -VDEV_ST_USED , -VDEV_ST_ERROR -}; -/* event handler */ #define USBIP_EH_SHUTDOWN (1 << 0)#define USBIP_EH_BYE (1 << 1)
@@ -271,7 +256,7 @@ enum usbip_status {/* a common structure for stub_device and vhci_device */ struct usbip_device {enum usbip_side side; -enum usbip_status status; +enum usbip_device_status status;/* lock for status */ spinlock_t lock;
Signature · 1 line
1.7.10.4
PATCH v2 3/3 staging/usbip: change usbip userspace to include new uapi usbip.h
In reply to Shuah Khanusbip userspace has duplicated enum definition to report usbip device status maintained by the kernel. A new uapi usbip.h now defines the usbip device status for kernel and userspace to use. Change usbip userspace to include uapi usbip.h for usbip device status.
--- .../staging/usbip/userspace/libsrc/usbip_common.h | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/staging/usbip/userspace/libsrc/usbip_common.h +1 -17
@@ -15,6 +15,7 @@#include <syslog.h> #include <unistd.h> #include <linux/usb/ch9.h> +#include "../../uapi/usbip.h" #ifndef USBIDS_FILE #define USBIDS_FILE "/usr/share/hwdata/usb.ids"
@@ -77,23 +78,6 @@ extern int usbip_use_debug ;abort (); \ }while (0 ) -/* FIXME: how to sync with drivers/usbip_common.h ? */ -enum usbip_device_status { -/* sdev is available. */ -SDEV_ST_AVAILABLE =0x01 , -/* sdev is now used. */ -SDEV_ST_USED , -/* sdev is unusable because of a fatal error. */ -SDEV_ST_ERROR , - -/* vdev does not connect a remote device. */ -VDEV_ST_NULL , -/* vdev is used, but the USB address is not assigned yet */ -VDEV_ST_NOTASSIGNED , -VDEV_ST_USED , -VDEV_ST_ERROR -}; - struct usbip_usb_interface {uint8_t bInterfaceClass;uint8_t bInterfaceSubClass;
Signature · 1 line
1.7.10.4