Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: disk write testing

Re: disk write testing

From: Greg Haerr <greg_at_censoft.com>
Date: Sun, 3 Nov 2002 18:43:33 -0700

> 1) Fix the current code so it passes all tests in test.sh

Bjorn,
Attached is a patch that fixes an off-by-one error in the
simulator disk writing code, firmware/test/fat/main.c. The
tests now run with a 4-sector clustersize but fail with 1-sector
cluster size. (I thought that easier to debug when set for
a 1-to-1 sectorsize to clustersize mapping.) The problem
is exacerbated when the test.sh script deletes files inbetween
the 50x70k file creation. In any case, this should allow you
to continue debugging the filesystem code.

Now that I'm familiar with the entire file/dir/fat code, it
seems that it might be a bit unnecessarily complicated, with
buffers kept in the filedesc structure, as well as in static
buffers fat_cache and lastsector{2}. I personally think
a redesign where _all_ buffers are kept at a layer just above
the ata_{read,write}_sector layer and allowing the file open/read/write
code to access them would make things alot simpler, and
tunably smaller. With that design, it would be easy for any code
to get direct access to a sector buffer, whether it be for dirent
writing, FAT updating, or cached open file reading/writing. These
cases are handled klugily now.

Also, the code is not set up properly to update access times on
reading, nor record file size in bytes for writing. There could be
matching fat_open/creat/read/write/seek/close/unlink/mkdir for
each of the same calls at the Clib i/o level. The upper level calls
could use the lower-level fat_xxx structs and buffer_ structs
without having to define/duplicate certain items, like cache location.

Regards,

Greg




2) Change the dir code in fat.c to use fat_read/fat_write instead of the current
custom code

4) Add fat_mkdir()

5) Add long filename support

6) Make fat_write() use multi-sector writes

7) Merge fat_read() and fat_write(), if it's still meaningful.

Each step adds new tests to test.sh that must be passed before progressing to
the next step.

--
Björn

  • application/octet-stream attachment: fat.patch
Received on 2002-11-04

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy