summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-03-04 13:50:23 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-03-04 13:50:23 +0000
commit16d1a68b331676b06d37b998363ab722666f3dae (patch)
tree738b6ec2ed70e8736ef9f94eb7b4471b1e0f4b61 /firmware
parent2573879fb13c1544ec0e07f6ce1da1d45f3d97a7 (diff)
update_fat_entry() set the wrong cache line dirty if bpb_resvdseccnt wasn't divisible by 32 (didn't compensate for the reserved sector count)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3379 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/fat.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index f41f039380..cfff3e869c 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -457,11 +457,6 @@ static int bpb_is_sane(void)
fat_bpb.bpb_bytspersec * fat_bpb.bpb_secperclus);
return -2;
}
- if (fat_bpb.bpb_rsvdseccnt != 32)
- {
- DEBUGF( "bpb_is_sane() - Warning: Reserved sectors is not 32 (%d)\n",
- fat_bpb.bpb_rsvdseccnt);
- }
if(fat_bpb.bpb_numfats != 2)
{
DEBUGF( "bpb_is_sane() - Warning: NumFATS is not 2 (%d)\n",
@@ -602,7 +597,7 @@ static int update_fat_entry(unsigned int entry, unsigned int val)
DEBUGF( "update_entry() - Could not cache sector %d\n", sector);
return -1;
}
- fat_cache[sector & FAT_CACHE_MASK].dirty = true;
+ fat_cache[(sector + fat_bpb.bpb_rsvdseccnt) & FAT_CACHE_MASK].dirty = true;
if ( val ) {
if (!(SWAB32(sec[offset]) & 0x0fffffff))
@@ -1443,7 +1438,6 @@ int fat_rename(struct fat_file* file,
return 0;
}
-
static int next_write_cluster(struct fat_file* file,
int oldcluster,
int* newsector)
@@ -1467,7 +1461,7 @@ static int next_write_cluster(struct fat_file* file,
update_fat_entry(oldcluster, cluster);
else
file->firstcluster = cluster;
- update_fat_entry(cluster, FAT_EOF_MARK);
+ update_fat_entry(cluster, FAT_EOF_MARK);
}
else {
#ifdef TEST_FAT
@@ -1611,7 +1605,6 @@ int fat_seek(struct fat_file *file, unsigned int seeksector )
clusternum = seeksector / fat_bpb.bpb_secperclus;
sectornum = seeksector % fat_bpb.bpb_secperclus;
-
for (i=0; i<clusternum; i++) {
cluster = get_next_cluster(cluster);
if (!cluster) {