qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/7] qemu-img: add more conv= conversions to dd


From: Reda Sallahi
Subject: Re: [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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]