Re: ubiupdatevol from pipe/compressed file

Artem Bityutskiy
2008-06-27T14:40:17Z

> On Mon, May 19, 2008 at 11:54:01AM +0300, Artem Bityutskiy wrote:
> > On Mon, 2008-05-19 at 18:47 +1000, Hamish Moffatt wrote:
> > > Alternatively allow the uncompressed file size to be specified as a
> > > ubiupdatevol parameter. In my application I can store the uncompressed
> > > file size and provide it to ubiupdatevol ok.
> >
> > Yeah, I think it is reasonable to add one more option and pass the size
> > there. Then it could be easy to teach ubiupdatevol to read the specified
> > amount of bytes from stdin.
>
> Here's a patch for ubiupdatevol. It contains 3 changes;
>
> 1. Adds -s/--size switch;
> 2. Allows the image file to be specified as '-', meaning stdin; if used,
> the size must be specified.
>
> 3. In ubi_update_volume(), the code assumed that a read() requesting a
> whole LEB worth of data would always return the amount requested.
> However read() is allowed to return less than that, and does in some
> cases eg reading from a pipe. I modified it to call read() in a loop
> until it had a whole LEB worth of data.

You didn't send this N3 change, so I did this (and few more minor
tewaks) and pushed your patch, thanks.