[Spice-devel] [PATCH usbredir 2/8] Adjust include file structure to enable kernel compilation.
Jeremy White
jwhite at codeweavers.com
Wed Dec 9 14:15:00 PST 2015
Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
usbredirparser/strtok_r.c | 4 ++++
usbredirparser/usbredirfilter.c | 5 +++++
usbredirparser/usbredirfilter.h | 2 ++
usbredirparser/usbredirparser.c | 8 ++++++++
usbredirparser/usbredirproto-compat.h | 2 ++
usbredirparser/usbredirproto.h | 2 ++
6 files changed, 23 insertions(+)
diff --git a/usbredirparser/strtok_r.c b/usbredirparser/strtok_r.c
index 227d1ea..2c761e1 100644
--- a/usbredirparser/strtok_r.c
+++ b/usbredirparser/strtok_r.c
@@ -21,7 +21,11 @@
# include <config.h>
#endif
+#if defined(__KERNEL__)
+#include <linux/string.h>
+#else
#include <string.h>
+#endif
/* Parse S into tokens separated by characters in DELIM.
If S is NULL, the saved pointer in SAVE_PTR is used as
diff --git a/usbredirparser/usbredirfilter.c b/usbredirparser/usbredirfilter.c
index 3fdc3e5..65d65e4 100644
--- a/usbredirparser/usbredirfilter.c
+++ b/usbredirparser/usbredirfilter.c
@@ -19,9 +19,14 @@
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+#if defined(__KERNEL__)
+#include <linux/string.h>
+#include <linux/slab.h>
+#else
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#endif
#ifdef WIN32
#include "strtok_r.h"
diff --git a/usbredirparser/usbredirfilter.h b/usbredirparser/usbredirfilter.h
index 3587a42..c869e98 100644
--- a/usbredirparser/usbredirfilter.h
+++ b/usbredirparser/usbredirfilter.h
@@ -21,8 +21,10 @@
#ifndef __USBREDIRFILTER_H
#define __USBREDIRFILTER_H
+#if ! defined(__KERNEL__)
#include <stdio.h>
#include <stdint.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c
index 133f054..366654c 100644
--- a/usbredirparser/usbredirparser.c
+++ b/usbredirparser/usbredirparser.c
@@ -18,12 +18,20 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
+#if defined(__KERNEL__)
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#else
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#endif
+
#include "usbredirproto-compat.h"
#include "usbredirparser.h"
#include "usbredirfilter.h"
diff --git a/usbredirparser/usbredirproto-compat.h b/usbredirparser/usbredirproto-compat.h
index 9155d45..55d2ccf 100644
--- a/usbredirparser/usbredirproto-compat.h
+++ b/usbredirparser/usbredirproto-compat.h
@@ -40,7 +40,9 @@
#endif
+#if ! defined(__KERNEL__)
#include <stdint.h>
+#endif
struct usb_redir_device_connect_header_no_device_version {
uint8_t speed;
diff --git a/usbredirparser/usbredirproto.h b/usbredirparser/usbredirproto.h
index 598da2f..e19a88a 100644
--- a/usbredirparser/usbredirproto.h
+++ b/usbredirparser/usbredirproto.h
@@ -40,7 +40,9 @@
#endif
+#if ! defined(__KERNEL__)
#include <stdint.h>
+#endif
#ifdef __cplusplus
extern "C" {
--
2.1.4
More information about the Spice-devel
mailing list