fopen() in Genode?

Norman Feske norman.feske at ...1...
Tue Feb 14 21:40:34 CET 2012


Hello Sam,

> How can I use fopen() and write a file to disk? When I run the function
> below:
...
> I get the error:
> 
> 	no plugin found for open("temp", int)
> 
> Can anyone offer some advice?

on Genode, there is no global file system where to fetch files from.
Instead, there may be a variety of different sources. For example, ROM
files provided by core, or files stored on a CDROM image with an ISO9600
file system. To accommodate this variety of options, our libc offers a
plugin mechanism that allows different back ends to manage specific file
handles. When using the libc with no plugin, you are prompted with the
message you just got. It tells us that no plugin showed any interest in
caring for the specified file "temp".

If you want to work with files stored on a VFAT-formatted block device,
you will find the libc_ffat plugin useful. It uses the ffat library as
file-system implementation. You can download this library from within
the libports repository via

  cd libports
  make prepare PKG=ffat

For a quick test, I recommend you to try out the run script
'libports/run/libc_ffat.run'. You can execute it directly from the build
directory by issuing

  make run/libc_ffat

This run script will build and execute a test case that exercises file
operations such as reading, writing, and some directory operations. See
the code at 'libports/src/test/libc_ffat/main.cc' for the details.

For accessing ROM files (such as those provided by core or the iso9660
server) via libc file functions, I have just recently added a new
'libc_rom' plugin. It is not merged to master yet. But you can get it
from the staging branch:


https://github.com/genodelabs/genode/commit/54cb49583b47139c48b08f53d06b25eb1474a881

I hope these pointers will be helpful. Good luck!

Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list