os: removal of deprecated os/config.h (fix #2431)

This commit is contained in:
Stefan Kalkowski 2017-05-29 14:52:24 +02:00 committed by Christian Helmuth
parent dd214a8b15
commit 632ef28463
56 changed files with 354 additions and 660 deletions

View File

@ -1,3 +1,3 @@
TARGET = test-platform
SRC_CC = main.cc ipc.cc
LIBS = base-nova config
LIBS = base-nova

View File

@ -4,7 +4,7 @@
# These static libraries are filtered out when linking dynamically linked
# binaries.
#
BASE_LIBS += cxx timed_semaphore alarm config
BASE_LIBS += cxx timed_semaphore alarm
#
# Name of Genode's dynamic linker

View File

@ -1,3 +1,3 @@
TARGET = test-audio_in
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,7 +1,7 @@
LIB_DIR = $(REP_DIR)/src/lib/usb
LIB_INC_DIR = $(LIB_DIR)/include
LIBS += usb_include lx_kit_setjmp config
LIBS += usb_include lx_kit_setjmp
SRC_CC += main.cc lx_emul.cc storage.cc \
input_component.cc evdev.cc nic.cc raw.cc
SRC_C += dummies.c scsi.c raw_driver.c

View File

@ -28,6 +28,7 @@ class Driver : public Block::Driver
{
private:
Genode::Heap &_heap;
Block::Session::Operations _ops;
Genode::size_t _blk_sz;
Block::sector_t _blk_cnt;
@ -37,13 +38,13 @@ class Driver : public Block::Driver
public:
Driver(Genode::Entrypoint &ep, Genode::Ram_session &ram)
Driver(Genode::Env &env, Genode::Heap &heap)
:
Block::Driver(ram),
Block::Driver(env.ram()), _heap(heap),
_blk_sz(0), _blk_cnt(0), _cgd_device(0)
{
try {
_cgd_device = Cgd::init(Genode::env()->heap(), ep);
_cgd_device = Cgd::init(_heap, env);
} catch (...) {
Genode::error("could not initialize cgd device.");
throw Genode::Service_denied();
@ -62,7 +63,7 @@ class Driver : public Block::Driver
~Driver()
{
Cgd::deinit(Genode::env()->heap(), _cgd_device);
Cgd::deinit(_heap, _cgd_device);
}
bool _range_valid(Block::sector_t num, Genode::size_t count)

View File

@ -12,7 +12,7 @@
*/
/* Genode includes */
#include <os/config.h>
#include <base/attached_rom_dataspace.h>
/* repo includes */
#include <rump_cgd/cgd.h>
@ -164,9 +164,9 @@ namespace Cgd {
VALID_ENCODED_KEY_LEN = 48, /* length of 256Bit key */
};
Genode::Config &_cfg;
Action _action;
Params *_params;
Genode::Attached_rom_dataspace _cfg;
Action _action;
Params *_params;
/**
* Get action from config attribute
@ -177,8 +177,8 @@ namespace Cgd {
{
char action_val[ACTION_VALUE_LEN];
if (_cfg.xml_node().has_attribute("action"))
_cfg.xml_node().attribute("action").value(action_val, sizeof (action_val));
if (_cfg.xml().has_attribute("action"))
_cfg.xml().attribute("action").value(action_val, sizeof (action_val));
else
return ACTION_INVALID;
@ -224,8 +224,8 @@ namespace Cgd {
*/
void _parse_config()
{
if (_cfg.xml_node().has_sub_node("params")) {
Genode::Xml_node pnode = _cfg.xml_node().sub_node("params");
if (_cfg.xml().has_sub_node("params")) {
Genode::Xml_node pnode = _cfg.xml().sub_node("params");
char method_val[4];
pnode.sub_node("method").value(method_val, sizeof (method_val));
@ -270,9 +270,9 @@ namespace Cgd {
public:
Config()
Config(Genode::Env &env)
:
_cfg(*Genode::config()),
_cfg(env, "config"),
_action(_get_action()),
_params(0)
{
@ -444,7 +444,7 @@ Cgd::Device *Cgd::Device::configure(Genode::Allocator *alloc, Cgd::Params const
/**
* Initialize a new Cgd::Device
*/
Cgd::Device *Cgd::init(Genode::Allocator *alloc, Genode::Entrypoint &ep)
Cgd::Device *Cgd::init(Genode::Allocator &alloc, Genode::Env &env)
{
/* start rumpkernel */
rump_init();
@ -456,7 +456,7 @@ Cgd::Device *Cgd::init(Genode::Allocator *alloc, Genode::Entrypoint &ep)
throw Genode::Exception();
}
Cgd::Config cfg;
Cgd::Config cfg(env);
Cgd::Config::Action action = cfg.action();
@ -469,7 +469,7 @@ Cgd::Device *Cgd::init(Genode::Allocator *alloc, Genode::Entrypoint &ep)
if (!p)
throw Genode::Exception();
cgd_dev = Cgd::Device::configure(alloc, p, GENODE_DEVICE);
cgd_dev = Cgd::Device::configure(&alloc, p, GENODE_DEVICE);
break;
}
@ -495,7 +495,7 @@ Cgd::Device *Cgd::init(Genode::Allocator *alloc, Genode::Entrypoint &ep)
/**
* Deinitialize a Cgd::Device
*/
void Cgd::deinit(Genode::Allocator *alloc, Cgd::Device *dev)
void Cgd::deinit(Genode::Allocator &alloc, Cgd::Device *dev)
{
destroy(alloc, dev);

View File

@ -51,8 +51,8 @@ namespace Cgd {
};
Device *init(Genode::Allocator *alloc, Genode::Entrypoint &ep);
void deinit(Genode::Allocator *alloc, Device *dev);
Device *init(Genode::Allocator &alloc, Genode::Env &env);
void deinit(Genode::Allocator &alloc, Device *dev);
}
#endif /* _CGD_H_ */

View File

@ -27,20 +27,19 @@ struct Main
struct Factory : Block::Driver_factory
{
Genode::Entrypoint &ep;
Genode::Ram_session &ram;
Genode::Heap &heap;
Genode::Env &env;
Genode::Heap &heap;
Factory(Genode::Entrypoint &ep, Genode::Ram_session &ram, Genode::Heap &heap)
: ep(ep), ram(ram), heap(heap) { }
Factory(Genode::Env &env, Genode::Heap &heap)
: env(env), heap(heap) { }
Block::Driver *create() {
return new (&heap) Driver(ep, ram); }
return new (&heap) Driver(env, heap); }
void destroy(Block::Driver *driver) {
Genode::destroy(&heap, driver); }
} factory { env.ep(), env.ram(), heap };
} factory { env, heap };
Block::Root root { env.ep(), heap, env.rm(), factory };

View File

@ -1,5 +1,5 @@
TARGET = liquid_fb
LIBS = scout_widgets config
LIBS = scout_widgets
SRC_CC = main.cc services.cc
INC_DIR += $(REP_DIR)/src/app/scout \
$(REP_DIR)/src/server/framebuffer/sdl

View File

@ -1,4 +1,4 @@
TARGET = cpu_load_display
SRC_CC = main.cc
LIBS = base config
LIBS = base
INC_DIR += $(PRG_DIR)

View File

@ -92,26 +92,33 @@ static inline void load_stylesheet()
}
int main(int argc, char *argv[])
void Libc::Component::construct(Libc::Env &env)
{
Report_thread *report_thread;
try { report_thread = new Report_thread(); }
catch (...) {
Libc::with_libc([&] {
initialize_qpa_plugin(env);
int argc = 1;
char const *argv[] = { "mixer_gui_qt", 0 };
Report_thread *report_thread;
try { report_thread = new Report_thread(); }
catch (...) {
Genode::error("Could not create Report_thread");
return -1;
}
QApplication app(argc, argv);
load_stylesheet();
QMember<Main_window> main_window(env);
main_window->show();
report_thread->connect_window(main_window);
report_thread->start();
app.connect(&app, SIGNAL(lastWindowClosed()), SLOT(quit()));
exit(app.exec());
}
QApplication app(argc, argv);
load_stylesheet();
QMember<Main_window> main_window;
main_window->show();
report_thread->connect_window(main_window);
report_thread->start();
app.connect(&app, SIGNAL(lastWindowClosed()), SLOT(quit()));
return app.exec();
}

View File

@ -15,7 +15,6 @@
#include <base/log.h>
#include <mixer/channel.h>
#include <base/attached_rom_dataspace.h>
#include <os/config.h>
#include <os/reporter.h>
#include <rom_session/connection.h>
@ -434,7 +433,7 @@ void Main_window::report_changed(void *l, void const *p)
}
Main_window::Main_window()
Main_window::Main_window(Libc::Env &env)
:
_default_out_volume(0),
_default_volume(0),
@ -445,13 +444,14 @@ Main_window::Main_window()
using namespace Genode;
Attached_rom_dataspace config(env, "config");
try {
Xml_node config_node = config()->xml_node();
Xml_node config_node = config.xml();
_verbose = config_node.attribute("verbose").has_value("yes");
} catch (...) { _verbose = false; }
try {
Xml_node node = config()->xml_node().sub_node("default");
Xml_node node = config.xml().sub_node("default");
_default_out_volume = node.attribute_value<long>("out_volume", 0);
_default_volume = node.attribute_value<long>("volume", 0);
_default_muted = node.attribute_value<long>("muted", 1);

View File

@ -8,4 +8,4 @@ include $(QT5_REP_DIR)/src/app/qt5/tmpl/target_final.inc
main_window.o: main_window.moc
LIBS += config qoost qt5_component
LIBS += qoost qt5_gui qt5_widgets qt5_core libc

View File

@ -31,8 +31,14 @@ namespace Decorator {
class Decorator::Config
{
private:
Genode::Xml_node _config;
public:
Config(Genode::Xml_node node) : _config(node) {}
/**
* Return the base color of the window with the specified title
*/
@ -41,7 +47,7 @@ class Decorator::Config
Color result(0, 0, 0);
try {
Genode::Session_policy policy(title);
Genode::Session_policy policy(title, _config);
result = policy.attribute_value("color", result);
} catch (Genode::Session_policy::No_policy_defined) { }

View File

@ -101,7 +101,7 @@ struct Decorator::Main : Window_factory_base
Attached_rom_dataspace _config { _env, "config" };
Config _decorator_config;
Config _decorator_config { _config.xml() };
void _handle_config();

View File

@ -1,4 +1,4 @@
SRC_CC = init.cc plugin.cc
SRC_CC = plugin.cc
vpath %.cc $(REP_DIR)/src/lib/libc_lwip_nic_dhcp

View File

@ -39,7 +39,6 @@ set config {
<start name="test-python">
<resource name="RAM" quantum="3M"/>
<config>
<script name="hello.py"/>
<vfs>
<dir name="dev"> <log/> </dir>
<inline name="hello.py">
@ -57,6 +56,7 @@ print " \r\n\r";
</inline>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
<arg value="hello.py"/>
</config>
</start>
</config>

View File

@ -1,129 +0,0 @@
/*
* \brief lwip nic interface initialisation using DHCP
* \author Christian Prochaska
* \date 2010-04-29
*
*/
/*
* Copyright (C) 2010-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/log.h>
#include <parent/parent.h>
#include <os/config.h>
#include <nic/packet_allocator.h>
#include <util/string.h>
#include <lwip/genode.h>
extern "C" {
#include <lwip/sockets.h>
#include <lwip/api.h>
}
extern void create_lwip_plugin();
extern void create_etc_resolv_conf_plugin();
void __attribute__((constructor)) init_nic_dhcp(void)
{
enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 };
Genode::log(__func__);
bool provide_etc_resolv_conf = true;
char ip_addr_str[16] = {0};
char netmask_str[16] = {0};
char gateway_str[16] = {0};
genode_int32_t ip_addr = 0;
genode_int32_t netmask = 0;
genode_int32_t gateway = 0;
Genode::Number_of_bytes tx_buf_size(BUF_SIZE);
Genode::Number_of_bytes rx_buf_size(BUF_SIZE);
try {
Genode::Xml_node libc_node = Genode::config()->xml_node().sub_node("libc");
provide_etc_resolv_conf = libc_node.attribute_value("resolv", provide_etc_resolv_conf);
try {
libc_node.attribute("ip_addr").value(ip_addr_str, sizeof(ip_addr_str));
} catch(...) { }
try {
libc_node.attribute("netmask").value(netmask_str, sizeof(netmask_str));
} catch(...) { }
try {
libc_node.attribute("gateway").value(gateway_str, sizeof(gateway_str));
} catch(...) { }
try {
libc_node.attribute("tx_buf_size").value(&tx_buf_size);
} catch(...) { }
try {
libc_node.attribute("rx_buf_size").value(&rx_buf_size);
} catch(...) { }
/* either none or all 3 interface attributes must exist */
if ((strlen(ip_addr_str) != 0) ||
(strlen(netmask_str) != 0) ||
(strlen(gateway_str) != 0)) {
if (strlen(ip_addr_str) == 0) {
Genode::error("missing \"ip_addr\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (strlen(netmask_str) == 0) {
Genode::error("missing \"netmask\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (strlen(gateway_str) == 0) {
Genode::error("missing \"gateway\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
}
} else
throw -1;
Genode::log("static network interface: "
"ip_addr=", Genode::Cstring(ip_addr_str), " "
"netmask=", Genode::Cstring(netmask_str), " "
"gateway=", Genode::Cstring(gateway_str));
genode_uint32_t ip, nm, gw;
ip = inet_addr(ip_addr_str);
nm = inet_addr(netmask_str);
gw = inet_addr(gateway_str);
if (ip == INADDR_NONE || nm == INADDR_NONE || gw == INADDR_NONE) {
Genode::error("invalid network interface config");
throw -1;
} else {
ip_addr = ip;
netmask = nm;
gateway = gw;
}
}
catch (...) {
Genode::log("Using DHCP for interface configuration.");
}
/* make sure the libc_lwip plugin has been created */
create_lwip_plugin();
try {
lwip_nic_init(ip_addr, netmask, gateway,
(Genode::size_t)tx_buf_size, (Genode::size_t)rx_buf_size);
}
catch (Genode::Service_denied) { /* ignore for now */ }
if (provide_etc_resolv_conf)
create_etc_resolv_conf_plugin();
}

View File

@ -33,9 +33,34 @@
#include <string.h>
/* Genode includes */
#include <base/attached_rom_dataspace.h>
#include <base/env.h>
#include <base/heap.h>
#include <util/misc_math.h>
#include <base/log.h>
#include <parent/parent.h>
#include <nic/packet_allocator.h>
#include <util/string.h>
#include <lwip/genode.h>
#undef AF_INET6
#undef MSG_PEEK
#undef MSG_WAITALL
#undef MSG_OOB
#undef MSG_DONTWAIT
namespace Lwip {
extern "C" {
#include <lwip/sockets.h>
#include <lwip/api.h>
}
}
extern void create_lwip_plugin();
namespace {
@ -92,6 +117,8 @@ namespace {
{
private:
Genode::Constructible<Genode::Heap> _heap;
/**
* File name this plugin feels responsible for
*/
@ -134,14 +161,14 @@ namespace {
Libc::File_descriptor *open(const char *pathname, int flags)
{
Plugin_context *context = new (Genode::env()->heap()) Plugin_context;
Plugin_context *context = new (*_heap) Plugin_context;
context->status_flags(flags);
return Libc::file_descriptor_allocator()->alloc(this, context);
}
int close(Libc::File_descriptor *fd)
{
Genode::destroy(Genode::env()->heap(), context(fd));
Genode::destroy(*_heap, context(fd));
Libc::file_descriptor_allocator()->free(fd);
return 0;
}
@ -223,12 +250,104 @@ namespace {
default: Genode::error("fcntl(): command ", cmd, " not supported", cmd); return -1;
}
}
};
void init(Libc::Env &env) override
{
_heap.construct(env.ram(), env.rm());
enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 };
Genode::log(__func__);
char ip_addr_str[16] = {0};
char netmask_str[16] = {0};
char gateway_str[16] = {0};
genode_int32_t ip_addr = 0;
genode_int32_t netmask = 0;
genode_int32_t gateway = 0;
Genode::Number_of_bytes tx_buf_size(BUF_SIZE);
Genode::Number_of_bytes rx_buf_size(BUF_SIZE);
try {
Genode::Attached_rom_dataspace config(env, "config");
Genode::Xml_node libc_node = config.xml().sub_node("libc");
try {
libc_node.attribute("ip_addr").value(ip_addr_str, sizeof(ip_addr_str));
} catch(...) { }
try {
libc_node.attribute("netmask").value(netmask_str, sizeof(netmask_str));
} catch(...) { }
try {
libc_node.attribute("gateway").value(gateway_str, sizeof(gateway_str));
} catch(...) { }
try {
libc_node.attribute("tx_buf_size").value(&tx_buf_size);
} catch(...) { }
try {
libc_node.attribute("rx_buf_size").value(&rx_buf_size);
} catch(...) { }
/* either none or all 3 interface attributes must exist */
if ((strlen(ip_addr_str) != 0) ||
(strlen(netmask_str) != 0) ||
(strlen(gateway_str) != 0)) {
if (strlen(ip_addr_str) == 0) {
Genode::error("missing \"ip_addr\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (strlen(netmask_str) == 0) {
Genode::error("missing \"netmask\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
} else if (strlen(gateway_str) == 0) {
Genode::error("missing \"gateway\" attribute. Ignoring network interface config.");
throw Genode::Xml_node::Nonexistent_attribute();
}
} else
throw -1;
Genode::log("static network interface: "
"ip_addr=", Genode::Cstring(ip_addr_str), " "
"netmask=", Genode::Cstring(netmask_str), " "
"gateway=", Genode::Cstring(gateway_str));
genode_uint32_t ip, nm, gw;
ip = inet_addr(ip_addr_str);
nm = inet_addr(netmask_str);
gw = inet_addr(gateway_str);
if (ip == INADDR_NONE || nm == INADDR_NONE || gw == INADDR_NONE) {
Genode::error("invalid network interface config");
throw -1;
} else {
ip_addr = ip;
netmask = nm;
gateway = gw;
}
}
catch (...) {
Genode::log("Using DHCP for interface configuration.");
}
/* make sure the libc_lwip plugin has been created */
create_lwip_plugin();
try {
lwip_nic_init(ip_addr, netmask, gateway,
(Genode::size_t)tx_buf_size, (Genode::size_t)rx_buf_size);
}
catch (Genode::Service_denied) { /* ignore for now */ }
}
};
} /* unnamed namespace */
void create_etc_resolv_conf_plugin()
void __attribute__((constructor)) init_libc_lwip_dhcp(void)
{
static Plugin plugin;
}

View File

@ -15,10 +15,10 @@
*/
#include <base/allocator_avl.h>
#include <base/attached_rom_dataspace.h>
#include <base/log.h>
#include <base/thread.h>
#include <audio_out_session/connection.h>
#include <os/config.h>
enum {
@ -75,13 +75,17 @@ static Signal_receiver *signal_receiver()
}
static void read_config()
static void read_config(Genode::Signal_context_capability sigh =
Genode::Signal_context_capability())
{
/* read volume from config file */
try {
unsigned int config_volume;
Genode::config()->xml_node().sub_node("sdl_audio_volume")
Genode::Attached_rom_dataspace config("config");
if (sigh.valid()) config.sigh(sigh);
else config.update();
config.xml().sub_node("sdl_audio_volume")
.attribute("value").value(&config_volume);
volume = (float)config_volume / 100;
@ -163,8 +167,7 @@ static SDL_AudioDevice *GENODEAUD_CreateDevice(int devindex)
}
}
Genode::config()->sigh(signal_receiver()->manage(&config_signal_context));
read_config();
read_config(signal_receiver()->manage(&config_signal_context));
return _this;
}
@ -221,7 +224,6 @@ static void GENODEAUD_PlayAudio(_THIS)
if (signal_receiver()->pending()) {
signal_receiver()->wait_for_signal();
Genode::config()->reload();
read_config();
}

View File

@ -829,11 +829,11 @@ namespace File_system {
{
private:
Genode::Env &_env;
Genode::Allocator &_md_alloc;
Genode::Allocator &_heap;
Directory &_root_dir;
Genode::Env &_env;
Genode::Allocator &_md_alloc;
Genode::Allocator &_heap;
Genode::Attached_rom_dataspace _config { _env, "config" };
Directory &_root_dir;
protected:
@ -852,7 +852,7 @@ namespace File_system {
Session_label const label = label_from_args(args);
try {
Session_policy policy(label);
Session_policy policy(label, _config.xml());
/*
* Determine directory that is used as root directory of

View File

@ -6,7 +6,7 @@ SRC_C = $(notdir $(EXFAT_DIR)/fuse/main.c)
SRC_CC = fuse_fs_main.cc \
init.cc
LIBS = config libc libfuse libexfat
LIBS = libc libfuse libexfat
INC_DIR += $(PRG_DIR)/..
CC_OPT += -Wno-unused-function

View File

@ -9,7 +9,7 @@ SRC_C = $(filter-out $(FILTER_OUT), $(notdir $(wildcard $(FUSE_EXT2_DIR)/*.c)))
SRC_CC = fuse_fs_main.cc \
init.cc
LIBS = config libc libfuse libext2fs
LIBS = libc libfuse libext2fs
CC_OPT += -DHAVE_CONFIG_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64

View File

@ -16,7 +16,6 @@
#include <file_system/node_handle_registry.h>
#include <file_system_session/rpc_object.h>
#include <base/attached_rom_dataspace.h>
#include <os/config.h>
#include <os/session_policy.h>
#include <root/component.h>
#include <util/xml_node.h>
@ -41,7 +40,7 @@ class File_system::Session_component : public Session_rpc_object
{
private:
Genode::Entrypoint &_ep;
Genode::Env &_env;
Allocator &_md_alloc;
Directory &_root;
Node_handle_registry _handle_registry;
@ -155,19 +154,18 @@ class File_system::Session_component : public Session_rpc_object
/**
* Constructor
*/
Session_component(size_t tx_buf_size,
Genode::Entrypoint &ep,
Genode::Region_map &rm,
char const *root_dir,
bool writeable,
Allocator &md_alloc)
Session_component(size_t tx_buf_size,
Genode::Env &env,
char const *root_dir,
bool writeable,
Allocator &md_alloc)
:
Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), rm, ep.rpc_ep()),
_ep(ep),
Session_rpc_object(env.ram().alloc(tx_buf_size), env.rm(), env.ep().rpc_ep()),
_env(env),
_md_alloc(md_alloc),
_root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)),
_writeable(writeable),
_process_packet_handler(_ep, *this, &Session_component::_process_packets)
_process_packet_handler(_env.ep(), *this, &Session_component::_process_packets)
{
_tx.sigh_packet_avail(_process_packet_handler);
_tx.sigh_ready_to_ack(_process_packet_handler);
@ -181,7 +179,7 @@ class File_system::Session_component : public Session_rpc_object
Fuse::sync_fs();
Dataspace_capability ds = tx_sink()->dataspace();
env()->ram_session()->free(static_cap_cast<Ram_dataspace>(ds));
_env.ram().free(static_cap_cast<Ram_dataspace>(ds));
destroy(&_md_alloc, &_root);
}
@ -402,8 +400,8 @@ class File_system::Root : public Root_component<Session_component>
{
private:
Genode::Entrypoint &_ep;
Genode::Region_map &_rm;
Genode::Env &_env;
Genode::Attached_rom_dataspace _config { _env, "config" };
protected:
@ -423,7 +421,7 @@ class File_system::Root : public Root_component<Session_component>
Session_label const label = label_from_args(args);
try {
Session_policy policy(label);
Session_policy policy(label, _config.xml());
/*
* Determine directory that is used as root directory of
@ -485,7 +483,7 @@ class File_system::Root : public Root_component<Session_component>
throw Insufficient_ram_quota();
}
return new (md_alloc())
Session_component(tx_buf_size, _ep, _rm, root_dir, writeable, *md_alloc());
Session_component(tx_buf_size, _env, root_dir, writeable, *md_alloc());
}
public:
@ -493,39 +491,29 @@ class File_system::Root : public Root_component<Session_component>
/**
* Constructor
*
* \param ep entrypoint
* \param sig_rec signal receiver used for handling the
* data-flow signals of packet streams
* \param env environment
* \param md_alloc meta-data allocator
*/
Root(Genode::Entrypoint &ep, Allocator &md_alloc, Genode::Region_map &rm)
:
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
_ep(ep), _rm(rm)
{ }
Root(Genode::Env & env, Allocator &md_alloc)
: Root_component<Session_component>(env.ep(), md_alloc),
_env(env) { }
};
struct File_system::Main
{
Genode::Entrypoint &ep;
Genode::Region_map &rm;
Genode::Env & env;
Sliced_heap sliced_heap { env.ram(), env.rm() };
Root fs_root { env, sliced_heap };
/*
* Initialize root interface
*/
Sliced_heap sliced_heap = { env()->ram_session(), env()->rm_session() };
Root fs_root = { ep, sliced_heap, rm };
Main(Genode::Entrypoint &ep, Genode::Region_map &rm) : ep(ep), rm(rm)
Main(Genode::Env & env) : env(env)
{
if (!Fuse::init_fs()) {
Genode::error("FUSE fs initialization failed");
return;
}
env()->parent()->announce(ep.manage(fs_root));
env.parent().announce(env.ep().manage(fs_root));
}
~Main()
@ -543,6 +531,6 @@ struct File_system::Main
void Libc::Component::construct(Libc::Env &env)
{
static File_system::Main inst(env.ep(), env.rm());
static File_system::Main inst(env);
}

View File

@ -6,7 +6,7 @@ SRC_C := ntfs-3g.c ntfs-3g_common.c
SRC_CC := fuse_fs_main.cc \
init.cc
LIBS := config libc libfuse libntfs-3g
LIBS := libc libfuse libntfs-3g
CC_OPT := -DHAVE_TIMESPEC -DHAVE_CONFIG_H -DRECORD_LOCKING_NOT_IMPLEMENTED

View File

@ -13,15 +13,12 @@
*/
/* Genode includes */
#include <base/attached_rom_dataspace.h>
#include <base/log.h>
#include <base/thread.h>
#include <util/string.h>
#include <timer_session/connection.h>
#include <nic/packet_allocator.h>
#include <os/config.h>
#include <base/sleep.h>
#include <libc/component.h>
#include <nic/packet_allocator.h>
#include <timer_session/connection.h>
#include <util/string.h>
extern "C" {
#include <lwip/sockets.h>
@ -32,90 +29,46 @@ extern "C" {
#include <lwip/genode.h>
static const char *http_get_request =
"GET / HTTP/1.0\r\nHost: localhost:80\r\n\r\n"; /* simple HTTP request header */
using namespace Genode;
template <Genode::size_t N>
static Genode::String<N> read_string_attribute(Genode::Xml_node node, char const *attr,
Genode::String<N> default_value)
{
try {
char buf[N];
node.attribute(attr).value(buf, sizeof(buf));
return Genode::String<N>(Genode::Cstring(buf));
}
catch (...) {
return default_value; }
}
bool static_ip_config(uint32_t & ip, uint32_t & nm, uint32_t & gw)
{
enum { ADDR_STR_SZ = 16 };
Xml_node libc_node = config()->xml_node().sub_node("libc");
String<ADDR_STR_SZ> ip_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "ip_addr", String<ADDR_STR_SZ>());
String<ADDR_STR_SZ> nm_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "netmask", String<ADDR_STR_SZ>());
String<ADDR_STR_SZ> gw_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "gateway", String<ADDR_STR_SZ>());
ip = inet_addr(ip_str.string());
nm = inet_addr(nm_str.string());
gw = inet_addr(gw_str.string());
if (ip == INADDR_NONE || nm == INADDR_NONE || gw == INADDR_NONE) { return false; }
log("static ip config: ip=", ip_str, " nm=", nm_str, " gw=", gw_str);
return true;
}
/**
* The client thread simply loops endless,
* The client simply loops endless,
* and sends as much 'http get' requests as possible,
* printing out the response.
*/
void Libc::Component::construct(Libc::Env &env)
{
using namespace Genode;
using Address = Genode::String<16>;
enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 };
static Timer::Connection _timer(env);
_timer.msleep(2000);
lwip_tcpip_init();
uint32_t ip = 0;
uint32_t nm = 0;
uint32_t gw = 0;
bool static_ip = static_ip_config(ip, nm, gw);
uint32_t ip = 0, nm = 0, gw = 0;
Address serv_addr, ip_addr, netmask, gateway;
enum { ADDR_STR_SZ = 16 };
char serv_addr[ADDR_STR_SZ] = { 0 };
Xml_node config_node = config()->xml_node();
try { config_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); }
catch(...) {
error("Missing \"server_ip\" attribute.");
throw Xml_node::Nonexistent_attribute();
}
Attached_rom_dataspace config(env, "config");
Xml_node config_node = config.xml();
Xml_node libc_node = env.libc_config();
try {
libc_node.attribute("ip_addr").value(&ip_addr);
libc_node.attribute("netmask").value(&netmask);
libc_node.attribute("gateway").value(&gateway);
ip = inet_addr(ip_addr.string());
nm = inet_addr(netmask.string());
gw = inet_addr(gateway.string());
} catch (...) {}
config_node.attribute("server_ip").value(&serv_addr);
if (static_ip) {
if (lwip_nic_init(ip, nm, gw, BUF_SIZE, BUF_SIZE)) {
error("We got no IP address!");
exit(1);
}
} else {
if( lwip_nic_init(0, 0, 0, BUF_SIZE, BUF_SIZE))
{
error("got no IP address!");
exit(1);
}
if (lwip_nic_init(ip, nm, gw, BUF_SIZE, BUF_SIZE)) {
error("We got no IP address!");
exit(1);
}
for(int j = 0; j != 5; ++j) {
_timer.msleep(2000);
log("Create new socket ...");
int s = lwip_socket(AF_INET, SOCK_STREAM, 0 );
if (s < 0) {
@ -135,7 +88,7 @@ void Libc::Component::construct(Libc::Env &env)
struct sockaddr_in addr;
addr.sin_port = htons(port);
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(serv_addr);
addr.sin_addr.s_addr = inet_addr(serv_addr.string());
if((lwip_connect(s, (struct sockaddr *)&addr, sizeof(addr))) < 0) {
error("Could not connect!");
@ -144,6 +97,11 @@ void Libc::Component::construct(Libc::Env &env)
}
log("Send request...");
/* simple HTTP request header */
static const char *http_get_request =
"GET / HTTP/1.0\r\nHost: localhost:80\r\n\r\n";
unsigned long bytes = lwip_send(s, (char*)http_get_request,
Genode::strlen(http_get_request), 0);
if ( bytes < 0 ) {

View File

@ -18,12 +18,11 @@
*/
/* Genode includes */
#include <base/attached_rom_dataspace.h>
#include <base/log.h>
#include <base/thread.h>
#include <util/string.h>
#include <libc/component.h>
#include <nic/packet_allocator.h>
#include <os/config.h>
#include <base/snprintf.h>
#include <util/string.h>
/* LwIP includes */
extern "C" {
@ -33,15 +32,7 @@ extern "C" {
#include <lwip/genode.h>
const static char http_html_hdr[] =
"HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"; /* HTTP response header */
enum { HTTP_INDEX_HTML_SZ = 1024 };
static char http_index_html[HTTP_INDEX_HTML_SZ]; /* HTML page */
using namespace Genode;
using Response = Genode::String<1024>;
/**
@ -49,7 +40,7 @@ using namespace Genode;
*
* \param conn socket connected to the client
*/
void http_server_serve(int conn)
void http_server_serve(int conn, Response & response)
{
char buf[1024];
ssize_t buflen;
@ -57,7 +48,7 @@ void http_server_serve(int conn)
/* Read the data from the port, blocking if nothing yet there.
We assume the request (the part we care about) is in one packet */
buflen = lwip_recv(conn, buf, 1024, 0);
log("Packet received!");
Genode::log("Packet received!");
/* Ignore all receive errors */
if (buflen > 0) {
@ -71,63 +62,46 @@ void http_server_serve(int conn)
buf[3] == ' ' &&
buf[4] == '/' ) {
log("Will send response");
/* Send http header */
lwip_send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0);
Genode::log("Will send response");
/* Send our HTML page */
lwip_send(conn, http_index_html, Genode::strlen(http_index_html), 0);
lwip_send(conn, response.string(), response.length(), 0);
}
}
}
template <Genode::size_t N>
static Genode::String<N> read_string_attribute(Genode::Xml_node node, char const *attr,
Genode::String<N> default_value)
{
try {
char buf[N];
node.attribute(attr).value(buf, sizeof(buf));
return Genode::String<N>(Genode::Cstring(buf));
struct Initialization_failed {};
#define ASSERT(cond, err) \
if (!cond) { \
Genode::error(err); \
throw Initialization_failed(); \
}
catch (...) {
return default_value; }
}
int main()
void Libc::Component::construct(Libc::Env & env)
{
using namespace Genode;
using Address = Genode::String<16>;
enum { BUF_SIZE = Nic::Packet_allocator::DEFAULT_PACKET_SIZE * 128 };
int s;
lwip_tcpip_init();
enum { ADDR_STR_SZ = 16 };
uint32_t ip = 0;
uint32_t nm = 0;
uint32_t gw = 0;
unsigned port = 0;
Xml_node config_node = config()->xml_node();
Xml_node libc_node = config_node.sub_node("libc");
String<ADDR_STR_SZ> ip_addr_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "ip_addr", String<ADDR_STR_SZ>());
String<ADDR_STR_SZ> netmask_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "netmask", String<ADDR_STR_SZ>());
String<ADDR_STR_SZ> gateway_str =
read_string_attribute<ADDR_STR_SZ>(libc_node, "gateway", String<ADDR_STR_SZ>());
Address ip_addr_str;
Address netmask_str;
Address gateway_str;
try { config_node.attribute("port").value(&port); }
catch(...) {
error("Missing \"port\" attribute.");
throw Xml_node::Nonexistent_attribute();
}
Attached_rom_dataspace config(env, "config");
Xml_node libc_node = env.libc_config();
libc_node.attribute("ip_addr").value(&ip_addr_str);
libc_node.attribute("netmask").value(&netmask_str);
libc_node.attribute("gateway").value(&gateway_str);
config.xml().attribute("port").value(&port);
log("static network interface: ip=", ip_addr_str, " nm=", netmask_str, " gw=", gateway_str);
@ -135,48 +109,41 @@ int main()
nm = inet_addr(netmask_str.string());
gw = inet_addr(gateway_str.string());
if (ip == INADDR_NONE || nm == INADDR_NONE || gw == INADDR_NONE) {
error("Invalid network interface config.");
throw -1;
}
ASSERT((ip != INADDR_NONE && nm != INADDR_NONE && gw != INADDR_NONE),
"Invalid network interface config.");
/* Initialize network stack */
if (lwip_nic_init(ip, nm, gw, BUF_SIZE, BUF_SIZE)) {
error("got no IP address!");
return -1;
}
ASSERT(!lwip_nic_init(ip, nm, gw, BUF_SIZE, BUF_SIZE),
"got no IP address!");
log("Create new socket ...");
if((s = lwip_socket(AF_INET, SOCK_STREAM, 0)) < 0) {
error("no socket available!");
return -1;
}
Genode::snprintf(
http_index_html, HTTP_INDEX_HTML_SZ,
int s;
ASSERT(((s = lwip_socket(AF_INET, SOCK_STREAM, 0)) >= 0),
"no socket available!");
static Response response(
"HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"
"<html><head></head><body>"
"<h1>HTTP server at %s:%u</h1>"
"<p>This is a small test page.</body></html>",
ip_addr_str.string(), port);
log("Now, I will bind ...");
struct sockaddr_in in_addr;
in_addr.sin_family = AF_INET;
in_addr.sin_port = htons(port);
in_addr.sin_addr.s_addr = INADDR_ANY;
if(lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) {
error("bind failed!");
return -1;
}
ASSERT(!lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr)),
"bind failed!");
log("Now, I will listen ...");
if(lwip_listen(s, 5)) {
error("listen failed!");
return -1;
}
ASSERT(!lwip_listen(s, 5),
"listen failed!");
log("Start the server loop ...");
while(true) {
while (true) {
struct sockaddr addr;
socklen_t len = sizeof(addr);
int client = lwip_accept(s, &addr, &len);
@ -184,8 +151,7 @@ int main()
warning("invalid socket from accept!");
continue;
}
http_server_serve(client);
http_server_serve(client, response);
lwip_close(client);
}
return 0;
}

View File

@ -1,5 +1,5 @@
TARGET = test-lwip_httpsrv_static
LIBS = lwip posix config
LIBS = lwip posix
SRC_CC = main.cc
INC_DIR += $(REP_DIR)/src/lib/lwip/include

View File

@ -16,7 +16,6 @@
/* Genode includes */
#include <base/log.h>
#include <os/config.h>
/* libc includes */
#include <fcntl.h>
@ -24,39 +23,18 @@
extern "C" int __sread(void *, char *, int);
static bool process_config(char **file)
{
using namespace Genode;
static char file_name[64];
try {
Xml_node config_node = config()->xml_node();
Xml_node script_node = config_node.sub_node("script");
script_node.attribute("name").value(file_name, sizeof(file_name));
*file = file_name;
return true;
}
catch (Xml_node::Nonexistent_sub_node) {
Genode::error("no 'config/script' sub node in config found"); }
catch (Xml_node::Nonexistent_attribute) {
Genode::error("no 'name' attribute in 'script' node found"); }
return false;
}
int main()
int main(int argc, char const ** args)
{
using namespace Genode;
char *name;
if (!process_config(&name)) {
Genode::error("no script found");
return 1;
if (argc < 1) {
Genode::error("Need <scriptname>.py as argument!");
return -1;
}
Genode::log("Found script: ", Genode::Cstring(name));
FILE* fp = fopen(name, "r");
char * name = const_cast<char*>(args[0]);
FILE * fp = fopen(name, "r");
//fp._flags = __SRD;
Py_SetProgramName(name);
//don't need the 'site' module

View File

@ -1,72 +0,0 @@
/*
* \brief Access to process configuration
* \author Norman Feske
* \date 2010-05-04
*/
/*
* Copyright (C) 2010-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef INCLUDED_BY_OS_CONFIG_CC
#ifndef INCLUDED_FROM_OS_SESSION_POLICY_H
#warning os/config.h is deprecated, use 'Attached_rom_dataspace' instead
#endif
#endif
#ifndef _INCLUDE__OS__CONFIG_H_
#define _INCLUDE__OS__CONFIG_H_
#include <rom_session/connection.h>
#include <dataspace/client.h>
#include <util/xml_node.h>
#include <base/exception.h>
namespace Genode {
class Config;
/**
* Return singleton instance of config
*/
Reconstructible<Config> &config();
}
class Genode::Config
{
private:
Rom_connection _config_rom;
Dataspace_capability _config_ds;
Xml_node _config_xml;
public:
/**
* Constructor
*/
Config();
Xml_node xml_node();
/**
* Register signal handler for tracking config modifications
*/
void sigh(Signal_context_capability cap);
/**
* Reload configuration
*
* \throw Invalid if the new configuration has an invalid syntax
*
* This method is meant to be called as response to a signal
* received by the signal handler as registered via 'sigh()'.
*/
void reload();
};
#endif /* _INCLUDE__OS__CONFIG_H_ */

View File

@ -14,13 +14,10 @@
#ifndef _INCLUDE__OS__SESSION_POLICY_H_
#define _INCLUDE__OS__SESSION_POLICY_H_
#include <util/arg_string.h>
#include <base/session_label.h>
/* to be removed along with the \deprecated API */
#define INCLUDED_FROM_OS_SESSION_POLICY_H
#include <os/config.h>
#undef INCLUDED_FROM_OS_SESSION_POLICY_H
#include <session/session.h>
#include <util/arg_string.h>
#include <util/xml_node.h>
namespace Genode {
@ -229,20 +226,6 @@ class Genode::Session_policy : public Xml_node
:
Xml_node(_query_policy(label, config))
{ }
/**
* Constructor
*
* \param label label used as the selector of a policy
*
* \deprecated use constructor with explicit 'config' argument
*/
template <size_t N> explicit Session_policy(String<N> const &label) __attribute__((deprecated));
};
template <Genode::size_t N> Genode::Session_policy::Session_policy(String<N> const &label)
:
Xml_node(_query_policy(label, Genode::config()->xml_node()))
{ }
#endif /* _INCLUDE__OS__SESSION_POLICY_H_ */

View File

@ -1,3 +0,0 @@
SRC_CC = config.cc
vpath config.cc $(REP_DIR)/src/lib/config

View File

@ -1,4 +1,4 @@
LIBS += base config
LIBS += base
SRC_CC += serial_driver.cc block_driver.cc vm_base.cc spec/imx53/main.cc
INC_DIR += $(REP_DIR)/src/server/tz_vmm/spec/imx53
INC_DIR += $(REP_DIR)/src/server/tz_vmm/include

View File

@ -7,7 +7,7 @@
TARGET = fb_drv
REQUIRES = omap4
SRC_CC = main.cc
LIBS = base blit config
LIBS = base blit
INC_DIR += $(PRG_DIR)
vpath main.cc $(PRG_DIR)

View File

@ -1,5 +1,5 @@
REQUIRES = cadence_gem
TARGET = nic_drv
SRC_CC = main.cc
LIBS = base config
LIBS = base
INC_DIR += $(PRG_DIR)

View File

@ -1,4 +1,4 @@
TARGET = linux_nic_drv
REQUIRES = linux
LIBS = lx_hybrid config
LIBS = lx_hybrid
SRC_CC = main.cc

View File

@ -1,6 +1,6 @@
TARGET = kdb_uart_drv
SRC_CC = main.cc
LIBS += base config
LIBS += base
INC_DIR += $(REP_DIR)/src/drivers/uart $(REP_DIR)/src/drivers/uart/kdb
vpath main.cc $(REP_DIR)/src/drivers/uart

View File

@ -1,107 +0,0 @@
/*
* \brief Access to process configuration
* \author Norman Feske
* \date 2010-05-04
*
* \deprecated
*/
/*
* Copyright (C) 2010-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#define INCLUDED_BY_OS_CONFIG_CC
#include <os/config.h>
#undef INCLUDED_BY_OS_CONFIG_CC
using namespace Genode;
Xml_node _config_xml_node(Dataspace_capability config_ds)
{
if (!config_ds.valid())
throw Exception();
return Xml_node(env_deprecated()->rm_session()->attach(config_ds),
Genode::Dataspace_client(config_ds).size());
}
/**
* Fallback XML node used if the configuration is broken
*/
static Xml_node fallback_config_xml()
{
return Xml_node("<config/>");
}
void Config::reload()
{
if (!this)
return;
try {
/* re-acquire dataspace from ROM session */
if (_config_ds.valid())
env_deprecated()->rm_session()->detach(_config_xml.addr());
_config_ds = _config_rom.dataspace();
/* re-initialize XML node with new config data */
_config_xml = _config_xml_node(_config_ds);
} catch (Genode::Xml_node::Invalid_syntax) {
Genode::error("config ROM has invalid syntax");
_config_xml = fallback_config_xml();
}
}
Xml_node Config::xml_node()
{
if (!this)
return fallback_config_xml();
return _config_xml;
}
void Config::sigh(Signal_context_capability cap)
{
if (this)
_config_rom.sigh(cap);
}
Config::Config()
:
_config_rom(false, "config"),
_config_ds(_config_rom.dataspace()),
_config_xml(_config_xml_node(_config_ds))
{ }
Reconstructible<Config> &Genode::config()
{
static bool config_failed = false;
if (!config_failed) {
try {
static Reconstructible<Config> config_inst;
return config_inst;
} catch (Genode::Rom_connection::Rom_connection_failed) {
Genode::error("Could not obtain config file");
} catch (Genode::Xml_node::Invalid_syntax) {
Genode::error("Config file has invalid syntax");
} catch(...) {
Genode::error("Config dataspace is invalid");
}
}
/* do not try again to construct 'config_inst' */
config_failed = true;
class Config_construction_failed : Genode::Exception { };
throw Config_construction_failed();
}

View File

@ -1,6 +1,6 @@
TARGET = nic_dump
LIBS += base net config
LIBS += base net
SRC_CC += component.cc main.cc uplink.cc interface.cc

View File

@ -1,6 +1,6 @@
TARGET = nic_router
LIBS += base net config
LIBS += base net
SRC_CC += arp_waiter.cc ip_rule.cc
SRC_CC += component.cc port_allocator.cc forward_rule.cc

View File

@ -1,3 +1,3 @@
TARGET = part_blk
LIBS = base config
LIBS = base
SRC_CC = main.cc

View File

@ -1,4 +1,4 @@
TARGET = trace_fs
SRC_CC = main.cc
LIBS = base config
LIBS = base
INC_DIR += $(PRG_DIR)

View File

@ -1,3 +1,3 @@
TARGET = test-audio_out
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = test-audio_out_click
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = bomb
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = test-dynamic_config
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,6 +1,6 @@
TARGET = led_gpio_drv
REQUIRES = gpio
SRC_CC = main.cc
LIBS = base config
LIBS = base
vpath main.cc $(PRG_DIR)

View File

@ -2,6 +2,6 @@ TARGET = signal_gpio_drv
REQUIRES = gpio
SRC_CC = main.cc
INC_DIR += $(PRG_DIR)
LIBS = base config
LIBS = base
vpath main.cc $(PRG_DIR)

View File

@ -1,3 +1,3 @@
TARGET = test-resource_yield
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = test-rom_blk
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = test-trace
SRC_CC = main.cc
LIBS += base config
LIBS += base

View File

@ -14,7 +14,7 @@
/* Genode includes */
#include <base/env.h>
#include <os/config.h>
#include <base/attached_rom_dataspace.h>
/* GDB monitor includes */
#include "app_child.h"
@ -443,8 +443,9 @@ extern "C" int fork()
static char filename[32] = "";
Genode::Attached_rom_dataspace config { *genode_env, "config" };
try {
config()->xml_node().sub_node("target").attribute("name").value(filename, sizeof(filename));
config.xml().sub_node("target").attribute("name").value(filename, sizeof(filename));
} catch (Xml_node::Nonexistent_sub_node) {
error("missing '<target>' sub node");
return -1;
@ -454,7 +455,7 @@ extern "C" int fork()
}
/* extract target node from config file */
Xml_node target_node = config()->xml_node().sub_node("target");
Xml_node target_node = config.xml().sub_node("target");
/*
* preserve the configured amount of memory for gdb_monitor and give the
@ -462,7 +463,7 @@ extern "C" int fork()
*/
Number_of_bytes preserved_ram_quota = 0;
try {
Xml_node preserve_node = config()->xml_node().sub_node("preserve");
Xml_node preserve_node = config.xml().sub_node("preserve");
if (preserve_node.attribute("name").has_value("RAM"))
preserve_node.attribute("quantum").value(&preserved_ram_quota);
else

View File

@ -1,3 +1,3 @@
TARGET = vbox_pointer
SRC_CC = main.cc policy.cc
LIBS += base config
LIBS += base

View File

@ -12,20 +12,17 @@
*/
/* Genode includes */
#include <os/config.h>
#include <base/attached_rom_dataspace.h>
#include <base/component.h>
#include <base/log.h>
using namespace Genode;
int main(void)
void Component::construct(Genode::Env & env)
{
Genode::Attached_rom_dataspace config(env, "config");
try {
config()->xml_node().sub_node("test_config_subnode");
} catch (Xml_node::Nonexistent_sub_node) {
error("missing '<test_config_subnode>' sub node");
return -1;
config.xml().sub_node("test_config_subnode");
Genode::log("Test succeeded");
} catch (Genode::Xml_node::Nonexistent_sub_node) {
Genode::error("missing '<test_config_subnode>' sub node");
}
log("Test succeeded");
return 0;
}

View File

@ -1,3 +1,3 @@
TARGET = test-gdb_monitor_target_config
SRC_CC = main.cc
LIBS = base config
LIBS = base

View File

@ -1,3 +1,3 @@
TARGET = test-vbox_pointer
SRC_CC = main.cc
LIBS = base config
LIBS = base