[PATCH 6/6] [MTD-UTILS] nandwrite: Add Support for Reading from Standard Input
ladis at linux-mips.org
Mon Sep 8 17:02:27 EDT 2008
On Mon, Sep 08, 2008 at 09:36:52AM -0700, Grant Erickson wrote:
> On 9/8/08 9:14 AM, Ladislav Michl wrote:
> > So what about:
> > while (not eof)
> > read page (and oob if selected) data into buffer
> What about a short read in which you only get part of a page or a whole page
> and part of the OOB data? Bail out? Best effort?
Simply loop reading (assuming blocking read) until
- read whole buffer (read returns something greater than zero) or
- read returns zero (end of file) and then pad buffer or
- read returns -1 and then bail out gracefully with strerror
printed to user.
> > next:
> > if (write buffer fails)
> > mark bad, select next page, goto next
> > Reading from stdin would imply padding. Care to implement that?
> For the time being, padding must be explicitly requested.
Yes, I'm just suggesting to enable it for stdin input as it IMHO makes
sense namely with buffering described above.
> > PS: It is remotely possible that one day I do it myself, but I'm
> > notoriously slow on doing things I do not urgently need.
> Understood and agreed.
> For the present, the patch satisfies my cited use case (clearly those of
> Richard and hopefully those of Tommi) and given the value added, I'd
> advocate its inclusion and incremental evolution through future patches.
Sure, I cannot raise single complain against patch as I do not offer
anything better. I just merely pointed to possible solution.
More information about the linux-mtd