[RFC PATCH spice-common] marshaller: Provide spice_marshaller_fill_iovec for Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



An array of WSABUF can be used with WSASend.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/marshaller.c | 10 ++++++++--
 common/marshaller.h |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

This will allow to port spice-server to Windows, spice_marshaller_fill_iovec
is used only by spice-server (which currently does not support Windows).

diff --git a/common/marshaller.c b/common/marshaller.c
index 0b45523..4379aa6 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -549,7 +549,14 @@ void spice_marshaller_flush(SpiceMarshaller *m)
     }
 }
 
-#ifndef WIN32
+#ifdef WIN32
+// this definition is ABI compatible with WSABUF
+struct iovec {
+    unsigned long iov_len;
+    void *iov_base;
+};
+#endif
+
 int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
                                 int n_vec, size_t skip_bytes)
 {
@@ -581,7 +588,6 @@ int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
 
     return v;
 }
-#endif
 
 void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v)
 {
diff --git a/common/marshaller.h b/common/marshaller.h
index 2aeeea1..041d16e 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -25,6 +25,8 @@
 #include "mem.h"
 #ifndef WIN32
 #include <sys/uio.h>
+#else
+struct iovec;
 #endif
 
 SPICE_BEGIN_DECLS
@@ -52,10 +54,8 @@ size_t spice_marshaller_get_size(SpiceMarshaller *m);
 size_t spice_marshaller_get_total_size(SpiceMarshaller *m);
 SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m);
 SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit);
-#ifndef WIN32
 int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
                                 int n_vec, size_t skip_bytes);
-#endif
 void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v);
 void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v);
 void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v);
-- 
2.17.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]