From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wup4F-0005X9-Cv for qemu-devel@nongnu.org; Wed, 11 Jun 2014 16:24:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wup49-0007e1-9Q for qemu-devel@nongnu.org; Wed, 11 Jun 2014 16:24:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wup49-0007dt-0q for qemu-devel@nongnu.org; Wed, 11 Jun 2014 16:24:13 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5BKOBHk008065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Jun 2014 16:24:12 -0400 Message-ID: <5398BAEA.601@redhat.com> Date: Wed, 11 Jun 2014 14:24:10 -0600 From: Eric Blake MIME-Version: 1.0 References: <1402495503-4722-1-git-send-email-kwolf@redhat.com> <1402495503-4722-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1402495503-4722-6-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pt1WdSEM5KUfnB69PwgqAOvPk7Fj8bfkk" Subject: Re: [Qemu-devel] [PATCH 5/9] block: Use common driver selection code for bdrv_open_file() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: armbru@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pt1WdSEM5KUfnB69PwgqAOvPk7Fj8bfkk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/11/2014 08:04 AM, Kevin Wolf wrote: > This moves the bdrv_open_file() call a bit down so that it can use the > bdrv_open() code that selects the right block driver. >=20 > The code between the old and the new call site is either common code > (the error message for an unknown driver has been unified now) or > doesn't run with cleared BDRV_O_PROTOCOL (added an if block in one > place, whereas the right path was already asserted in another place) >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 71 ++++++++++++++++++++++++++++-----------------------------= -------- > 1 file changed, 30 insertions(+), 41 deletions(-) >=20 > diff --git a/block.c b/block.c > index 011cfc4..2aa0a56 100644 > --- a/block.c > +++ b/block.c > @@ -1136,25 +1136,14 @@ static int bdrv_fill_options(QDict **options, c= onst char **pfilename, int flags, > * returns. Then, the caller is responsible for freeing it. If it inte= nds to > * reuse the QDict, QINCREF() should be called beforehand. > */ > -static int bdrv_file_open(BlockDriverState *bs, QDict **options, int f= lags, > - Error **errp) > +static int bdrv_file_open(BlockDriverState *bs, BlockDriver *drv, > + QDict **options, int flags, Error **errp) > { > - BlockDriver *drv; > const char *filename; > - const char *drvname; > Error *local_err =3D NULL; > int ret; > =20 > filename =3D qdict_get_try_str(*options, "filename"); > - drvname =3D qdict_get_str(*options, "driver"); > - > - drv =3D bdrv_find_format(drvname); > - if (!drv) { > - error_setg(errp, "Unknown driver '%s'", drvname); > - ret =3D -ENOENT; > - goto fail; > - } > - qdict_del(*options, "driver"); Ah, this addresses another question I asked earlier. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --pt1WdSEM5KUfnB69PwgqAOvPk7Fj8bfkk 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 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTmLrqAAoJEKeha0olJ0NqdJcH/1GmzOurd+ZDIhzDouu3f+Yv mvaJvG6RQL4yMwF5p0cfdX4KIdm0F6AxwW1QZYU3aU6oQLMfAhMcGXV546dDuYAM 8xE2PaEiCwDTfgCjQ45TssltAHcsYEXg7JQvOVJVUyEvQkYNFPx9RmfDsh7qieRu SExu6ugjYQGGTvGZ4b/btCOem+DympzZXjTbALCE8jpuPyCUBD7SwKlSq7YWzML3 erqcA5ioyFajKhWFr4ERhxW3cskXcmjb8/7vcPyY2q2kGPkRXimeVzCSX/08k1G3 Ufp1hf4md4BWJP6v+O60YLqyh82UGznKMbs+baHJdFe76/lwwI4apmEy0AxpPe4= =mk98 -----END PGP SIGNATURE----- --pt1WdSEM5KUfnB69PwgqAOvPk7Fj8bfkk--