From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKntR-0006rZ-JH for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKntN-0004kF-4N for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:33:36 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-6-git-send-email-clord@redhat.com> From: Max Reitz Message-ID: <822d041f-c3ff-1222-26dd-f17c1eac0870@redhat.com> Date: Wed, 6 Jul 2016 16:33:20 +0200 MIME-Version: 1.0 In-Reply-To: <1467732272-23368-6-git-send-email-clord@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MqPs3ERjMIpo5KTdhUk5Raqm0Mg0aqpKJ" Subject: Re: [Qemu-devel] [PATCH v3 05/32] blockdev: Move cloop probe to its own 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) --MqPs3ERjMIpo5KTdhUk5Raqm0Mg0aqpKJ From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org Message-ID: <822d041f-c3ff-1222-26dd-f17c1eac0870@redhat.com> Subject: Re: [PATCH v3 05/32] blockdev: Move cloop probe to its own file References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-6-git-send-email-clord@redhat.com> In-Reply-To: <1467732272-23368-6-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: > Isolates cloop probing function as part of the modularization process. >=20 > Signed-off-by: Colin Lord > --- > block/Makefile.objs | 2 +- > block/cloop.c | 16 +--------------- > block/probe/cloop.c | 17 +++++++++++++++++ > include/block/probe.h | 1 + > 4 files changed, 20 insertions(+), 16 deletions(-) > create mode 100644 block/probe/cloop.c Reviewed-by: Max Reitz [...] > diff --git a/block/probe/cloop.c b/block/probe/cloop.c > new file mode 100644 > index 0000000..955c29c > --- /dev/null > +++ b/block/probe/cloop.c > @@ -0,0 +1,17 @@ > +#include "qemu/osdep.h" > +#include "block/probe.h" > + > +int cloop_probe(const uint8_t *buf, int buf_size, const char *filename= ) > +{ > + const char *magic_version_2_0 =3D "#!/bin/sh\n" > + "#V2.0 Format\n" > + "modprobe cloop file=3D$0 && mount -r -t iso9660 /dev/cloop $1= \n"; > + int length =3D strlen(magic_version_2_0); > + if (length > buf_size) { > + length =3D buf_size; Pre-existing, but this seems a bit fishy to me. But, well, as long as buf_size (BLOCK_PROBE_BUF_SIZE) will actually always be at least the size of that string... > + } > + if (!memcmp(magic_version_2_0, buf, length)) { > + return 2; > + } > + return 0; > +} --MqPs3ERjMIpo5KTdhUk5Raqm0Mg0aqpKJ 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 iQEvBAEBCAAZBQJXfRaxEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrYkS CACDHwKOYJgtLQ6Jiw87qGMbsntLtamSGZRJcyGXaorPxNdigAh71spIwaL268XW 7yM48kPuBMaSt6OfUk1BbP09jKnUppzPRG6DR7RDnashBYoXHCBda0W6PzEGNg/7 HgnvpQz/uZH9P5xHoN5o5sf7atuRX11qLhJMi1lJrx3jSxzTHcgYiQTKkOztQIWJ ALyrafJ0wFecNhS0L2Rb4PsbHzhe7mTa/3Cm6UDqdlxI5tku5lDIV92aX7RJCaa/ aOCZDiOYYs0wJgJuwZ5eY6NLj/kXCioOk+0WudP8SsZUu56BiwNFuDVk87yynzza mNnz8WDujLPOEsa2B5GJe8xV =FYEM -----END PGP SIGNATURE----- --MqPs3ERjMIpo5KTdhUk5Raqm0Mg0aqpKJ--