[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conve
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions to dd |
Date: |
Tue, 23 Aug 2016 12:03:21 -0400 |
User-agent: |
Mutt/1.6.2 (2016-07-01) |
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
signature.asc
Description: PGP signature
- [Qemu-block] [PATCH 0/7] qemu-img dd, Reda Sallahi, 2016/08/22
- [Qemu-block] [PATCH 7/7] qemu-img: add a test suite for the count option, Reda Sallahi, 2016/08/22
- [Qemu-block] [PATCH 6/7] qemu-img: clean up dd documentation, Reda Sallahi, 2016/08/22
- [Qemu-block] [PATCH 5/7] qemu-img: add status option to dd, Reda Sallahi, 2016/08/22
- [Qemu-block] [PATCH 4/7] qemu-img: delete not used variable and an unecessary check, Reda Sallahi, 2016/08/22