Add nand_fileio_* helper APIs.
authorZachary T Welch <zw@superlucidity.net>
Sun, 8 Nov 2009 10:06:34 +0000 (02:06 -0800)
committerZachary T Welch <zw@superlucidity.net>
Mon, 16 Nov 2009 09:38:19 +0000 (01:38 -0800)
commit23cc85b307de80be089dcb0048dbb6168e59651a
tree34c8483d1a694b4660bc0ba4ed67f101e296a60d
parent45527ee82c9e7c93b29b79f01f52d663960649c2
Add nand_fileio_* helper APIs.

This patch provides helpers APIs that will eliminate duplicated code in
the the NAND 'dump' and 'write' commands by factoring their common code
into static helper functions.  These helpers may be useful for creating
new commands, as shown in the final patch to 'verify' flash from a file.

Several previously unreported error conditions now generate messages and
propogate the return codes, such as when the file fails to open and bad
arguments are given.  These changes will fix a possible memory leak in
nand dump command, in the case that the dump file failed to open.

Overall, the changes should be functionally equivalent, but the
resulting code will be easier to improve and extend consistently.
src/flash/nand.c