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: Stefan Hajnoczi
Subject: Re: [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

Attachment: signature.asc
Description: PGP signature


reply via email to

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