Using the tmpfs library

Adam Lackorzynski adam at os.inf.tu-dresden.de
Thu Aug 1 23:30:20 CEST 2013


Hi,

On Thu Aug 01, 2013 at 10:43:58 +0200, Michael Weiß wrote:
> I want to do some file operations in a native l4re application.
> using fopen, fgetc, fprintf... from libc. I know that this is possible
> for the rom filesystem. However, I want to create new files during
> runtime which are also writable.
> I found the VFS implementation l4/pkg/tmpfs.
> but I do not really understand how that VFS stuff works, as there also
> is no header file for tmpfs. How can I access the tmpfs functionality
> within my application?
> 
> For my application it would be sufficient to just have
> temporary files, which I think is exactly what the tmpfs lib provides.
> 
> I already linked the tmpfs lib to my application and
> tried to use mount from sys/mount.h.
> However, I have no idea which parameters and how the path than has to
> look like for fopen.
> 
> Is there some example code which shows howto use this lib in an
> application?

Just mounting it is the right approach:

  mount("none", "tmp", "tmpfs", 0, 0);

Then you should be able to create files/dirs in /tmp/, just with open
etc.



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list