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]

Re: RAMFS problem


Richard Panton wrote:
> [ramfs problems]
> 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.

It took me a while to psych myself up to look at this. And now my head
hurts too :-). But yes I agree with you - that's exactly what's required
from what I can tell.

> (Also, at line 726, shouldn't that be:
> 
> if ( bi >= nblocks )
> 
> rather than
> 
> if ( bi > nblocks )
> 
> ?????)

Yep.
 
> There's probably a similar sort of fix required in findbuffer_indirect2(),

Exactly the same I believe, i.e. * CYGNUM_RAMFS_BLOCK_SIZE.

> but my head hurts enough already after trying to trace this through....

I now know why :).
 
> Nick, your name's on this one...

Nick's on holiday. I've checked in the changes as described.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/


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