[ECOS] JFFS2 broken

eibach@gdsys.de eibach@gdsys.de
Fri Mar 26 09:58:00 GMT 2004


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) {
	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);

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.


Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list