genode/repos/libports/include/libc-plugin/vfs.h
Josef Söntgen 2bf67136c6 libc: add support for external vfs file systems
These file systems are provided on-demand by loading a shared library
when the fstab node is traversed. By convention this library is named
after the file system it provides. For example a file system that
provides a 'random' file system node is called 'vfs_random.lib.so'. It
is still possible to give the the node another name in the vfs. The
following code snippts illustrates this matter:

! [...]
! <config>
!   <libc>
!     <vfs>
!       <dir name="dev"> <jitterentropy name="random"/> </dir>
!     </vfs>
!   </libc>
! </config>
! [...]

Here the jitterentropy file system, implemented in
'vfs_jitterentropy.lib.so' provides a file system node named 'random'
in the 'dev' directory. When traversing the vfs section the libc will
try to load 'vfs_jitterentropy.lib.so' but programs may access the
file system only via '/dev/random'.

Fixes #1240.
2014-08-22 16:16:41 +02:00

40 lines
835 B
C++

/*
* \brief vfs plugin interface
* \author Josef Soentgen
* \date 2014-08-19
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _LIBC_PLUGIN__VFS_H_
#define _LIBC_PLUGIN__VFS_H_
/* Genode includes */
#include <vfs/file_system.h>
#include <util/xml_node.h>
namespace Libc {
struct File_system_factory;
typedef Libc::File_system_factory*(*File_system_factory_func)(void);
}
struct Libc::File_system_factory
{
char const * const name;
File_system_factory(char const *name) : name(name) { }
virtual Vfs::File_system *create(Genode::Xml_node node) = 0;
virtual bool matches(Genode::Xml_node node) const {
return node.has_type(name); }
};
#endif /* _LIBC_PLUGIN__VFS_H_ */