remove 'filename' from ROM sesion args

Conveying the ROM filename as the final label element simplifies
routing policy and session construction.

Annotations by nfeske:

This commit also changes the ROM session to use base/log.h instead of
base/printf.h, which produced build error of VirtualBox because the
vbox headers have a '#define Log', which collides with the content of
base/log.h. Hence, this commit has to take precautions to resolve this
conflict.

The commit alse refines the previous session-label change by adding a
new 'Session_label::prefix' method and removing the use of 'char const *'
from this part of the API.

Fixes #1787
This commit is contained in:
Emery Hemingway
2016-05-12 14:58:51 +02:00
committed by Norman Feske
parent f8337b511b
commit 2b8c1af9e0
28 changed files with 209 additions and 168 deletions

View File

@ -9,7 +9,7 @@
*/
/*
* Copyright (C) 2015 Genode Labs GmbH
* Copyright (C) 2015-2016 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.
@ -23,6 +23,7 @@
#include <linux_dataspace/linux_dataspace.h>
#include <util/arg_string.h>
#include <root/root.h>
#include <base/session_label.h>
/* local includes */
#include "dataspace_component.h"
@ -32,12 +33,12 @@ using namespace Genode;
Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
{
Filename fname;
Arg_string::find_arg(args, "filename").string(fname.buf,
sizeof(fname.buf), "");
Session_label const label = label_from_args(args);
Linux_dataspace::Filename fname;
strncpy(fname.buf, label.last_element().string(), sizeof(fname.buf));
/* only files inside the current working directory are allowed */
for (const char *c = fname.buf; *c; c++)
for (const char *c = fname.buf; *c; ++c)
if (*c == '/') throw Root::Invalid_args();
return fname;