Received: from eggs.gnu.org ([2001:4830:134:3::10]:42033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brrbT-0002sY-Mq for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brrbS-0003jt-Cf for qemu-devel@nongnu.org; Wed, 05 Oct 2016 15:11:43 -0400 References: <1475659573-1664-1-git-send-email-kwolf@redhat.com> <1475659573-1664-3-git-send-email-kwolf@redhat.com> <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> From: Eric Blake Message-ID: Date: Wed, 5 Oct 2016 14:11:36 -0500 MIME-Version: 1.0 In-Reply-To: <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KM9E6Cc7UNv0AJMVQsFVmGXI6N63BqM12" Subject: Re: [Qemu-devel] [PATCH 2/3] block-backend: Remember if attached device is non-qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KM9E6Cc7UNv0AJMVQsFVmGXI6N63BqM12 From: Eric Blake To: Max Reitz , Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: Subject: Re: [PATCH 2/3] block-backend: Remember if attached device is non-qdev References: <1475659573-1664-1-git-send-email-kwolf@redhat.com> <1475659573-1664-3-git-send-email-kwolf@redhat.com> <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> In-Reply-To: <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/05/2016 01:01 PM, Max Reitz wrote: >> +static int blk_do_attach_dev(BlockBackend *blk, void *dev) >> + */ >> +int blk_attach_dev(BlockBackend *blk, DeviceState *dev) >> +{ >> + return blk_do_attach_dev(blk, dev); >> +void blk_attach_dev_legacy(BlockBackend *blk, void *dev) >> { >> if (blk_attach_dev(blk, dev) < 0) { >=20 > I'd make this a blk_do_attach_dev(), but it's not syntactically wrong, > so the choice is up to you. It's technically undefined C behavior to cast from void* to an unrelated pointer and back to void* (you are only guaranteed a round trip from type to void* and back to original type, not with unrelated types). So syntactically valid but semantically undefined. On the other hand, ABI-wise, I'd be shocked if our compilers are able to exploit our use of undefined behavior. At any rate, using blk_do_attach_dev() would avoid the definedness problem, so I'd go ahead and make the change. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KM9E6Cc7UNv0AJMVQsFVmGXI6N63BqM12 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX9VBoAAoJEKeha0olJ0NqQywH/if2j0s+PGQEcpXKEiatj6JB BF70ODWsIKGNFcdppsodTsgfyEqtfNMCo+jcMNOTclHNf4oEjgx0+0NFwjg7hwM8 cnoFkk5CFxz+QbbddKwjttsydfssDOmdFBujtRdnI6St7e9q7UL+Y5+D3VOJv9cJ MswMVBI9SZF9D7MhgLYPwEVR1y30mTOEHsOpXoLLDXzglLTo/qGbXvaZ1cUQCHoD 3cvXI0fWxu2lB4ITJNLWraBPa+GYsKD2PejTHwowikRfBoNhME0Ue04lLObWssWA szIweR+/P/EZvegNjHGufkxkngGCI7hIQEvnaQsnJN0iWHkQCmE1F/je1pAxaPE= =cEDM -----END PGP SIGNATURE----- --KM9E6Cc7UNv0AJMVQsFVmGXI6N63BqM12--