This is the mail archive of the ecos-discuss@sourceware.org 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]
Other format: [Raw text]

Re: fseek on JFFS2


On Fri, Sep 22, 2006 at 03:25:09PM +0200, Andrew Lunn wrote:
> On Fri, Sep 22, 2006 at 02:26:30PM +0200, Paluch Sebastian wrote:
> > hi,
> > here you have some test file 'fseek_test.c', and my output.
> 
> I tried running the code on the ramfs. It also fails there as
> well. Attached is the code.

Hi Sebastian

I spent some time looking at this yesterday. There is definitely a
problem with the stdio stream implementation of buffered IO. The file
position as kept by the stream layer and the file system get out of
sync and so writes are made to the wrong position. 

What i don't understand is how it is supposed to work. The stream
layer does not make any lseek()s when reading/writing blocks to the
file system. It seems to assume that synchronisation will just be
kept.  When just doing simple linear fread()s or linear fwrite()s
maybe this is true, but as soon as you start fseek()ing around this
does not hold. Either i'm missing something in how the code is
supposed to work, or maybe the basic design did not implement fseek()
and it was incorrectly added later?

Jifl, this seems to be your code. I know you wrote it a long time ago,
but do you remember how this is supposed to work?

    Thanks
        Andrew

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


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