Received: from eggs.gnu.org ([2001:4830:134:3::10]:37644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKoxW-0001vq-L5 for qemu-devel@nongnu.org; Wed, 06 Jul 2016 11:41:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKoxR-0005ye-IE for qemu-devel@nongnu.org; Wed, 06 Jul 2016 11:41:53 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-5-git-send-email-clord@redhat.com> <9bc2a125-4a05-a145-0eb4-082d733f8640@redhat.com> From: Max Reitz Message-ID: <353be6fe-b020-3e05-d8c4-a645e1ab1be9@redhat.com> Date: Wed, 6 Jul 2016 17:41:37 +0200 MIME-Version: 1.0 In-Reply-To: <9bc2a125-4a05-a145-0eb4-082d733f8640@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GRPR0NTs7G8lhhaWtJmHotsDNdcGPluP9" Subject: Re: [Qemu-devel] [PATCH v3 04/32] blockdev: Move bochs probe into separate file 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) --GRPR0NTs7G8lhhaWtJmHotsDNdcGPluP9 From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: <353be6fe-b020-3e05-d8c4-a645e1ab1be9@redhat.com> Subject: Re: [PATCH v3 04/32] blockdev: Move bochs probe into separate file References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-5-git-send-email-clord@redhat.com> <9bc2a125-4a05-a145-0eb4-082d733f8640@redhat.com> In-Reply-To: <9bc2a125-4a05-a145-0eb4-082d733f8640@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 06.07.2016 16:19, Max Reitz wrote: > On 05.07.2016 17:24, Colin Lord wrote: >> This puts the bochs probe function into its own separate file as part = of >> the process of modularizing block drivers. Having the probe functions >> separate from the rest of the driver allows us to probe without having= >> to potentially unnecessarily load the driver. >> >> Signed-off-by: Colin Lord >> --- >> block/Makefile.objs | 1 + >> block/bochs.c | 55 ++---------------------------------= --------- >> block/probe/bochs.c | 21 +++++++++++++++++ >> include/block/driver/bochs.h | 40 ++++++++++++++++++++++++++++++++ >> include/block/probe.h | 6 +++++ >> 5 files changed, 70 insertions(+), 53 deletions(-) >> create mode 100644 block/probe/bochs.c >> create mode 100644 include/block/driver/bochs.h >> create mode 100644 include/block/probe.h >> >=20 > [...] >=20 >> diff --git a/block/probe/bochs.c b/block/probe/bochs.c >> new file mode 100644 >> index 0000000..8adc09f >> --- /dev/null >> +++ b/block/probe/bochs.c >> @@ -0,0 +1,21 @@ >> +#include "qemu/osdep.h" >> +#include "block/block_int.h" >> +#include "block/probe.h" >> +#include "block/driver/bochs.h" >> + >> +int bochs_probe(const uint8_t *buf, int buf_size, const char *filenam= e) >> +{ >> + const struct bochs_header *bochs =3D (const void *)buf; >> + >> + if (buf_size < HEADER_SIZE) >> + return 0; >> + >> + if (!strcmp(bochs->magic, HEADER_MAGIC) && >> + !strcmp(bochs->type, REDOLOG_TYPE) && >> + !strcmp(bochs->subtype, GROWING_TYPE) && >> + ((le32_to_cpu(bochs->version) =3D=3D HEADER_VERSION) || >> + (le32_to_cpu(bochs->version) =3D=3D HEADER_V1))) >> + return 100; >> + >> + return 0; >> +} >=20 > Not sure what to do about the coding style here. Some people prefer cod= e > movement to be pure, but I feel bad about doing code movement and then > leaving the code wrongly formatted. That is, in my opinion, every patch= > should pass checkpatch.pl (but I won't object to a patch that doesn't > pass checkpatch.pl simply because of pre-existing code). I've just seen that you indeed fix this later in this series. That's good enough for me. Max --GRPR0NTs7G8lhhaWtJmHotsDNdcGPluP9 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 iQEvBAEBCAAZBQJXfSaxEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrYHA B/4mWVEUsVPhTGCc4abovAgN3jI6EsiSyyaYPPsTu2J9bkdof3EozJHCC4NmM8Jw CmIWoaq7AyCscnRf4jupaG0tF/4GxJemWaP0TVK8UUcOSNz6FpArFrDaWHFrd70p szOX/D6Z/f+tWvMswkHWe1CIPHpur9M53T4lpvUWVv97yhjRViVcsCO+SPiVSywU yxKilj0ODEVkP2ZDfkwPZCxyTOzR5JWwcKutV9AmCMWw+fkA0v949RFr0SKXc5v0 sz0uWBvA+9xhYNWyq2cbH3WjrqY8Z8RsIsPUi648fTMzE///Uv5G9cXW4vYJx4ci sYDzHvqiCMwqZZWmakmHGTNr =wyAH -----END PGP SIGNATURE----- --GRPR0NTs7G8lhhaWtJmHotsDNdcGPluP9--