From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKpwg-0007b1-CJ for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:45:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKpwf-0006yg-BU for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:45:06 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-33-git-send-email-clord@redhat.com> From: Max Reitz Message-ID: <7be57e35-5ea7-bcfc-a621-c723115c69e6@redhat.com> Date: Wed, 6 Jul 2016 18:44:57 +0200 MIME-Version: 1.0 In-Reply-To: <1467732272-23368-33-git-send-email-clord@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="slnLFEh1wIIJXb8od3Q8BH9icrT4Ww8bd" Subject: Re: [Qemu-devel] [PATCH v3 32/32] blockdev: Remove bdrv_probe_device field from BlockDriver 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) --slnLFEh1wIIJXb8od3Q8BH9icrT4Ww8bd From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: <7be57e35-5ea7-bcfc-a621-c723115c69e6@redhat.com> Subject: Re: [PATCH v3 32/32] blockdev: Remove bdrv_probe_device field from BlockDriver References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-33-git-send-email-clord@redhat.com> In-Reply-To: <1467732272-23368-33-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 BlockDriver from its > device probing function. Now the accesses to these functions in block.c= > occur through the protocol_probes array, and each function returns a > score and protocol name with which to find the corresponding driver. >=20 > Signed-off-by: Colin Lord > --- > block.c | 46 ++++++++++++++++++++++++++++++---= -------- > block/probe/host_cdrom.c | 23 ++++++++++++++------- > block/probe/host_device.c | 34 ++++++++++++++++++++---------- > block/raw-posix.c | 3 --- > block/raw-win32.c | 1 - > include/block/block_int.h | 2 -- > include/block/probe.h | 4 ++-- > scripts/modules/module_block.py | 12 ++--------- > 8 files changed, 76 insertions(+), 49 deletions(-) As I suggested for patch 17, I'd split the additions to block.c from the conversion of the actual probe functions. > diff --git a/block.c b/block.c > index 7e441fe..bc1046b 100644 > --- a/block.c > +++ b/block.c > @@ -59,6 +59,7 @@ > =20 > typedef const char *BdrvProbeFunc(const uint8_t *buf, int buf_size, > const char *filename, int *score); > +typedef const char *BdrvProbeDevFunc(const char *filename, int *score)= ; > =20 > static BdrvProbeFunc *format_probes[] =3D { > bochs_probe, > @@ -76,6 +77,13 @@ static BdrvProbeFunc *format_probes[] =3D { > vpc_probe > }; > =20 > +static BdrvProbeDevFunc *protocol_probes[] =3D { > + hdev_probe_device, > +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__l= inux__) > + cdrom_probe_device > +#endif > +}; > + Same as what I've said in my reply to patch 17: I'd rather have a struct that contains the name of the protocol and the probe function separated from each other than have the probe function return the protocol name. In case you decide not to follow this suggestion (nor the suggestion on splitting this patch) though: Reviewed-by: Max Reitz > static QTAILQ_HEAD(, BlockDriverState) graph_bdrv_states =3D > QTAILQ_HEAD_INITIALIZER(graph_bdrv_states); > =20 --slnLFEh1wIIJXb8od3Q8BH9icrT4Ww8bd 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 iQEvBAEBCAAZBQJXfTWJEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrSSY B/9D5vYjioIOkZQtWvDFHnjUEKFhqzZpuZEfuP+LLzYxeU3e4FO1/qqlfor3+2Lu Ely9+fj8M9m/EaGxTx+TiG1D8GWPmntKbg9sThTMeW2mHXpR5CqSVB32CqQgURfL rqbAynpJOf+fyOWIzJvblxvmf6aA0icdfNrn6LKhzbV+Nos/H+UF4rsJyp575Poa tba07A6xRxmnjV1riQP9TVGqH3VI2B3YynVOrBkeHwqENuIjGeqK1wrhdYrb6z8n 8yYy62eEKDeThxH6jw5AmvVQonMo8s7/ofBPhc7d+PyumCQUmw4/z8pdq33pM6ds IQm+1PxCYLls0xE5BAmqA+LI =kIhe -----END PGP SIGNATURE----- --slnLFEh1wIIJXb8od3Q8BH9icrT4Ww8bd--