Menu

#5 EFSL CPU crashed in the ioman_releaseSector()

closed
nobody
None
5
2006-03-14
2006-01-20
nocciolone
No

Dear All

I'm using the EFSL 0.2.4 with a MMC card of the size
of 256Mbyte. I store 2 files of the following
dimension,

F1.MP3 1.518.245
F2.MP3 1.648.622

and I created the follwing test program

int main(void)
{
EmbeddedFileSystem efs;
EmbeddedFile file;
DirList list;
unsigned short i,e;
char buf[512];
unsigned char file_name[13];

if(efs_init(&efs,"\\")!=0){
DBG(TXT("Could not open filesystem.\n"));
return(-1);
}

if (ls_openDir(&list, &(efs.myFs),
"/") != 0)
DBG(TXT("Could not open the selected
directory.\n"));

DBG(TXT("\n"));

while(ls_getNext(&list) == 0)
{
DBG(TXT("%.11s (%li bytes)\n",
list.currentEntry.FileName,
list.currentEntry.FileSize));

if ( (list.currentEntry.FileName[8] == 'M')
&&
(list.currentEntry.FileName[9] == 'P') &&
(list.currentEntry.FileName[10] == '3') )
{

strncpy(file_name, list.currentEntry.FileName, 8);
file_name[8] = '.';
strncpy(&file_name[9],
&list.currentEntry.FileName[8], 3);
file_name[12] = '\0';

if(file_fopen(&file,&efs.myFs,file_name,'r')
==0)
{
file_fclose(&file);
}
else
DBG(TXT("Could not open file.\n"));

} /* if */
} /* While */

fs_umount(&(efs.myFs));
return(0);
}

When the program opens the second file, the
file_fopen function creates a CPU exception.

Debugging the library I discovered that the function
ioman_getBp:

esint16 ioman_getBp(IOManager *ioman,euint8* buf)
{
if(buf<(ioman->bufptr) || buf>=( ioman-
>bufptr+(ioman->numbuf*512) )){
ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
return(-1);
}
return((buf-(ioman->bufptr))/512);
}

returns with -1

Anybody can suggest a way for an additional test in
my code ?

Thank you
Paolo

By: Lennart - lennartyseboodt
RE: iomanager error return code during file o
2005-12-23 01:26
Hi,

I'll test this code tomorrow, could you post it some
where as txt file ? sf seems to garble most of the
special characters :/

Regards,

Lennart

By: nocciolone - nocciolone
RE: iomanager error return code during file open
2005-12-23 16:56
Ehi,

News on the above problem
I did more test and can confirm the problem

1) Only FAT32 mode is affected. FAT16 seams to work
well

2) The order in which the files are stored in the
file system seams important. For example if I format
the MMC with my laptop and then I store 3 files, I
can detect the OpenFile fault in third file, than I
delete the first file, and the fault moves in the
second file.

In all cases the function

esint16 ioman_getBp(IOManager *ioman,euint8* buf)
{
if(buf<(ioman->bufptr) || buf>=(
ioman->bufptr+(ioman->numbuf*512) )){
ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
return(-1);
}
return((buf-(ioman->bufptr))/512);
}

return with -1

For your info the function ioman_getBp is called by
the function

ioman_releaseSector(IOManager *ioman,euint8* buf)

If you need more info/test to detect the problem,
please let me know

Bye Paolo

Sorry but I found the same problem also in the FAT
file system

Discussion

  • nocciolone

    nocciolone - 2006-01-20

    Test file

     
  • nocciolone

    nocciolone - 2006-01-28

    Logged In: YES
    user_id=1366989

    sorry, but only fat32 is effected, forget my previous note
    related to fat16

     
  • Mike Anton

    Mike Anton - 2006-03-10

    Logged In: YES
    user_id=1471492

    See my fix in request ID #1446097 for a solution that you
    can try for this problem.

    Thanks,

    Mike Anton

     
  • Mike Anton

    Mike Anton - 2006-03-10

    Logged In: YES
    user_id=1471492

    See my fix in request ID #1446097 for a solution that you
    can try for this problem.

    Thanks,

    Mike Anton

     
  • Lennart

    Lennart - 2006-03-14
    • status: open --> closed
     
  • Lennart

    Lennart - 2006-03-14

    Logged In: YES
    user_id=1223110

    Although not confirmed, this bug is probably related to the
    other file_fopen bug, I'm closing it since it's fixed.

    If you encounter it again, simply reopen it or make a new
    report.

     

Log in to post a comment.