qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 05/10] move out net queue structs define


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v9 05/10] move out net queue structs define
Date: Tue, 1 Sep 2015 15:43:08 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Sep 01, 2015 at 05:06:18PM +0800, Yang Hongyang wrote:
> This will be used by the next patch in this series.
> 
> Signed-off-by: Yang Hongyang <address@hidden>
> Reviewed-by: Thomas Huth <address@hidden>
> ---
>  include/net/queue.h | 19 +++++++++++++++++++
>  net/queue.c         | 19 -------------------
>  2 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/include/net/queue.h b/include/net/queue.h
> index fc02b33..1d65e47 100644
> --- a/include/net/queue.h
> +++ b/include/net/queue.h
> @@ -31,6 +31,25 @@ typedef struct NetQueue NetQueue;
>  
>  typedef void (NetPacketSent) (NetClientState *sender, ssize_t ret);
>  
> +struct NetPacket {
> +    QTAILQ_ENTRY(NetPacket) entry;
> +    NetClientState *sender;
> +    unsigned flags;
> +    int size;
> +    NetPacketSent *sent_cb;
> +    uint8_t data[0];
> +};
> +
> +struct NetQueue {
> +    void *opaque;
> +    uint32_t nq_maxlen;
> +    uint32_t nq_count;
> +
> +    QTAILQ_HEAD(packets, NetPacket) packets;
> +
> +    unsigned delivering:1;
> +};
> +

Why is it necessary to expose both structs?

Normally functions would be added to maintain the abstraction.  Instead,
you have chosen to access the fields directly - this is probably a bad
idea.



reply via email to

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