[Yaffs] [Yaffs-archive] YAFFS: fix for reading holes

Charles Manning manningc2@actrix.gen.nz
Fri, 7 Nov 2003 09:38:08 +1300


Hi YAFFSers

James found another ugly to do with reading holes, a one liner, now fixed in 
CVS.

The problem was as follows: If you create a new file and lseek off the end of 
the file and write, then you end up with holes in the file (ie. there is no 
physical media used for the unwritten parts of the file). Good so far.

If you then lseek to one of these holes and read, you get undefined data. I 
always thought the reads were undefined, but POSIX wants these to read zeros.
It was easy enough to fix: just memset to 0 the buffer for any reads where a 
NAND page is not found.

Thanx James.

-- Charles

---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.