mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
More detailed error codes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3605 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e4e466504d
commit
cc6183e73c
1 changed files with 10 additions and 8 deletions
|
|
@ -1481,7 +1481,7 @@ static int next_write_cluster(struct fat_file* file,
|
||||||
return cluster;
|
return cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool transfer( unsigned int start, int count, char* buf, bool write )
|
static int transfer( unsigned int start, int count, char* buf, bool write )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
@ -1497,9 +1497,9 @@ static bool transfer( unsigned int start, int count, char* buf, bool write )
|
||||||
DEBUGF( "transfer() - Couldn't %s sector %x"
|
DEBUGF( "transfer() - Couldn't %s sector %x"
|
||||||
" (error code %d)\n",
|
" (error code %d)\n",
|
||||||
write ? "write":"read", start, rc);
|
write ? "write":"read", start, rc);
|
||||||
return false;
|
return rc;
|
||||||
}
|
}
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1512,6 +1512,7 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
|
||||||
bool eof = file->eof;
|
bool eof = file->eof;
|
||||||
int first=0, last=0;
|
int first=0, last=0;
|
||||||
int i;
|
int i;
|
||||||
|
int rc;
|
||||||
|
|
||||||
LDEBUGF( "fat_readwrite(file:%x,count:0x%x,buf:%x,%s)\n",
|
LDEBUGF( "fat_readwrite(file:%x,count:0x%x,buf:%x,%s)\n",
|
||||||
file->firstcluster,sectorcount,buf,write?"write":"read");
|
file->firstcluster,sectorcount,buf,write?"write":"read");
|
||||||
|
|
@ -1560,8 +1561,9 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
|
||||||
if ( ((sector != first) && (sector != last+1)) || /* not sequential */
|
if ( ((sector != first) && (sector != last+1)) || /* not sequential */
|
||||||
(last-first+1 == 256) ) { /* max 256 sectors per ata request */
|
(last-first+1 == 256) ) { /* max 256 sectors per ata request */
|
||||||
int count = last - first + 1;
|
int count = last - first + 1;
|
||||||
if (!transfer( first + fat_bpb.startsector, count, buf, write ))
|
rc = transfer( first + fat_bpb.startsector, count, buf, write );
|
||||||
return -1;
|
if (rc < 0)
|
||||||
|
return rc * 10 - 1;
|
||||||
|
|
||||||
((char*)buf) += count * SECTOR_SIZE;
|
((char*)buf) += count * SECTOR_SIZE;
|
||||||
first = sector;
|
first = sector;
|
||||||
|
|
@ -1571,9 +1573,9 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
|
||||||
(!eof))
|
(!eof))
|
||||||
{
|
{
|
||||||
int count = sector - first + 1;
|
int count = sector - first + 1;
|
||||||
if (!transfer( first + fat_bpb.startsector,
|
rc = transfer( first + fat_bpb.startsector, count, buf, write );
|
||||||
count, buf, write ))
|
if (rc < 0)
|
||||||
return -2;
|
return rc * 10 - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
last = sector;
|
last = sector;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue