qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Avoid embedding struct mbuf in other structures


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] Avoid embedding struct mbuf in other structures
Date: Thu, 25 Feb 2016 15:22:25 +0000

On 22 February 2016 at 21:29, Samuel Thibault
<address@hidden> wrote:
> struct mbuf uses a C99 open char array to allow inlining data.

At the moment it doesn't, it uses a 1 byte array :-) Turning that
into a C99 flexible array is what we'd like to do...

> Inlining
> this in another structure is however a GNU extension. The inlines used
> so far in struct Slirp were actually only needed as head of struct
> mbuf lists. This replaces these inline with mere struct quehead,
> and use casts as appropriate.
>
> Signed-off-by: Samuel Thibault <address@hidden>
> ---
>  slirp/if.c    | 27 ++++++++++++++-------------
>  slirp/mbuf.c  | 19 ++++++++++---------
>  slirp/misc.c  |  5 -----
>  slirp/misc.h  |  5 +++++
>  slirp/slirp.h |  8 +++++---
>  5 files changed, 34 insertions(+), 30 deletions(-)

It's a slight shame that we end up having to have the extra casts,
but I guess it can't be helped. Converting the code to use one of
the qemu/queue.h data structures doesn't seem worth the effort
and risk of introducing bugs.

(Does this pass checkpatch.pl? I wasn't sure about the spacing
round some of the casts...)

Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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