[PATCH [mtd-utils] 3/3] nandwrite: add --input-{skip, size} options

Mike Frysinger vapier at gentoo.org
Thu May 9 11:57:47 EDT 2013


On Thursday 09 May 2013 06:42:01 Gupta, Pekon wrote:
> >  	pagelen = mtd.min_io_size + ((writeoob) ? mtd.oob_size : 0);
> > +		imglen = inputsize ? : pagelen;
> > +		if (inputskip) {
> > +			errmsg("seeking stdin does not work");
> > +			goto closeall;
> > +		}
> >  	} else {
> > -		struct stat st;
> > -		if (fstat(ifd, &st)) {
> > -			sys_errmsg("unable to stat input image");
> > +		if (!inputsize) {
> > +			struct stat st;
> > +			if (fstat(ifd, &st)) {
> > +				sys_errmsg("unable to stat input
> > image");
> > +				goto closeall;
> > +			}
> > +			imglen = st.st_size;
> > +		} else
> > +			imglen = inputsize;
> 
> [Pekon]: It would be good to check that both 'inputsize' & 'inputskip'
> are multiples of:
> -  mtd->writesize : if not using '-o' option, OR
> - (mtd->writesize + mtd->oobsize): is using '-o' option.
> Or Simply, both arguments should be aligned to 'pagelen' boundary.

mmm, i don't think so.  the input alignment (inputskip) is entirely irrelevant 
to the output.

as for inputsize, we already do that check.  if you read the code further 
(like 5 lines below the diff here), you'll see the --pad flag handling.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20130509/bc2d24e0/attachment.sig>


More information about the linux-mtd mailing list