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
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2002-11-06


Greg Haerr wrote:
> I'll show you by submitting a patch that greatly cleans up the madness
> in file.c

Sounds good. I'm curious to see how you've solved it.

> Lseek shouldn't be mucking around performing data file i/o, other than
> chasing down the cluster chain (which doesn't work, see below).

Actually it does work. You seem to be reading old code.

> Why is seeksector decremented as the first statement?

Quoting the source:

    if (seeksector) {
        /* we need to find the sector BEFORE the requested, since
           the file struct stores the last accessed sector */
        seeksector--;
 
This behaviour was changed from how the fat code used to work. Before write was added, the fat_file struct stored nextsector. Now it stores lastsector.

The reason for the change is that we cannot store nextsector when writing, since it would mean allocating a new cluster before we know if we need one.

-- 
Björn



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa