[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: |
Reda Sallahi |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions to dd |
Date: |
Mon, 22 Aug 2016 16:02:30 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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.
--
Reda
- [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