qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Bug 1814352 <1814352@bugs.launchpad.net>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Bug 1814352] Re: SIOCGIFNAME takes a struct ifreq not an integer
Date: Wed, 10 Apr 2019 03:16:29 +0700	[thread overview]
Message-ID: <CAFEAcA9X+srbS8gFm-D3KwHZ=PBjTeswkJb3nRK+Hp4geD9-Bg@mail.gmail.com> (raw)
Message-ID: <20190409201629.1lcG7vteuEtmu9YIplKGPpvlmcoWUjQ7ho_Jr3ylz3o@z> (raw)
In-Reply-To: <CAAedzxqBuP98u=YkrK7NU7p7eECODcxHcvspTc09c0+FHFxNnA@mail.gmail.com>

On Wed, 10 Apr 2019 at 01:26, Erik Kline <1814352@bugs.launchpad.net> wrote:
> Sure.  Looking at HEAD, and even the surrounding the lines, I think I
> should have tried STRUCT_short_ifreq instead of STRUCT_int_ifreq, though
> I'm not sure what the real difference would be.

The multiple STRUCT_*_ifreq are working around the fact that
our MK_STRUCT infrastructure can't handle unions. The struct
ifreq is a char array followed by a union whose members are
various different types. You should use the STRUCT_*_ifreq
corresponding to whatever type the union field used by this
particular ioctl is. For SIOCGIFNAME the ifr_ifindex is read,
and that's an int, so you want STRUCT_int_ifreq. (If you used
the 'short' version by mistake this would probably break for the
case of big-endian guest and little-endian host or vice-versa
because we'd swap the wrong amount of data.)

thanks
-- PMM


  parent reply	other threads:[~2019-04-09 20:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02  1:38 [Qemu-devel] [Bug 1814352] [NEW] SIOCGIFNAME takes a struct ifreq not an integer Erik Kline
2019-04-09 13:51 ` [Qemu-devel] [Bug 1814352] " Peter Maydell
2019-04-09 13:51   ` Peter Maydell
2019-04-09 18:18   ` Erik Kline
2019-04-09 18:18     ` Erik Kline
2019-04-09 20:16     ` Peter Maydell [this message]
2019-04-09 20:16       ` Peter Maydell
2019-04-09 20:16       ` Peter Maydell
2019-04-23 22:31 ` Erik Kline
2019-04-23 22:31   ` Erik Kline
2019-04-29 22:15 ` Erik Kline
2019-04-29 22:15   ` Erik Kline
2019-05-06 16:54 ` Erik Kline
2019-05-10 16:40 ` Erik Kline
2019-05-10 16:40 ` Erik Kline
2019-08-16  2:02 ` Erik Kline

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='CAFEAcA9X+srbS8gFm-D3KwHZ=PBjTeswkJb3nRK+Hp4geD9-Bg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=1814352@bugs.launchpad.net \
    --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).