From cdbd1630bb9ae6f7aed716c823de6366f7e1bcec Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 18 May 2012 17:07:30 +0200 Subject: [PATCH] Allow defining ram_fs file content from config --- os/src/server/ram_fs/README | 10 +++++++--- os/src/server/ram_fs/main.cc | 10 ++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/os/src/server/ram_fs/README b/os/src/server/ram_fs/README index 4a59890446..d2f441eb85 100644 --- a/os/src/server/ram_fs/README +++ b/os/src/server/ram_fs/README @@ -18,8 +18,9 @@ The following configuration illustates the way of how to express policy. ! ! ! -! -! +! +! set hidden +! ! ! ! @@ -33,7 +34,10 @@ The '' sub node of the '' node provides a way to pre-populate the file system with directories and files. Note that '' nodes can be arbitrarily nested. Files can be loaded from the ROM service. By adding the optional 'at' attribute to a rom node, the file name can be defined -independently from the ROM module name. +independently from the ROM module name. In addition to creating files from +ROM modules, files can be created from data specified directly as part of the +configuration using '' nodes. The content of such nodes is used as +file content as is. Session-specific access-control policy is expressed via one or more '' nodes. At session-creation time, each policy node is matched against the label diff --git a/os/src/server/ram_fs/main.cc b/os/src/server/ram_fs/main.cc index ba05f96928..f68fb9a66d 100644 --- a/os/src/server/ram_fs/main.cc +++ b/os/src/server/ram_fs/main.cc @@ -598,6 +598,16 @@ static void preload_content(Genode::Allocator &alloc, catch (Rm_session::Attach_failed) { PWRN("Could not locally attach ROM file \"%s\"", (char *)name); } } + + /* + * Create file from inline data provided as content of the XML node + */ + if (sub_node.has_type("inline")) { + + File *file = new (&alloc) File(alloc, name); + file->write(sub_node.content_addr(), sub_node.content_size(), 0); + dir.adopt_unsynchronized(file); + } } }