This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: RAMFS problem
- To: Richard Panton <rpanton at 3glab dot com>
- Subject: Re: [ECOS] RAMFS problem
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Thu, 26 Jul 2001 06:44:15 +0100
- Cc: ecos discussion list <ecos-discuss at sources dot redhat dot com>
- Organization: Red Hat UK Ltd.
- References: <Pine.LNX.4.33.0107201738360.1401-100000@rpanton.3glab.com>
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/