Rockbox

  • Status Closed
  • Percent Complete
    0%
  • Task Type Bugs
  • Category
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Anonymous Submitter - 2002-06-16
Last edited by zagor - 2002-06-17

FS#55 - FAT start address

Hello!

I have been snooping around your code to look at the
reusability it, and found one error in the FAT calulation.
The FAT start sector was not included in these
calculations.
In my case, the FAT looked corrupt.
The first cluster could be read(since the fileentry
contains the location of the first sector), but as soon as
the next cluster had checked inside the FAT, it failed.
By making the below adjustment, I could get it running:

fat.c:

static int read_entry(int entry)
{

  unsigned long *sec;
  int fatoffset;
  int thisfatsecnum;
  int thisfatentoffset;
  int val = -1;
  fatoffset = entry * 4;

OLD
*/
thisfatsecnum = fatoffset / fat_bpb.bpb_bytspersec +
fat_bpb.bpb_rsvdseccnt;
*/
NEW

 thisfatsecnum = (fatoffset / fat_bpb.bpb_bytspersec) + 

fat_bpb.bpb_rsvdseccnt + fat_bpb.startsector ;
// END

  thisfatentoffset = fatoffset % fat_bpb.bpb_bytspersec;
  /* Load the sector if it is not cached */
  sec = cache_fat_sector(thisfatsecnum);
  if(!sec)
  {
      DEBUGF( "read_entry() - Could not cache sector %

d\n”,

              thisfatsecnum);
      return -1;
  }
  val = sec[thisfatentoffset/sizeof(int)];
  val = SWAB32(val);
  
  return val;

}

I disabled the FAT caching for me to get all this running.

Well, thats my contribution. Great project you are doing!

Mike.

Closed by  zagor
2002-06-17 09:22
Reason for closing:  
Project Manager
zagor commented on 2002-06-17 09:22

This is not a bug.

'startsector' is used in the cache_fat_sector() function, so
it should not be added to 'thisfatsecnum'. Only if you
disable caching will you need to change this code.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing