Received: from eggs.gnu.org ([2001:4830:134:3::10]:52693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKpWQ-0001S4-44 for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKpWO-0007p7-2y for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:17:57 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-31-git-send-email-clord@redhat.com> From: Max Reitz Message-ID: <704a4744-30b1-3ff3-8612-0326dc01a357@redhat.com> Date: Wed, 6 Jul 2016 18:17:47 +0200 MIME-Version: 1.0 In-Reply-To: <1467732272-23368-31-git-send-email-clord@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="F0oRxsMatJC86mhATx5OIBVNCgftHdcil" Subject: Re: [Qemu-devel] [PATCH v3 30/32] blockdev: Remove the .bdrv_probe field from BlockDrivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --F0oRxsMatJC86mhATx5OIBVNCgftHdcil From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: <704a4744-30b1-3ff3-8612-0326dc01a357@redhat.com> Subject: Re: [PATCH v3 30/32] blockdev: Remove the .bdrv_probe field from BlockDrivers References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-31-git-send-email-clord@redhat.com> In-Reply-To: <1467732272-23368-31-git-send-email-clord@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 05.07.2016 17:24, Colin Lord wrote: > This commit finalizes the separation of the block driver and probe > function by removing the .bdrv_probe field from all BlockDrivers. > Probing is now accomplished solely by iterating over the array of probe= > function pointers in the format_probes array. >=20 > Signed-off-by: Colin Lord > --- > block.c | 20 +------------------- > block/raw-posix.c | 1 - > include/block/block_int.h | 1 - > scripts/modules/module_block.py | 10 ++-------- > 4 files changed, 3 insertions(+), 29 deletions(-) >=20 > diff --git a/block.c b/block.c > index 8226124..7e441fe 100644 > --- a/block.c > +++ b/block.c > @@ -599,34 +599,16 @@ BlockDriver *bdrv_probe_all(const uint8_t *buf, i= nt buf_size, > const char *format_max =3D NULL; > const char *format; > size_t i; > - BlockDriver *drv =3D NULL, *d; > - > - for (i =3D 0; i < ARRAY_SIZE(block_driver_modules); ++i) { > - if (block_driver_modules[i].has_probe) { > - block_module_load_one(block_driver_modules[i].library_name= ); > - } > - } > - > - QLIST_FOREACH(d, &bdrv_drivers, list) { > - if (d->bdrv_probe) { > - score =3D d->bdrv_probe(buf, buf_size, filename); > - if (score > score_max) { > - score_max =3D score; > - drv =3D d; > - } > - } > - } > =20 > for (i =3D 0; i < ARRAY_SIZE(format_probes); i++) { > format =3D format_probes[i](buf, buf_size, filename, &score); > if (score > score_max) { > score_max =3D score; > format_max =3D format; > - drv =3D bdrv_find_format(format_max); > } > } > =20 > - return drv; > + return bdrv_find_format(format_max); OK, so you move that function call here. Then, I'd at least like to see a comment in patch 17 that you are going to do this later (like "TODO: Move this call outside of this loop"). For this patch, however: Reviewed-by: Max Reitz > } > =20 > static int find_image_format(BlockDriverState *bs, const char *filenam= e, --F0oRxsMatJC86mhATx5OIBVNCgftHdcil 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 iQEvBAEBCAAZBQJXfS8sEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrdYr B/9mASwNcCsHk6zpwKWYwNRND2DI9AhcmOborH3OK0tuZirfyoLyUpyGmNyMyWT4 8udayaZJeIdeTKomz7drKyvn01qZhnyEJjcKZofcwlh3z8wv0Ynwnk3AtbAHOSzo TgC+pymi+WpNdExSMmY9tQPk5upxI1+zTfbKzPrr91nhx2sa6Y0ktJigX532YlND abiZKFilAiL51X1371di2lAvFgOCITyS1XFhLyIItI6L6WYVqfowPwfwrAJ+ymt7 pTw1tcZ1HO6EInS5sVbEnTInosX+8sgGAc9xG2Fj178VeRg48WYN7bl20kbf5Syz /XGH0idSRSg63LhiWXvErRGo =yDMC -----END PGP SIGNATURE----- --F0oRxsMatJC86mhATx5OIBVNCgftHdcil--