Received: from eggs.gnu.org ([2001:4830:134:3::10]:54167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXDse-0005p6-Sp for qemu-devel@nongnu.org; Tue, 09 Aug 2016 16:44:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXDsc-0007u8-Qd for qemu-devel@nongnu.org; Tue, 09 Aug 2016 16:44:07 -0400 References: <20160725055842.3836-1-fullmanet@gmail.com> <8e32b877-dc06-02d7-91bd-1270d4659c2b@redhat.com> From: Max Reitz Message-ID: <630fd03c-c8bb-81ee-7aa4-b6e914fd651e@redhat.com> Date: Tue, 9 Aug 2016 22:43:53 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3pakq5r8pa58PV5A7UIlwUkdpd5Q0ObHE" Subject: Re: [Qemu-devel] [PATCH v6] qemu-img: add the 'dd' subcommand List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Reda Sallahi Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Fam Zheng , Kevin Wolf This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3pakq5r8pa58PV5A7UIlwUkdpd5Q0ObHE From: Max Reitz To: Reda Sallahi Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Fam Zheng , Kevin Wolf Message-ID: <630fd03c-c8bb-81ee-7aa4-b6e914fd651e@redhat.com> Subject: Re: [PATCH v6] qemu-img: add the 'dd' subcommand References: <20160725055842.3836-1-fullmanet@gmail.com> <8e32b877-dc06-02d7-91bd-1270d4659c2b@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09.08.2016 20:39, Reda Sallahi wrote: > Hi Max, > Thanks for the review! >=20 > On 8/8/16, Max Reitz wrote: >> On 25.07.2016 07:58, Reda Sallahi wrote: >>> + if (in->bsz =3D=3D 0) { >>> + error_report("invalid number: '%s'", arg); >> >> It's not an invalid number, it's just an invalid block size. In my >> understanding, those are two different things. >=20 > I was trying to have the same error message as dd(1) for this. OK. I hope nobody is really relying on dd emitting exactly this error message, though. :-) >>> + tmp =3D strchr(arg, '=3D'); >> >> FYI, strtok() is a neat function for exactly this. I'm not saying you >> need to use it, though. >=20 > For something as simple I would rather avoid using strtok(). Yep, that's fine. >>> + for (; incount < size; block_count++) { >> >> Please do not initialize incount above but here. Having to jump more >> than a hundred lines up to find out what a variable is set to makes co= de >> very hard to read. >> >> Also, I'd rename incount to in_offset or something, because "incount" = to >> me sounds like it counts a number of blocks, whereas it actually count= s >> a number of bytes, independently of the block size. >> >=20 > There is already in.offset ([PATCH v4] qemu-img: add skip option to dd)= > so it will just be confusing but if you have a better name I will be gl= ad to > change it. Hm. How about "in_position"? Max --3pakq5r8pa58PV5A7UIlwUkdpd5Q0ObHE 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 iQEvBAEBCAAZBQJXqkCKEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrSua B/0bazn4lPUy+EK3Zw3gDsMUOkxj8nOVxfJfBzhDuIKoBkqsaiy1brWV1CIAW2rM LON5LbJ48XQ/0BsBrwjoWd0DACZLIauGx85FponY4m0/piJQTlO83Wr1yf/ZIa4h yj9OJkvX0zmTW0PjC0uWPsCWab+DZr25VYwWygrwousgyxCZCr0GubFC7H+PJw1A JbFOiY1B6+vZTDumxanCrAMaIM469keLAY9rAc71tZE5qiGEMTiMPkfohcQ4Zjls gWVLZzoG7Nc5YJ3HdeMhNtKIGwdV8i11lLtLfAmBVfMZ2UQa2AOOEbeA2+UbHtbw 1axu4aTlsiKQaeXCq3wnjrL7 =Zj5j -----END PGP SIGNATURE----- --3pakq5r8pa58PV5A7UIlwUkdpd5Q0ObHE--