[Spice-devel] [PATCH] vdservice: replace VDAgentDataChunk with VDIChunkHeader

Hans de Goede hdegoede at redhat.com
Wed Sep 22 00:26:05 PDT 2010


Big ack! (I had put this on my own todo list when I saw it :)

On 09/21/2010 07:16 PM, Arnon Gilboa wrote:
> ---
>   vdservice/vdi_port.cpp  |    2 +-
>   vdservice/vdservice.cpp |   12 +++---------
>   2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/vdservice/vdi_port.cpp b/vdservice/vdi_port.cpp
> index 0d5c0e1..8af95b2 100644
> --- a/vdservice/vdi_port.cpp
> +++ b/vdservice/vdi_port.cpp
> @@ -91,7 +91,7 @@ PTCHAR get_device_path(IN LPGUID interface_guid)
>       len = req_len;
>       if (!SetupDiGetDeviceInterfaceDetail(dev_info,&dev_interface, dev_interface_detail, len,
>                                            &req_len, NULL)) {
> -        vd_printf("Cannot get device interface details.\n");
> +        vd_printf("Cannot get device interface details");
>           SetupDiDestroyDeviceInfoList(dev_info);
>           LocalFree(dev_interface_detail);
>           return NULL;
> diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
> index 8cd485e..1e63694 100644
> --- a/vdservice/vdservice.cpp
> +++ b/vdservice/vdservice.cpp
> @@ -411,12 +411,6 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
>   #endif //DEBUG_VDSERVICE
>   }
>
> -typedef __declspec (align(1)) struct VDAgentDataChunk {
> -    uint32_t port;
> -    uint32_t size;
> -    uint8_t data[0];
> -} VDAgentDataChunk;
> -
>   bool VDService::execute()
>   {
>       SECURITY_ATTRIBUTES sec_attr;
> @@ -1006,12 +1000,12 @@ void VDService::handle_pipe_data(DWORD bytes)
>           if (read_size<  sizeof(VDPipeMessage) + pipe_msg->size) {
>               break;
>           }
> -        if (_vdi_port->write_ring_free_space()<  sizeof(VDAgentDataChunk) + pipe_msg->size) {
> +        if (_vdi_port->write_ring_free_space()<  sizeof(VDIChunkHeader) + pipe_msg->size) {
>               //vd_printf("DEBUG: no space in write ring %u", _vdi_port->write_ring_free_space());
>               break;
>           }
>           if (!_pending_reset) {
> -            VDAgentDataChunk chunk;
> +            VDIChunkHeader chunk;
>               chunk.port = pipe_msg->opaque;
>               chunk.size = pipe_msg->size;
>               if (_vdi_port->ring_write(&chunk, sizeof(chunk)) != sizeof(chunk) ||
> @@ -1035,7 +1029,7 @@ void VDService::handle_pipe_data(DWORD bytes)
>   void VDService::handle_port_data()
>   {
>       VDPipeMessage* pipe_msg;
> -    VDAgentDataChunk chunk;
> +    VDIChunkHeader chunk;
>       int chunks_count = 0;
>       DWORD count = 0;
>


More information about the Spice-devel mailing list