mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
uniform XML boolean attribute access
Replace 'attribute(...).has_value("yes")` with 'attribute_value(..., false)'. This allows for boolean configuration to be set with values such as "true", "false", "yes", "no", or "1", "0". Fixes #2002
This commit is contained in:
parent
51e8f05fb6
commit
8ae2f65da8
@ -466,15 +466,6 @@ class Audio_in::Root : public Audio_in::Root_component
|
||||
** Main **
|
||||
**********/
|
||||
|
||||
static bool check(Genode::Xml_node config,
|
||||
char const * const attr,
|
||||
char const * const value)
|
||||
{
|
||||
try { return config.attribute(attr).has_value(value); }
|
||||
catch (...) { return false; }
|
||||
}
|
||||
|
||||
|
||||
struct Main
|
||||
{
|
||||
Genode::Env &env;
|
||||
@ -502,7 +493,7 @@ struct Main
|
||||
}
|
||||
|
||||
/* playback */
|
||||
if (!check(config.xml(), "playback", "no")) {
|
||||
if (config.xml().attribute_value("playback", true)) {
|
||||
static Audio_out::Out out(ep);
|
||||
Audio::play_sigh(out.sigh());
|
||||
static Audio_out::Root out_root(ep, heap, out.data_avail());
|
||||
@ -512,7 +503,7 @@ struct Main
|
||||
}
|
||||
|
||||
/* recording */
|
||||
if (check(config.xml(), "recording", "yes")) {
|
||||
if (config.xml().attribute_value("recording", true)) {
|
||||
static Audio_in::In in(ep);
|
||||
Audio::record_sigh(in.sigh());
|
||||
static Audio_in::Root in_root(ep, heap,
|
||||
|
@ -232,9 +232,7 @@ struct Main
|
||||
_ep(ep)
|
||||
{
|
||||
Genode::Xml_node config = Genode::config()->xml_node();
|
||||
try {
|
||||
config_verbose = config.attribute("verbose").has_value("yes");
|
||||
} catch (...) { }
|
||||
config_verbose = config.attribute_value("verbose", config_verbose);
|
||||
|
||||
_wpa = new (Genode::env()->heap()) Wpa_thread(wpa_startup_lock(), config_verbose);
|
||||
|
||||
|
@ -58,7 +58,7 @@ struct Services
|
||||
Genode::Xml_node node_screen = node_hid.sub_node("touchscreen");
|
||||
node_screen.attribute("width").value(&screen_width);
|
||||
node_screen.attribute("height").value(&screen_height);
|
||||
multitouch = node_screen.attribute("multitouch").has_value("yes");
|
||||
multitouch = node_screen.attribute_value("multitouch", false);
|
||||
} catch (...) {
|
||||
screen_width = screen_height = 0;
|
||||
PDBG("Could not read screen resolution in config node");
|
||||
@ -87,32 +87,26 @@ struct Services
|
||||
|
||||
try {
|
||||
Genode::Xml_node node_report = node_raw.sub_node("report");
|
||||
raw_report_device_list = node_report.attribute("devices").has_value("yes");
|
||||
raw_report_device_list = node_report.attribute_value("devices", false);
|
||||
} catch (...) { }
|
||||
} catch (Xml_node::Nonexistent_sub_node) {
|
||||
PDBG("No <raw> config node found - not starting external USB service");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!config()->xml_node().attribute("uhci").has_value("yes"))
|
||||
throw -1;
|
||||
if (config()->xml_node().attribute_value("uhci", false)) {
|
||||
uhci = true;
|
||||
PINF("Enabled UHCI (USB 1.0/1.1) support");
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
try {
|
||||
if (!config()->xml_node().attribute("ehci").has_value("yes"))
|
||||
throw -1;
|
||||
if (config()->xml_node().attribute_value("ehci", false)) {
|
||||
ehci = true;
|
||||
PINF("Enabled EHCI (USB 2.0) support");
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
try {
|
||||
if (!config()->xml_node().attribute("xhci").has_value("yes"))
|
||||
throw -1;
|
||||
if (config()->xml_node().attribute_value("xhci", false)) {
|
||||
xhci = true;
|
||||
PINF("Enabled XHCI (USB 3.0) support");
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
if (!(uhci | ehci | xhci))
|
||||
PWRN("Warning: No USB controllers enabled.\n"
|
||||
|
@ -152,18 +152,12 @@ extern "C" int pci_register_driver(struct pci_driver *driver)
|
||||
/* register driver at the 'pci_dev' struct */
|
||||
pci_dev->dev.driver = &driver->driver;
|
||||
|
||||
bool bios_handoff = true;
|
||||
try {
|
||||
if (config()->xml_node().attribute("bios_handoff").has_value("no"))
|
||||
bios_handoff = false;
|
||||
} catch (...) { }
|
||||
|
||||
/*
|
||||
* This quirk handles device handoff from BIOS, since the BIOS may still
|
||||
* access the USB controller after bootup. For this the ext cap register of
|
||||
* the PCI config space is checked
|
||||
*/
|
||||
if (bios_handoff)
|
||||
if (config()->xml_node().attribute_value("bios_handoff", true))
|
||||
__pci_fixup_quirk_usb_early_handoff(pci_dev);
|
||||
|
||||
/* call probe function of the Linux driver */
|
||||
|
@ -139,8 +139,7 @@ void wifi_init(Server::Entrypoint &ep, Genode::Lock &lock)
|
||||
* For testing testing only the wireless stack with wpa_supplicant,
|
||||
* amongst other on linux, we do not want to load the iwlwifi drivers.
|
||||
*/
|
||||
if (Genode::config()->xml_node().has_attribute("mac80211_only"))
|
||||
mac80211_only = Genode::config()->xml_node().attribute("mac80211_only").has_value("yes");
|
||||
mac80211_only = Genode::config()->xml_node().attribute_value("mac80211_only", mac80211_only);
|
||||
if (mac80211_only)
|
||||
PINF("Initalizing only mac80211 stack without any driver!");
|
||||
|
||||
|
@ -410,9 +410,7 @@ class File_system::Root : public Root_component<Session_component>
|
||||
/*
|
||||
* Determine if write access is permitted for the session.
|
||||
*/
|
||||
try {
|
||||
writeable = policy.attribute("writeable").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
writeable = policy.attribute_value("writeable", false);
|
||||
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
PERR("Invalid session request, no matching policy");
|
||||
|
@ -259,8 +259,7 @@ void Backdrop::Main::apply_image(Xml_node operation)
|
||||
|
||||
Point const pos = Point(anchored_xpos, anchored_ypos) + offset;
|
||||
|
||||
bool const tiled = operation.has_attribute("tiled")
|
||||
&& operation.attribute("tiled").has_value("yes");
|
||||
bool const tiled = operation.attribute_value("tiled", false);
|
||||
|
||||
unsigned alpha = Decorator::attribute(operation, "alpha", 256U);
|
||||
|
||||
|
@ -193,16 +193,6 @@ void Decorator::Window::draw(Decorator::Canvas_base &canvas,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if specified XML attribute has the given value
|
||||
*/
|
||||
static bool attribute_has_value(Genode::Xml_node node,
|
||||
char const *attr, char const *value)
|
||||
{
|
||||
return node.has_attribute(attr) && node.attribute(attr).has_value(value);
|
||||
}
|
||||
|
||||
|
||||
bool Decorator::Window::update(Genode::Xml_node window_node)
|
||||
{
|
||||
bool updated = false;
|
||||
@ -234,8 +224,8 @@ bool Decorator::Window::update(Genode::Xml_node window_node)
|
||||
updated |= true;
|
||||
}
|
||||
|
||||
_focused = attribute_has_value(window_node, "focused", "yes");
|
||||
_has_alpha = attribute_has_value(window_node, "has_alpha", "yes");
|
||||
_focused = window_node.attribute_value( "focused", false);
|
||||
_has_alpha = window_node.attribute_value("has_alpha", false);
|
||||
|
||||
Window_title title = Decorator::string_attribute(window_node, "title",
|
||||
Window_title("<untitled>"));
|
||||
@ -268,7 +258,7 @@ bool Decorator::Window::update(Genode::Xml_node window_node)
|
||||
char const * const attr =
|
||||
Control::type_name(window_control.type());
|
||||
|
||||
if (attribute_has_value(window_node, attr, "yes"))
|
||||
if (window_node.attribute_value(attr, false))
|
||||
new_controls.add(window_control);
|
||||
break;
|
||||
}
|
||||
|
@ -385,12 +385,9 @@ void Floating_window_layouter::Main::import_window_list(Xml_node window_list_xml
|
||||
|
||||
win->size(initial_size);
|
||||
win->title(string_attribute(node, "title", Window::Title("")));
|
||||
win->has_alpha(node.has_attribute("has_alpha")
|
||||
&& node.attribute("has_alpha").has_value("yes"));
|
||||
win->hidden(node.has_attribute("hidden")
|
||||
&& node.attribute("hidden").has_value("yes"));
|
||||
win->resizeable(node.has_attribute("resizeable")
|
||||
&& node.attribute("resizeable").has_value("yes"));
|
||||
win->has_alpha( node.attribute_value("has_alpha", false));
|
||||
win->hidden( node.attribute_value("hidden", false));
|
||||
win->resizeable(node.attribute_value("resizeable", false));
|
||||
}
|
||||
} catch (...) { }
|
||||
}
|
||||
|
@ -174,8 +174,7 @@ void Menu_view::Main::handle_config(unsigned)
|
||||
|
||||
try {
|
||||
hover_reporter.enabled(config()->xml_node().sub_node("report")
|
||||
.attribute("hover")
|
||||
.has_value("yes"));
|
||||
.attribute_value("hover", false));
|
||||
} catch (...) {
|
||||
hover_reporter.enabled(false);
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ struct Menu_view::Button_widget : Widget, Animator::Item
|
||||
|
||||
static bool _enabled(Xml_node node, char const *attr)
|
||||
{
|
||||
return node.has_attribute(attr) && node.attribute(attr).has_value("yes");
|
||||
return node.attribute_value(attr, false);
|
||||
}
|
||||
|
||||
Button_widget(Widget_factory &factory, Xml_node node, Unique_id unique_id)
|
||||
|
@ -63,14 +63,7 @@ unsigned long session_arg(const char *attr_name, const char *args,
|
||||
|
||||
bool config_attribute(const char *attr_name)
|
||||
{
|
||||
|
||||
bool result = false;
|
||||
|
||||
try {
|
||||
result = Genode::config()->xml_node().attribute(attr_name).has_value("yes"); }
|
||||
catch (...) {}
|
||||
|
||||
return result;
|
||||
return Genode::config()->xml_node().attribute_value(attr_name, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,10 +52,7 @@ void __attribute__((constructor)) init_nic_dhcp(void)
|
||||
try {
|
||||
Genode::Xml_node libc_node = Genode::config()->xml_node().sub_node("libc");
|
||||
|
||||
try {
|
||||
if (libc_node.attribute("resolv").has_value("no"))
|
||||
provide_etc_resolv_conf = false;
|
||||
} catch(...) { }
|
||||
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));
|
||||
|
@ -31,29 +31,25 @@ static constexpr bool verbose = false;
|
||||
QGenodeClipboard::QGenodeClipboard(Genode::Signal_receiver &sig_rcv)
|
||||
: _clipboard_signal_dispatcher(sig_rcv, *this, &QGenodeClipboard::_handle_clipboard)
|
||||
{
|
||||
try {
|
||||
if (Genode::config()->xml_node().attribute_value("clipboard", false)) {
|
||||
|
||||
if (Genode::config()->xml_node().attribute("clipboard").has_value("yes")) {
|
||||
try {
|
||||
|
||||
try {
|
||||
_clipboard_ds = new (Genode::env()->heap())
|
||||
Genode::Attached_rom_dataspace("clipboard");
|
||||
|
||||
_clipboard_ds = new (Genode::env()->heap())
|
||||
Genode::Attached_rom_dataspace("clipboard");
|
||||
_clipboard_ds->sigh(_clipboard_signal_dispatcher);
|
||||
_clipboard_ds->update();
|
||||
|
||||
_clipboard_ds->sigh(_clipboard_signal_dispatcher);
|
||||
_clipboard_ds->update();
|
||||
} catch (...) { }
|
||||
|
||||
} catch (...) { }
|
||||
try {
|
||||
_clipboard_reporter = new (Genode::env()->heap())
|
||||
Genode::Reporter("clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
} catch (...) { }
|
||||
|
||||
try {
|
||||
_clipboard_reporter = new (Genode::env()->heap())
|
||||
Genode::Reporter("clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
} catch (...) { }
|
||||
|
||||
}
|
||||
|
||||
} catch (...) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -946,9 +946,7 @@ namespace File_system {
|
||||
/*
|
||||
* Determine if write access is permitted for the session.
|
||||
*/
|
||||
try {
|
||||
writeable = policy.attribute("writeable").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
writeable = policy.attribute_value("writeable", false);
|
||||
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
PERR("Invalid session request, no matching policy");
|
||||
|
@ -477,10 +477,9 @@ class File_system::Root : public Root_component<Session_component>
|
||||
/*
|
||||
* Determine if write access is permitted for the session.
|
||||
*/
|
||||
try {
|
||||
writeable = policy.attribute("writeable").has_value("yes");
|
||||
writeable = policy.attribute_value("writeable", false);
|
||||
if (writeable)
|
||||
PWRN("WARNING: write support in fuse_fs is considered experimental, data-loss may occur.");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
PERR("Invalid session request, no matching policy");
|
||||
|
@ -431,7 +431,7 @@ class Init::Child : Genode::Child_policy
|
||||
try {
|
||||
if (rsc.attribute("name").has_value("RAM")) {
|
||||
rsc.attribute("quantum").value(&ram_bytes);
|
||||
constrain_phys = rsc.attribute("constrain_phys").has_value("yes");
|
||||
constrain_phys = rsc.attribute_value("constrain_phys", false);
|
||||
} else if (rsc.attribute("name").has_value("CPU")) {
|
||||
rsc.attribute("quantum").value(&cpu_quota_pc); }
|
||||
} catch (...) { }
|
||||
@ -817,7 +817,7 @@ class Init::Child : Genode::Child_policy
|
||||
void exit(int exit_value) override
|
||||
{
|
||||
try {
|
||||
if (_start_node.sub_node("exit").attribute("propagate").has_value("yes")) {
|
||||
if (_start_node.sub_node("exit").attribute_value("propagate", false)) {
|
||||
Genode::env()->parent()->exit(exit_value);
|
||||
return;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ struct Server::Main
|
||||
{
|
||||
try {
|
||||
return Genode::config()->xml_node().sub_node("report")
|
||||
.attribute(attr).has_value("yes");
|
||||
.attribute_value(attr, false);
|
||||
} catch (...) { return false; }
|
||||
}
|
||||
|
||||
|
@ -114,12 +114,7 @@ class Framebuffer::Session_component :
|
||||
|
||||
static bool config_attribute(const char *attr_name)
|
||||
{
|
||||
bool result = false;
|
||||
try {
|
||||
result =
|
||||
Genode::config()->xml_node().attribute(attr_name).has_value("yes"); }
|
||||
catch (...) {}
|
||||
return result;
|
||||
return Genode::config()->xml_node().attribute_value(attr_name, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,12 +143,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
|
||||
static bool config_attribute(const char *attr_name)
|
||||
{
|
||||
bool result = false;
|
||||
try {
|
||||
result =
|
||||
Genode::config()->xml_node().attribute(attr_name).has_value("yes"); }
|
||||
catch (...) {}
|
||||
return result;
|
||||
return Genode::config()->xml_node().attribute_value(attr_name, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,11 +110,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
|
||||
static bool config_is_buffered()
|
||||
{
|
||||
try {
|
||||
return Genode::config()->xml_node().attribute("buffered").has_value("yes");
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
return Genode::config()->xml_node().attribute_value("buffered", false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,11 +44,9 @@ struct Main
|
||||
Irq_handler ps2_mouse_irq;
|
||||
Irq_handler ps2_keybd_irq;
|
||||
|
||||
bool _check_verbose(const char * verbose) {
|
||||
using namespace Genode;
|
||||
try {
|
||||
return config()->xml_node().attribute(verbose).has_value("yes");
|
||||
} catch (...) { return false; }
|
||||
bool _check_verbose(const char * verbose)
|
||||
{
|
||||
return Genode::config()->xml_node().attribute_value(verbose, false);
|
||||
}
|
||||
|
||||
Main(Server::Entrypoint &ep)
|
||||
|
@ -52,11 +52,9 @@ struct Main
|
||||
|
||||
enum { REG_IOPORT_DATA = 0, REG_IOPORT_STATUS};
|
||||
|
||||
bool _check_verbose(const char * verbose) {
|
||||
using namespace Genode;
|
||||
try {
|
||||
return config()->xml_node().attribute(verbose).has_value("yes");
|
||||
} catch (...) { return false; }
|
||||
bool _check_verbose(const char * verbose)
|
||||
{
|
||||
return Genode::config()->xml_node().attribute_value(verbose, false);
|
||||
}
|
||||
|
||||
Main(Server::Entrypoint &ep)
|
||||
|
@ -232,10 +232,7 @@ namespace Uart {
|
||||
policy.attribute("baudrate").value(&baudrate);
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
|
||||
bool detect_size = false;
|
||||
try {
|
||||
detect_size = policy.attribute("detect_size").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
bool detect_size = policy.attribute_value("detect_size", false);
|
||||
|
||||
return new (md_alloc())
|
||||
Session_component(_driver_factory, index, baudrate, detect_size);
|
||||
|
@ -310,10 +310,8 @@ int main(int, char **)
|
||||
|
||||
for (;;) {
|
||||
|
||||
try {
|
||||
config_verbose =
|
||||
config()->xml_node().attribute("verbose").has_value("yes"); }
|
||||
catch (...) { }
|
||||
config_verbose =
|
||||
config()->xml_node().attribute_value("verbose", false);
|
||||
|
||||
try { determine_parent_services(&parent_services); }
|
||||
catch (...) { }
|
||||
|
@ -78,8 +78,7 @@ struct Server::Main : Rom::Module::Read_policy, Rom::Module::Write_policy
|
||||
bool _verbose_config()
|
||||
{
|
||||
char const *attr = "verbose";
|
||||
return Genode::config()->xml_node().has_attribute(attr)
|
||||
&& Genode::config()->xml_node().attribute(attr).has_value("yes");
|
||||
return Genode::config()->xml_node().attribute_value(attr, false);
|
||||
}
|
||||
|
||||
bool verbose = _verbose_config();
|
||||
@ -107,7 +106,7 @@ struct Server::Main : Rom::Module::Read_policy, Rom::Module::Write_policy
|
||||
try {
|
||||
Genode::Xml_node focus(_focus_ds.local_addr<char>(), _focus_ds.size());
|
||||
|
||||
if (focus.attribute("active").has_value("yes"))
|
||||
if (focus.attribute_value("active", false))
|
||||
_focused_domain = focus.attribute_value("domain", Domain());
|
||||
|
||||
} catch (...) { }
|
||||
|
@ -251,8 +251,7 @@ struct Dynamic_rom::Main
|
||||
{
|
||||
Xml_node config = Genode::config()->xml_node();
|
||||
|
||||
return config.has_attribute("verbose")
|
||||
&& config.attribute("verbose").has_value("yes");
|
||||
return config.attribute_value("verbose", false);
|
||||
}
|
||||
|
||||
bool verbose = _verbose_config();
|
||||
|
@ -370,9 +370,7 @@ class File_system::Root : public Root_component<Session_component>
|
||||
/*
|
||||
* Determine if write access is permitted for the session.
|
||||
*/
|
||||
try {
|
||||
writeable = policy.attribute("writeable").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
writeable = policy.attribute_value("writeable", false);
|
||||
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
PERR("Invalid session request, no matching policy");
|
||||
|
@ -444,8 +444,7 @@ class Audio_out::Mixer
|
||||
config()->reload();
|
||||
|
||||
Xml_node config_node = config()->xml_node();
|
||||
try { verbose = config_node.attribute("verbose").has_value("yes"); }
|
||||
catch (...) { verbose = false; }
|
||||
verbose = config_node.attribute_value("verbose", verbose);
|
||||
|
||||
_set_default_config(config_node);
|
||||
|
||||
|
@ -1317,8 +1317,7 @@ static void configure_reporter(Genode::Reporter &reporter)
|
||||
try {
|
||||
Genode::Xml_node config_xml = Genode::config()->xml_node();
|
||||
reporter.enabled(config_xml.sub_node("report")
|
||||
.attribute(reporter.name().string())
|
||||
.has_value("yes"));
|
||||
.attribute_value(reporter.name().string(), false));
|
||||
} catch (...) {
|
||||
reporter.enabled(false);
|
||||
}
|
||||
@ -1339,11 +1338,9 @@ void Nitpicker::Main::handle_config(unsigned)
|
||||
} catch (...) { }
|
||||
|
||||
/* enable or disable redraw debug mode */
|
||||
try {
|
||||
tmp_fb = nullptr;
|
||||
if (config()->xml_node().attribute("flash").has_value("yes"))
|
||||
tmp_fb = &framebuffer;
|
||||
} catch (...) { }
|
||||
tmp_fb = config()->xml_node().attribute_value("flash", false)
|
||||
? &framebuffer
|
||||
: nullptr;
|
||||
|
||||
configure_reporter(pointer_reporter);
|
||||
configure_reporter(hover_reporter);
|
||||
|
@ -37,11 +37,7 @@ void Block::Driver::_ready_to_submit(unsigned) {
|
||||
|
||||
static bool _use_gpt()
|
||||
{
|
||||
try {
|
||||
return Genode::config()->xml_node().attribute("use_gpt").has_value("yes");
|
||||
} catch(...) { }
|
||||
|
||||
return false;
|
||||
return Genode::config()->xml_node().attribute_value("use_gpt", false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,9 +469,7 @@ namespace File_system {
|
||||
/*
|
||||
* Determine if write access is permitted for the session.
|
||||
*/
|
||||
try {
|
||||
writeable = policy.attribute("writeable").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
writeable = policy.attribute_value("writeable", false);
|
||||
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
PERR("Invalid session request, no matching policy");
|
||||
|
@ -168,8 +168,7 @@ static inline unsigned long read_period_ms_from_config()
|
||||
|
||||
Child::Child()
|
||||
:
|
||||
_expand(Genode::config()->xml_node().has_attribute("expand")
|
||||
&& Genode::config()->xml_node().attribute("expand").has_value("yes")),
|
||||
_expand(Genode::config()->xml_node().attribute_value("expand", false)),
|
||||
_periodic_timeout_dispatcher(_sig_rec, *this,
|
||||
&Child::_dispatch_periodic_timeout),
|
||||
_yield_dispatcher(_sig_rec, *this,
|
||||
@ -357,7 +356,7 @@ int main(int argc, char **argv)
|
||||
* the child or the parent role.
|
||||
*/
|
||||
bool const is_child = config()->xml_node().has_attribute("child")
|
||||
&& config()->xml_node().attribute("child").has_value("yes");
|
||||
&& config()->xml_node().attribute_value("child", false);
|
||||
|
||||
if (is_child) {
|
||||
printf("--- test-resource_yield child role started ---\n");
|
||||
|
@ -222,8 +222,7 @@ void Main::_handle_xray(unsigned)
|
||||
try {
|
||||
Genode::Xml_node node(_xray_ds.local_addr<char>());
|
||||
|
||||
bool xray = node.has_attribute("enabled")
|
||||
&& node.attribute("enabled").has_value("yes");
|
||||
bool xray = node.attribute_value("enabled", false);
|
||||
|
||||
/* update pointer if xray status changed */
|
||||
if (xray != _xray) {
|
||||
|
@ -1144,12 +1144,8 @@ int main(int argc, char **argv)
|
||||
static Genode::Cap_connection cap;
|
||||
|
||||
/* obtain global configuration */
|
||||
try {
|
||||
trace_syscalls = config()->xml_node().attribute("trace_syscalls").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
try {
|
||||
verbose = config()->xml_node().attribute("verbose").has_value("yes");
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
trace_syscalls = config()->xml_node().attribute_value("trace_syscalls", trace_syscalls);
|
||||
verbose = config()->xml_node().attribute_value("verbose", verbose);
|
||||
|
||||
/* register additional file systems to the VFS */
|
||||
Vfs::Global_file_system_factory &fs_factory = Vfs::global_file_system_factory();
|
||||
|
Loading…
x
Reference in New Issue
Block a user