Received: from eggs.gnu.org ([2001:4830:134:3::10]:53803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brqVJ-0006V0-4P for qemu-devel@nongnu.org; Wed, 05 Oct 2016 14:01:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brqVH-0002nK-6R for qemu-devel@nongnu.org; Wed, 05 Oct 2016 14:01:16 -0400 References: <1475659573-1664-1-git-send-email-kwolf@redhat.com> <1475659573-1664-3-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> Date: Wed, 5 Oct 2016 20:01:04 +0200 MIME-Version: 1.0 In-Reply-To: <1475659573-1664-3-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AhIub3rt9NSLTWXhu5eLrmMn7d0hBPt0K" 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: Kevin Wolf , qemu-block@nongnu.org Cc: eblake@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AhIub3rt9NSLTWXhu5eLrmMn7d0hBPt0K From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: eblake@redhat.com, qemu-devel@nongnu.org Message-ID: <67118bdb-13e5-e44a-9fd6-37f2b1248241@redhat.com> 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> In-Reply-To: <1475659573-1664-3-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 05.10.2016 11:26, Kevin Wolf wrote: > Almost all block devices are qdevified by now. This allows us to go bac= k > from the BlockBackend to the DeviceState. xen_disk is the last device > that is missing. We'll remember in the BlockBackend if a xen_disk is > attached and can then disable any features that require going from a BB= > to the DeviceState. >=20 > While at it, clearly mark the function used by xen_disk as legacy even > in its name, not just in TODO comments. >=20 > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 26 +++++++++++++++++++------- > hw/block/xen_disk.c | 2 +- > include/sysemu/block-backend.h | 4 ++-- > 3 files changed, 22 insertions(+), 10 deletions(-) >=20 > diff --git a/block/block-backend.c b/block/block-backend.c > index 911254a..39c5613 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c [...] > @@ -507,32 +508,38 @@ void blk_insert_bs(BlockBackend *blk, BlockDriver= State *bs) > } > } > =20 > -/* > - * Attach device model @dev to @blk. > - * Return 0 on success, -EBUSY when a device model is attached already= =2E > - */ > -int blk_attach_dev(BlockBackend *blk, void *dev) > -/* TODO change to DeviceState *dev when all users are qdevified */ > +static int blk_do_attach_dev(BlockBackend *blk, void *dev) > { > if (blk->dev) { > return -EBUSY; > } > blk_ref(blk); > blk->dev =3D dev; > + blk->legacy_dev =3D false; > blk_iostatus_reset(blk); > return 0; > } > =20 > /* > * Attach device model @dev to @blk. > + * Return 0 on success, -EBUSY when a device model is attached already= =2E > + */ > +int blk_attach_dev(BlockBackend *blk, DeviceState *dev) > +{ > + return blk_do_attach_dev(blk, dev); > +} > + > +/* > + * Attach device model @dev to @blk. > * @blk must not have a device model attached already. > * TODO qdevified devices don't use this, remove when devices are qdev= ified > */ > -void blk_attach_dev_nofail(BlockBackend *blk, void *dev) > +void blk_attach_dev_legacy(BlockBackend *blk, void *dev) > { > if (blk_attach_dev(blk, dev) < 0) { I'd make this a blk_do_attach_dev(), but it's not syntactically wrong, so the choice is up to you. Thus, either way: Reviewed-by: Max Reitz > abort(); > } > + blk->legacy_dev =3D true; > } > =20 > /* --AhIub3rt9NSLTWXhu5eLrmMn7d0hBPt0K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJX9T/gEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQOBC B/0YlPFlayK3YgdM7a5qaw81gU09AHfNs7g9NAzzqzBEgXWfLre7B0XvfoPAvlGd wfvpUBrj0OROs7Hunt4KHyELO/JvRXkutvIIlonqOJx670VyGh58J0Lqu8xlhxdv Hboz+V5Gm/veq4ZG03d2XM68d55pCVg1L2d4n/S3wDa7ZOpf0xChqp3R8cvTaWp+ hvu2Geb2DZDEdtV8hxaMV/BNqMQuAbTk47zPLerlDZ9S38RvUsYnXwwoNxGjFnpd KxeBio/7oK0LqSgMmnPLCXOpOsw2vkkRbTTwOlzwofkg3cj2ZOO4J5+bGsv/yU1n ShjrTu/eq5H2qtfVnAjGjWhm =TJ0j -----END PGP SIGNATURE----- --AhIub3rt9NSLTWXhu5eLrmMn7d0hBPt0K--