rump_fs: support the access of GEMDOS file systems

The GEMDOS variant is supported by NetBSD's msdos file-system driver.
However, it must explicitly be enabled by a mount flag. This patch
adds the principle ability for passing mount flags to file system
drivers and enables the MSDOSFSMNT_GEMDOSFS flag based on the
config attribute 'gemdos="yes"'.

Issue #3471
This commit is contained in:
Norman Feske 2019-08-09 20:52:18 +02:00 committed by Christian Helmuth
parent ceae637416
commit 114de7721f
2 changed files with 42 additions and 32 deletions

View File

@ -2,16 +2,18 @@
Genode's Rump Kernel kernel port Genode's Rump Kernel kernel port
================================ ================================
This repository contains the Genode version of the [http://wiki.netbsd.org/rumpkernel/ - rump kernel]. This repository contains the Genode version of the
The kernel is currently used to gain file-system access from within Genode. In [http://wiki.netbsd.org/rumpkernel/ - rump kernel].
order to achieve that, a Genode file-system server is located at The kernel is currently used to gain file-system access from within Genode.
_src/server/rump_fs_. For accessing the server through the libc, the _libc_fs_ In order to achieve that, the rump kernel is integrated into a VFS plugin,
plugin can be facilitated, which is available in the _libports_ repository. located at _src/lib/vfs/rump_. It can thereby by used directly by libc
applications, or indirectly by using the VFS-server component.
Building instructions Building instructions
##################### #####################
In order to build the file-system server, issue In order to build the VFS plugin, issue
! ./tool/ports/prepare_port dde_rump ! ./tool/ports/prepare_port dde_rump
@ -26,32 +28,27 @@ to your _etc/build.conf_ file of you build directory.
Finally, Finally,
! make server/rumps_fs ! make lib/vfs/rump
called from your build directory will build the server. You may also specify called from your build directory will build the plugin.
! make run/rump_ext2
to run a simple test scenario.
Configuration Configuration
############# #############
Here is an example snippet that configures the server: Here is an example snippet that configures the VFS plugin:
!<start name="rump_fs"> | <rump fs="msdos" ram="7M" writeable="yes"/>"
! <resource name="RAM" quantum="8M" />
! <provides><service name="File_system"/></provides>
! <config fs="ext2fs"><default-policy root="/" writeable="yes"/></config>
!</start>
The server is looking for a service that provides a Genode block session. If The VFS plugin obtains a block session. If there is more than one block
there is more than one block session in the system, the block session must be session in the system, the block session must be routed to the right
routed to the right block-session server. The value of the _fs_ attribute of block-session server. The value of the _fs_ attribute can be one of the
the _config_ node can be one of the following: _ext2fs_ for EXT2, _cd9660_ for following: _ext2fs_ for EXT2, _cd9660_ for ISO-9660, or _msdos_ for FAT
ISO-9660, or _msdos_ for FAT file-system support. _root_ defines the directory file-system support. When accessing a _msdos_ file system, the optional
of the file system as seen as root directory by the client. The server hands attribute 'gemdos="yes"' can be specified to operate in GEMDOS compatibility
most of its RAM quota to the rump kernel. This means the larger the quota is, mode.
the larger the internal block caches of the rump kernel will be.
The VFS plugin hands over the specified amount of RAM quota to the rump
kernel. The larger the quota is, the larger the internal block caches of the
rump kernel will be.

View File

@ -342,16 +342,23 @@ class Vfs::Rump_file_system : public File_system
} }
}; };
/** /*
* We define our own fs arg structure to fit all sizes, we assume that 'fspec' * Must fit 'struct msdosfs_args' and 'struct ufs_args'. Needed to
* is the only valid argument and all other fields are unused. * pass mount flags the file-system drivers.
*/ */
struct fs_args struct fs_args
{ {
char *fspec; char *fspec;
char pad[164];
fs_args() { Genode::memset(pad, 0, sizeof(pad)); } /* unused */
struct export_args30 _pad1;
uid_t _uid;
gid_t _gid;
mode_t _mask;
int flags;
char _pad[164];
}; };
static bool _check_type(char const *type) static bool _check_type(char const *type)
@ -403,7 +410,13 @@ class Vfs::Rump_file_system : public File_system
} }
/* mount into extra-terrestrial-file system */ /* mount into extra-terrestrial-file system */
struct fs_args args; struct fs_args args { };
if (fs_type == "msdos" && config.attribute_value("gemdos", false)) {
enum { MSDOSFSMNT_GEMDOSFS = 8 };
args.flags |= MSDOSFSMNT_GEMDOSFS;
}
int opts = config.attribute_value("writeable", true) ? int opts = config.attribute_value("writeable", true) ?
0 : RUMP_MNT_RDONLY; 0 : RUMP_MNT_RDONLY;