This is the mail archive of the ecos-patches@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: RAMFS fixes: file permissions and lseek()


On Thu, Sep 29, 2005 at 02:50:47PM -1000, Dan Jakubiec wrote:
> Attached for your review is a patch for the RAMFS filesystem which 
> addresses the following items:
> 
>    2005-05-29  Dan Jakubiec  <dan.jakubiec@systech.com>
> 
>        * src/ramfs.c:
>        (ramfs_mount, ramfs_open, ramfs_mkdir) Changed the permissions
>    for files
>        and directories created on RAMFS filesystems from 000 to 777. 
>    This helps
>        applications which check for the existence of certain file
>    permissions.

OK. But i really thing it is the application which is broken. eCos has
no concept of filesystem security, there is no way to set permissions,
owners, groups etc. So any application which uses this is probably
broken.

>  (ramfs_fo_write, ramfs_fo_lseek) Fixed the RAMFS implementation of
> lseek() to make it POSIX-compliant.  The previous implementation did
> not handle lseek()'s beyond the EOF.

I fixed this differently, in a more efficient way. For the default
"SIMPLE" allocation mechanism, there was already a memzero setting the
contents to zero. It just needed tweeking a little. For the "BLOCK"
allocation mechanism i implemented true holes. So you can do something
like

fd = open("foobar", O_RDWR);
lseek(fd, 1024*1024, SEEK_SET);
write(fd, '1', 1);

and it will only allocation one 256 byte block, not a megabyte.

I also extended the current test case for lseek so that it tests this
new functionality. The code already existied in the jffs2 test cases,
so this was trivial.

        Andrew

Attachment: fs.ramfs.holes.diff
Description: Text document


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