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

Christophe Fergeau cfergeau at redhat.com
Tue Jan 8 13:00:02 UTC 2019


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Mon, Dec 17, 2018 at 10:26:57AM +0000, Frediano Ziglio wrote:
> An array of WSABUF can be used with WSASend.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190108/6a326dac/attachment.sig>


More information about the Spice-devel mailing list