From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnuZf-0000US-UH for qemu-devel@nongnu.org; Mon, 10 Nov 2014 14:24:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnuZa-0001Sc-O7 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 14:24:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnuZa-0001SS-HO for qemu-devel@nongnu.org; Mon, 10 Nov 2014 14:24:22 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAAJOLUI028014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 10 Nov 2014 14:24:22 -0500 Message-ID: <546110E4.9020305@redhat.com> Date: Mon, 10 Nov 2014 12:24:20 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415389165-16157-1-git-send-email-kwolf@redhat.com> <1415389165-16157-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1415389165-16157-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DGEjx4JOiT5pNFlWCBUsDkgTJhclWELn3" Subject: Re: [Qemu-devel] [PATCH v2 1/9] qemu-io: Allow explicitly specifying format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: jcody@redhat.com, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DGEjx4JOiT5pNFlWCBUsDkgTJhclWELn3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/07/2014 12:39 PM, Kevin Wolf wrote: > This adds a -f option to qemu-io which allows to explicitly specify the= > block driver to use for the given image. >=20 > Signed-off-by: Kevin Wolf > --- > qemu-io.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) >=20 > "\n" > " -c, --cmd STRING execute command with its arguments\n" > " from the given string\n" > +" -f, --format FMT specifies the block driver to use\n" > " -r, --read-only export read-only\n" Documented in one order... > " -s, --snapshot use snapshot file\n" > " -n, --nocache disable host cache\n" > @@ -364,12 +366,13 @@ int main(int argc, char **argv) > { > int readonly =3D 0; > int growable =3D 0; > - const char *sopt =3D "hVc:d:rsnmgkt:T:"; > + const char *sopt =3D "hVc:d:f:rsnmgkt:T:"; inserted into the longopt in a different order... > const struct option lopt[] =3D { > { "help", 0, NULL, 'h' }, > { "version", 0, NULL, 'V' }, > { "offset", 1, NULL, 'o' }, > { "cmd", 1, NULL, 'c' }, > + { "format", 1, NULL, 'f' }, > { "read-only", 0, NULL, 'r' }, then spelled out in the first order... > @@ -407,6 +413,13 @@ int main(int argc, char **argv) > exit(1); > } > break; > + case 'f': > + drv =3D bdrv_find_format(optarg); > + if (!drv) { > + error_report("Invalid format '%s'", optarg); > + exit(EXIT_FAILURE); > + } > + break; > case 'c': =2E..and finally implemented in yet another order. While it doesn't impact code correctness, it does impact maintainability (it would be nice to use one common order among all four locations, rather than 3 different orders). Arguably, some of it is pre-existing, so I won't require a respin, but it is worth considering. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DGEjx4JOiT5pNFlWCBUsDkgTJhclWELn3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUYRDkAAoJEKeha0olJ0NqZcsH/1LgAnDn6ynCw5UVGHk5exRE q0sTyBHExoFKmsg+UZBvVgn3FhMmjyLs8MKh1CKw6zOsr6fdi12kTYn3UxpnBsT8 OVnmslW5XClwUPceErqArEBkoAeRtQkKK6TnrNukQixgzz/rjByTVxVXI00IWPnX 3QRl9iQZeWsClsbGcwJSepAIqkHLtIGCkkl7p0KYIPGVYxVPNYqeK5IWaKfQuByQ ao4EHD0HbW8sJ1YWmRhR8xHr3FEu01Ey/MzYPXoSdIseJ9QMHBxwmslHsids8P+K oHlDY1ywUXX81XnXVjTgDxaTsrU3DR4zTlP4Lzxkz0nLU5aMjHfSRk4xuKNE5S4= =UgNN -----END PGP SIGNATURE----- --DGEjx4JOiT5pNFlWCBUsDkgTJhclWELn3--