From: Stefan Hajnoczi <stefanha@redhat.com>
To: Reda Sallahi <fullmanet@gmail.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Fam Zheng <famz@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions to dd
Date: Tue, 23 Aug 2016 12:03:21 -0400 [thread overview]
Message-ID: <20160823160321.GD3948@stefanha-x1.localdomain> (raw)
In-Reply-To: <20160822140229.GB21105@vps308710.ovh.net>
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
On Mon, Aug 22, 2016 at 04:02:30PM +0200, Reda Sallahi wrote:
> On Mon, Aug 22, 2016 at 09:35:26AM -0400, Stefan Hajnoczi wrote:
> > On Mon, Aug 22, 2016 at 09:55:13AM +0200, Reda Sallahi wrote:
> > > @@ -4325,20 +4388,43 @@ static int img_dd(int argc, char **argv)
> > >
> > > for (out_pos = out.offset * obsz; in_pos < size; block_count++) {
> > > int in_ret, out_ret;
> > > + bsz = in.bsz;
> > >
> > > if (in_pos + in.bsz > size) {
> > > - in_ret = blk_pread(blk1, in_pos, in.buf, size - in_pos);
> > > - } else {
> > > - in_ret = blk_pread(blk1, in_pos, in.buf, in.bsz);
> > > + bsz = size - in_pos;
> > > + }
> > > +
> > > + if (dd.conv & C_SYNC) {
> > > + memset(in.buf, 0, in.bsz);
> > > }
> >
> > Why is memset necessary?
>
> When we set conv=noerror,sync sync tells dd to pad each block with NULs so
> that if there is an error it preserves the size of the input read.
Ah, I see.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-23 21:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-22 7:55 [Qemu-devel] [PATCH 0/7] qemu-img dd Reda Sallahi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 1/7] qemu-img: add seek option to dd Reda Sallahi
2016-08-22 13:06 ` Stefan Hajnoczi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 2/7] qemu-img: add iflag and oflag options " Reda Sallahi
2016-08-22 13:26 ` Stefan Hajnoczi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions " Reda Sallahi
2016-08-22 13:35 ` Stefan Hajnoczi
2016-08-22 14:02 ` Reda Sallahi
2016-08-23 16:03 ` Stefan Hajnoczi [this message]
2016-08-22 7:55 ` [Qemu-devel] [PATCH 4/7] qemu-img: delete not used variable and an unecessary check Reda Sallahi
2016-08-22 13:36 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 5/7] qemu-img: add status option to dd Reda Sallahi
2016-08-22 13:45 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-08-22 13:50 ` [Qemu-devel] " Reda Sallahi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 6/7] qemu-img: clean up dd documentation Reda Sallahi
2016-08-22 13:46 ` Stefan Hajnoczi
2016-08-22 7:55 ` [Qemu-devel] [PATCH 7/7] qemu-img: add a test suite for the count option Reda Sallahi
2016-08-22 13:46 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160823160321.GD3948@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=fullmanet@gmail.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).