This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
JFFS2 broken
- From: eibach at gdsys dot de
- To: ecos-discuss at ecos dot sourceware dot org
- Date: 26 Mar 2004 09:56:30 UT
- Subject: [ECOS] JFFS2 broken
Hello,
I am clueless about a problem in JFFS2.
When I set the cursor to a point in a file (using e.g. fseek) and perform a write there, the file seems to be truncated to that size. But that happens only after the file is written to flash, not when I am reading from the cache.
Here is a little code to reproduce that:
if (( fp = fopen(FILEN, "w")) == NULL) {
diag_printf("fault\n");
}
else {
char c = 0;
for (int k=0; k < 4096; ++k)
fwrite(&c, 1, 1, fp);
stat = fseek(fp, 512, SEEK_SET);
fputs("End\n", fp);
fclose(fp);
}
After a reboot you can see, that the file size is only 522 bytes and not 4096 as it should be. When I use RAMFS instead it works fine.
Something is very badly wrong with fseek and JFFS2. Does noone beside me use that function?
Any hints are appreciated.
Regards,
Dirk
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss