qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "J. Kiszka" <jan.kiszka@siemens.com>,
	Jason Wang <jasowang@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PULL 00/13] vhost, virtio, pci, pxe
Date: Fri, 19 Feb 2016 13:41:47 +0100	[thread overview]
Message-ID: <20160219124147.GE3502@var.bordeaux.inria.fr> (raw)
In-Reply-To: <CAFEAcA_wOnQmgc+ujGBF+RUSp7-jH5UkbkrtHzcxCqPVtqn0fA@mail.gmail.com>

Hello,

Peter Maydell, on Fri 19 Feb 2016 12:09:17 +0000, wrote:
> We can do that, I think, by updating slirp to use C99 flexible
> arrays:

Indeed.

> diff --git a/slirp/mbuf.h b/slirp/mbuf.h
> index 38fedf4..ef5a4f7 100644
> --- a/slirp/mbuf.h
> +++ b/slirp/mbuf.h
> @@ -81,11 +81,9 @@ struct mbuf {
>         Slirp *slirp;
>         bool    resolution_requested;
>         uint64_t expiration_date;
> +       char    *m_ext;
>         /* start of dynamic buffer area, must be last element */
> -       union {
> -               char    m_dat[1]; /* ANSI don't like 0 sized arrays */
> -               char    *m_ext;
> -       };
> +       char    m_dat[];
>  };
> 
>  #define ifq_prev m_prev
> 
> [compile-tested, but need to audit the slirp code to check that
> it doesn't care that m_dat and m_ext no longer have the same
> offset within the struct...

I believe that's true. It needs to be cross-checked though.

> I'm assuming we don't care about
> the fact we've used an extra 4 bytes of struct.]

That's probably fine, yes.

> However that then needs us to add a new disable-warning flag
> -Wno-gnu-variable-sized-type-not-at-end, because slirp.h uses
> these 'struct mbuf's embedded inside another structure,

Uh. It does so for not so useful reasons, it actually really needs a list head
(i.e. a struct quehead), that could probably be reworked.

Samuel

  reply	other threads:[~2016-02-19 12:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19  8:00 [Qemu-devel] [PULL 00/13] vhost, virtio, pci, pxe Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 01/13] virtio-net: use the backend cross-endian capabilities Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 02/13] vhost-net: revert support of cross-endian vnet headers Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 03/13] virtio: move cross-endian helper to vhost Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 04/13] vhost: move virtio 1.0 check to cross-endian helper Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 05/13] vhost: simplify vhost_needs_vring_endian() Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 06/13] virtio: optimize virtio_access_is_big_endian() for little-endian targets Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 07/13] msix: fix msix_vector_masked Michael S. Tsirkin
2016-02-19 12:18   ` Stefano Stabellini
2016-02-19 12:20     ` Peter Maydell
2016-02-19 12:29       ` Stefano Stabellini
2016-02-19  8:00 ` [Qemu-devel] [PULL 08/13] tests: add pxe e1000 and virtio-pci tests Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 09/13] dec: convert to realize() Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 10/13] change type of pci_bridge_initfn() to void Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 11/13] rules: filter out irrelevant files Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 12/13] vhost-user interrupt management fixes Michael S. Tsirkin
2016-02-19  8:00 ` [Qemu-devel] [PULL 13/13] tests/vhost-user-bridge: add scattering of incoming packets Michael S. Tsirkin
2016-02-19 12:09 ` [Qemu-devel] [PULL 00/13] vhost, virtio, pci, pxe Peter Maydell
2016-02-19 12:41   ` Samuel Thibault [this message]
2016-02-19 14:17   ` Peter Maydell
2016-03-23  0:05   ` Samuel Thibault
2016-03-23 12:43     ` Peter Maydell
2016-03-23 12:45       ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160219124147.GE3502@var.bordeaux.inria.fr \
    --to=samuel.thibault@gnu.org \
    --cc=jan.kiszka@siemens.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).