This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: JFFS2 lseek
- From: Andrew Lunn <andrew at lunn dot ch>
- To: eibach at gdsys dot de
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Tue, 23 Mar 2004 12:53:25 +0100
- Subject: Re: [ECOS] JFFS2 lseek
- References: <DIIE.00000ECB00069EBE@gdproxy2.gdsys.de>
On Tue, Mar 23, 2004 at 10:30:53AM +0000, eibach@gdsys.de wrote:
> Hello,
>
> The The Single UNIX ? Specification, Version 2 states the following about the lseek function:
>
> "The lseek() function will allow the file offset to be set beyond the end of the existing data in the file. If data is later written at this point, subsequent reads of data in the gap will return bytes with the value 0 until data is actually written into the gap."
>
> The code in jffs2_fo_lseek contains the following:
>
> // Check that pos is still within current file size, or at the
> // very end.
> if (pos < 0 || pos > node->i_size)
> return EINVAL;
>
> So it seems lseek() does not allow to set the offset beyond the current end of file. Is that correct or am I getting something wrong?
> Any suggestions how this could be fixed?
The design document about jffs2, sources.redhat.com/jffs2/jffs2.pdf,
says that jffs2 supports holes in files and seeking past the end
etc. So the underlying filesystem should be happy.
So either this was an oversight when writing the eCos layer, or the
eCos layer itself has a problem with holes.
What i suggest is remove the check and test it. It would be good if
you added tests to the standard eCos test in
packages/fs/jffs2/current/tests as that we have a regression test for
future development of the jffs2 package.
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