This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RAMFS problem


It seems that ramfs is failing for files bigger than 0x8800 bytes (using
the default configuration).

When the fault occurs:
	All 8 direct blocks are full.
	The indirect block points to:
		All 64 direct pointers used.
	The indirect2 block points to:
		Indirect block points to:
			All 64 direct pointers used.

When an attempt is made to write to node->indirect2->indirect[1]->data, a
data fault occurs.

I think to fix this requires a change to findbuffer_indirect1():
Index: ramfs.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/ram/current/src/ramfs.c,v
retrieving revision 1.1
diff -r1.1 ramfs.c
777c777
<     err = findbuffer_direct( bi,
---
>     err = findbuffer_direct( bi * CYGNUM_RAMFS_BLOCK_SIZE,

===================================================================

Without the multiplier, bi (used here as an offset rather than a block
number) can range from 0 to CYGNUM_RAMFS_BLOCK_SIZE - 1

This ALWAYS falls inside the first (indirect) block, so the reference
later on in the function to blocks[bi] refers to an unassigned block.

(Also, at line 726, shouldn't that be:

if ( bi >= nblocks )

rather than

if ( bi > nblocks )

?????)

There's probably a similar sort of fix required in findbuffer_indirect2(),
but my head hurts enough already after trying to trace this through....

Nick, your name's on this one...

Best Regards,
Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]