qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features
Date: Thu, 7 Feb 2013 14:59:37 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote:
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index f1c2884..8f521b3 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -73,8 +73,31 @@ typedef struct VirtIONet
>      int multiqueue;
>      uint16_t max_queues;
>      uint16_t curr_queues;
> +    int config_size;

size_t

>  } VirtIONet;
>  
> +/*
> + * Calculate the number of bytes up to and including the given 'field' of
> + * 'container'.
> + */
> +#define endof(container, field) \
> +    ((intptr_t)(&(((container *)0)->field)+1))

This isn't really necessary, just use offsetof() with the next field or
sizeof() for the last field.  Better to avoid this kind of hackery.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]