From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNhRr-0001dZ-LX for qemu-devel@nongnu.org; Thu, 14 Jul 2016 10:17:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNhRq-0000Yh-Bd for qemu-devel@nongnu.org; Thu, 14 Jul 2016 10:17:07 -0400 References: <1468502894-18098-1-git-send-email-kwolf@redhat.com> <1468502894-18098-2-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <57879ED8.1010008@redhat.com> Date: Thu, 14 Jul 2016 08:16:56 -0600 MIME-Version: 1.0 In-Reply-To: <1468502894-18098-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fuQEFKPXwwCalNIddu5wR5atWoWFwdHCH" Subject: Re: [Qemu-devel] [PATCH v4 01/11] block: Accept node-name for block-stream List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, berto@igalia.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fuQEFKPXwwCalNIddu5wR5atWoWFwdHCH From: Eric Blake To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, berto@igalia.com, qemu-devel@nongnu.org Message-ID: <57879ED8.1010008@redhat.com> Subject: Re: [PATCH v4 01/11] block: Accept node-name for block-stream References: <1468502894-18098-1-git-send-email-kwolf@redhat.com> <1468502894-18098-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1468502894-18098-2-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/14/2016 07:28 AM, Kevin Wolf wrote: > In order to remove the necessity to use BlockBackend names in the > external API, we want to allow node-names everywhere. This converts > block-stream to accept a node-name without lifting the restriction that= > we're operating at a root node. >=20 > In case of an invalid device name, the command returns the GenericError= > error class now instead of DeviceNotFound, because this is what > qmp_get_root_bs() returns. >=20 > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 16 ++++++++++++++++ > blockdev.c | 32 ++++++++++++++++++++------------ > include/sysemu/block-backend.h | 1 + > qapi/block-core.json | 5 +---- > qmp-commands.hx | 2 +- > tests/qemu-iotests/030 | 2 +- > 6 files changed, 40 insertions(+), 18 deletions(-) Reviewed-by: Eric Blake >=20 > diff --git a/block/block-backend.c b/block/block-backend.c > index f9cea1b..4a00f8a 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -410,6 +410,22 @@ bool bdrv_has_blk(BlockDriverState *bs) > } > =20 > /* > + * Returns true if @bs has only BlockBackends as parents. > + */ > +bool bdrv_is_root_node(BlockDriverState *bs) > +{ > + BdrvChild *c; > + > + QLIST_FOREACH(c, &bs->parents, next_parent) { > + if (c->role !=3D &child_root) { > + return false; > + } > + } > + > + return true; > +} I think you've settled on a good approach here. Thanks for persisting at it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --fuQEFKPXwwCalNIddu5wR5atWoWFwdHCH 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/ iQEcBAEBCAAGBQJXh57YAAoJEKeha0olJ0NqjgYH/iT9xRaqENjnWCK+OjtcMsO9 xYgGdq6fIBQwoW5yjT1LDx0eeWsK0bV2DuMA3tmHI2qdoQ0XmQH8jHRJNWgteXDi xr29OseiyQSvsJD4u1znVLBe+ox1A836QPZGfF8tsCGNnfVVOvv1xuDon7kD/BmI KxagH3opNOzGSYDOwcGWHNMF2crC4M+RQ1RJBPzyiyxGq1TJNgdJOFogZBgE6Qcq aWh/iTVYCtDumyjLahgoED4ZV2NmtNUJuoX/axediW8LC7N4NMA5WQu7y/sL0cWH 7gTaKHx3Vfxa+8iJIlU70lciMTzcrgVyYjw+3F5XM5ZvBfZlPSeK3sJn2ySZwDs= =Ne+B -----END PGP SIGNATURE----- --fuQEFKPXwwCalNIddu5wR5atWoWFwdHCH--