From f8337b511b83da81cd1e4fa7b6377f4c06856dbd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Tue, 12 Jan 2016 14:11:58 +0100 Subject: [PATCH] Move Session_label from os to base Session_label constructor now takes a bare string rather than a serialized argument buffer. Replace all instances of previous constructor with 'label_from_args' function. Issue #1787 --- .../src/core/include/cpu_session_component.h | 9 +-- repos/base-nova/src/core/platform.cc | 2 +- repos/base/include/base/session_label.h | 80 +++++++++++++++++++ repos/base/include/base/trace/types.h | 4 +- repos/base/include/util/arg_string.h | 2 +- repos/base/src/core/cpu_session_component.cc | 8 +- .../src/core/include/cpu_session_component.h | 9 +-- .../src/core/include/cpu_thread_component.h | 2 +- repos/base/src/core/include/trace/root.h | 5 +- repos/dde_linux/src/lib/usb/raw/raw.cc | 6 +- repos/dde_rump/src/server/rump_fs/main.cc | 4 +- repos/demo/src/lib/launchpad/launchpad.cc | 2 +- repos/gems/src/app/launcher/main.cc | 2 +- repos/gems/src/app/launcher/panel_dialog.h | 2 +- .../gems/src/app/launcher/subsystem_manager.h | 10 +-- repos/gems/src/server/file_terminal/main.cc | 2 +- repos/gems/src/server/tcp_terminal/main.cc | 22 ++--- repos/gems/src/server/wm/nitpicker.h | 6 +- repos/libports/src/server/ffat_fs/main.cc | 4 +- .../src/server/fuse_fs/fuse_fs_main.cc | 4 +- repos/os/include/init/child.h | 8 +- repos/os/include/init/child_policy.h | 19 ++--- repos/os/include/os/session_policy.h | 26 +----- repos/os/include/report_rom/report_service.h | 4 +- repos/os/include/report_rom/rom_service.h | 2 +- .../platform/spec/x86/pci_session_component.h | 5 +- repos/os/src/drivers/uart/uart_component.h | 2 +- repos/os/src/server/fs_log/main.cc | 4 +- repos/os/src/server/iso9660/main.cc | 1 + repos/os/src/server/lx_fs/main.cc | 4 +- repos/os/src/server/nic_bridge/component.h | 8 +- repos/os/src/server/nitpicker/background.h | 4 +- repos/os/src/server/nitpicker/main.cc | 8 +- .../os/src/server/nitpicker/pointer_origin.h | 4 +- repos/os/src/server/part_blk/component.h | 4 +- repos/os/src/server/ram_fs/main.cc | 4 +- repos/os/src/server/trace_fs/main.cc | 4 +- repos/os/src/server/vfs/main.cc | 2 +- 38 files changed, 169 insertions(+), 129 deletions(-) create mode 100644 repos/base/include/base/session_label.h diff --git a/repos/base-nova/src/core/include/cpu_session_component.h b/repos/base-nova/src/core/include/cpu_session_component.h index 5802e6aac..8b179a5cc 100644 --- a/repos/base-nova/src/core/include/cpu_session_component.h +++ b/repos/base-nova/src/core/include/cpu_session_component.h @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. @@ -22,6 +22,7 @@ #include #include #include +#include /* core includes */ #include @@ -38,13 +39,9 @@ namespace Genode { class Cpu_session_component; } class Genode::Cpu_session_component : public Rpc_object { - public: - - typedef Cpu_thread_component::Session_label Session_label; - private: - Session_label _label; + Session_label const _label; Rpc_entrypoint *_session_ep; Rpc_entrypoint *_thread_ep; Pager_entrypoint *_pager_ep; diff --git a/repos/base-nova/src/core/platform.cc b/repos/base-nova/src/core/platform.cc index ff7f8ef11..0e7628794 100644 --- a/repos/base-nova/src/core/platform.cc +++ b/repos/base-nova/src/core/platform.cc @@ -739,7 +739,7 @@ Platform::Platform() : uint64_t execution_time = 0; Nova::sc_ctrl(sc_sel, execution_time); - return { Trace::Session_label("kernel"), Trace::Thread_name(name), + return { Session_label("kernel"), Trace::Thread_name(name), Trace::Execution_time(execution_time), affinity }; } diff --git a/repos/base/include/base/session_label.h b/repos/base/include/base/session_label.h new file mode 100644 index 000000000..8fa638424 --- /dev/null +++ b/repos/base/include/base/session_label.h @@ -0,0 +1,80 @@ +/* + * \brief Session label utility class + * \author Emery Hemingway + * \date 2016-07-01 + */ + +/* + * Copyright (C) 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. + */ + +#ifndef _INCLUDE__BASE__SESSION_LABEL_H_ +#define _INCLUDE__BASE__SESSION_LABEL_H_ + +#include +#include +#include + +namespace Genode { struct Session_label; } + +struct Genode::Session_label : String<160> +{ + typedef String String; + + using String::String; + + char const *last_element() const + { + char const * const full = string(); + char const * const separator = " -> "; + + size_t const full_len = strlen(full); + size_t const separator_len = strlen(separator); + + if (full_len < separator_len) + return full; + + for (unsigned i = full_len - separator_len; i > 0; --i) + if (!strcmp(separator, full + i, separator_len)) + return full + i + separator_len; + + return full; + } +}; + + +namespace Genode { + + /** + * Extract label from session arguments in the form of 'label="..."' + */ + inline Session_label label_from_args(char const *args) + { + char buf[Session_label::capacity()]; + Arg_string::find_arg(args, "label").string(buf, sizeof(buf), ""); + + return Session_label(buf); + } + + /** + * Create a compound label in the form of 'prefix -> label' + */ + inline Session_label prefixed_label(char const *prefix, char const *label) + { + if (!*prefix) + return Session_label(label); + + if (!*label) + return Session_label(prefix); + + char buf[Session_label::capacity()]; + snprintf(buf, sizeof(buf), "%s -> %s", prefix, label); + + return Session_label(buf); + } +} + +#endif /* _INCLUDE__BASE__SESSION_LABEL_H_ */ diff --git a/repos/base/include/base/trace/types.h b/repos/base/include/base/trace/types.h index acc5824e5..6ce890e8a 100644 --- a/repos/base/include/base/trace/types.h +++ b/repos/base/include/base/trace/types.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2013 Genode Labs GmbH + * Copyright (C) 2013-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. @@ -17,6 +17,7 @@ /* Genode includes */ #include #include +#include namespace Genode { namespace Trace { @@ -33,7 +34,6 @@ namespace Genode { namespace Trace { struct Traced_by_other_session : Exception { }; struct Subject_not_traced : Exception { }; - typedef String<160> Session_label; typedef String<32> Thread_name; struct Policy_id; diff --git a/repos/base/include/util/arg_string.h b/repos/base/include/util/arg_string.h index 83ae96b41..dd04fb3e1 100644 --- a/repos/base/include/util/arg_string.h +++ b/repos/base/include/util/arg_string.h @@ -18,7 +18,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. diff --git a/repos/base/src/core/cpu_session_component.cc b/repos/base/src/core/cpu_session_component.cc index 8d4f9dd59..5b2fa29ae 100644 --- a/repos/base/src/core/cpu_session_component.cc +++ b/repos/base/src/core/cpu_session_component.cc @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. @@ -246,6 +246,7 @@ Cpu_session_component::Cpu_session_component(Rpc_entrypoint *session_ep, Affinity const &affinity, size_t const quota) : + _label(label_from_args(args)), _session_ep(session_ep), _thread_ep(thread_ep), _pager_ep(pager_ep), _md_alloc(md_alloc, remaining_session_ram_quota(args)), @@ -257,11 +258,6 @@ Cpu_session_component::Cpu_session_component(Rpc_entrypoint *session_ep, _trace_sources(trace_sources), _quota(quota), _ref(0), _native_cpu(*this, args) { - /* remember session label */ - char buf[Session_label::size()]; - Arg_string::find_arg(args, "label").string(buf, sizeof(buf), ""); - _label = Session_label(buf); - Arg a = Arg_string::find_arg(args, "priority"); if (a.valid()) { _priority = a.ulong_value(0); diff --git a/repos/base/src/core/include/cpu_session_component.h b/repos/base/src/core/include/cpu_session_component.h index dc36b0725..6e91e6050 100644 --- a/repos/base/src/core/include/cpu_session_component.h +++ b/repos/base/src/core/include/cpu_session_component.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. @@ -20,6 +20,7 @@ #include #include #include +#include /* core includes */ #include @@ -37,13 +38,9 @@ namespace Genode { class Cpu_session_component; } class Genode::Cpu_session_component : public Rpc_object, public List::Element { - public: - - typedef Cpu_thread_component::Session_label Session_label; - private: - Session_label _label; + Session_label const _label; Rpc_entrypoint * const _session_ep; Rpc_entrypoint *_thread_ep; Pager_entrypoint *_pager_ep; diff --git a/repos/base/src/core/include/cpu_thread_component.h b/repos/base/src/core/include/cpu_thread_component.h index 13ac0939c..2b67a57e6 100644 --- a/repos/base/src/core/include/cpu_thread_component.h +++ b/repos/base/src/core/include/cpu_thread_component.h @@ -18,6 +18,7 @@ #include #include #include +#include /* core includes */ #include @@ -36,7 +37,6 @@ class Genode::Cpu_thread_component : public Rpc_object, { public: - typedef Trace::Session_label Session_label; typedef Trace::Thread_name Thread_name; private: diff --git a/repos/base/src/core/include/trace/root.h b/repos/base/src/core/include/trace/root.h index a2e0f179d..754b4d09a 100644 --- a/repos/base/src/core/include/trace/root.h +++ b/repos/base/src/core/include/trace/root.h @@ -38,15 +38,12 @@ class Genode::Trace::Root : public Genode::Root_component size_t arg_buffer_size = Arg_string::find_arg(args, "arg_buffer_size").ulong_value(0); unsigned parent_levels = Arg_string::find_arg(args, "parent_levels").ulong_value(0); - char label[Trace::Session_label::size()]; - Arg_string::find_arg(args, "label").string(label, sizeof(label), ""); - if (arg_buffer_size > ram_quota) throw Root::Invalid_args(); return new (md_alloc()) Session_component(*md_alloc(), ram_quota, arg_buffer_size, - parent_levels, label, _sources, _policies); + parent_levels, label_from_args(args).string(), _sources, _policies); } void _upgrade_session(Session_component *s, const char *args) diff --git a/repos/dde_linux/src/lib/usb/raw/raw.cc b/repos/dde_linux/src/lib/usb/raw/raw.cc index fc38dde15..6b1d1974c 100644 --- a/repos/dde_linux/src/lib/usb/raw/raw.cc +++ b/repos/dde_linux/src/lib/usb/raw/raw.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -790,10 +790,10 @@ class Usb::Root : public Genode::Root_component { using namespace Genode; + Session_label const label = label_from_args(args); try { Xml_node config_node = Lx_kit::env().config_rom().xml(); Xml_node raw = config_node.sub_node("raw"); - Genode::Session_label label(args); Genode::Session_policy policy(label, raw); size_t ram_quota = Arg_string::find_arg(args, "ram_quota" ).ulong_value(0); @@ -822,7 +822,7 @@ class Usb::Root : public Genode::Root_component return session; } catch (Genode::Session_policy::No_policy_defined) { error("Invalid session request, no matching policy for '", - Genode::Session_label(args).string(), "'"); + label.string(), "'"); throw Genode::Root::Unavailable(); } } diff --git a/repos/dde_rump/src/server/rump_fs/main.cc b/repos/dde_rump/src/server/rump_fs/main.cc index ecd226960..0bfcd2a6a 100644 --- a/repos/dde_rump/src/server/rump_fs/main.cc +++ b/repos/dde_rump/src/server/rump_fs/main.cc @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -374,7 +374,7 @@ class File_system::Root : public Root_component Genode::Path session_root; bool writeable = false; - Session_label const label(args); + Session_label const label = label_from_args(args); size_t ram_quota = Arg_string::find_arg(args, "ram_quota").aligned_size(); diff --git a/repos/demo/src/lib/launchpad/launchpad.cc b/repos/demo/src/lib/launchpad/launchpad.cc index 318a7e9eb..dcba0f274 100644 --- a/repos/demo/src/lib/launchpad/launchpad.cc +++ b/repos/demo/src/lib/launchpad/launchpad.cc @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-2016 Genode Labs GmbH * Copyright (C) 2012 Intel Corporation * * This file is part of the Genode OS framework, which is distributed diff --git a/repos/gems/src/app/launcher/main.cc b/repos/gems/src/app/launcher/main.cc index 53b991a9c..28906c933 100644 --- a/repos/gems/src/app/launcher/main.cc +++ b/repos/gems/src/app/launcher/main.cc @@ -87,7 +87,7 @@ struct Launcher::Main void _handle_exited_child(unsigned) { - auto kill_child_fn = [&] (Child_base::Label label) { _panel_dialog.kill(label); }; + auto kill_child_fn = [&] (Label const &label) { _panel_dialog.kill(label); }; _subsystem_manager.for_each_exited_child(kill_child_fn); } diff --git a/repos/gems/src/app/launcher/panel_dialog.h b/repos/gems/src/app/launcher/panel_dialog.h index 477347340..e984edff3 100644 --- a/repos/gems/src/app/launcher/panel_dialog.h +++ b/repos/gems/src/app/launcher/panel_dialog.h @@ -509,7 +509,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator, _context_dialog.visible(false); } - void kill(Child_base::Label const &label) + void kill(Label const &label) { _kill(label); } diff --git a/repos/gems/src/app/launcher/subsystem_manager.h b/repos/gems/src/app/launcher/subsystem_manager.h index 6dc0d90b1..2c1b6979f 100644 --- a/repos/gems/src/app/launcher/subsystem_manager.h +++ b/repos/gems/src/app/launcher/subsystem_manager.h @@ -204,8 +204,8 @@ class Launcher::Subsystem_manager { Child::Binary_name const binary_name = _binary_name(subsystem); - Child::Label const label = string_attribute(subsystem, "name", - Child::Label("")); + Label const label = string_attribute(subsystem, "name", + Label("")); Ram_config const ram_config = _ram_config(subsystem); @@ -237,7 +237,7 @@ class Launcher::Subsystem_manager void kill(char const *label) { for (Child *c = _children.first(); c; c = c->next()) { - if (c->label() == Child::Label(label)) { + if (c->label() == Label(label)) { _children.remove(c); destroy(env()->heap(), c); return; @@ -248,7 +248,7 @@ class Launcher::Subsystem_manager /** * Call functor for each exited child * - * The functor takes a 'Child_base::Label' as argument. + * The functor takes a 'Label' as argument. */ template void for_each_exited_child(FUNC const &func) @@ -257,7 +257,7 @@ class Launcher::Subsystem_manager for (Child *child = _children.first(); child; child = next) { next = child->next(); if (child->exited()) - func(child->label()); + func(Label(child->label().string())); } } }; diff --git a/repos/gems/src/server/file_terminal/main.cc b/repos/gems/src/server/file_terminal/main.cc index 4167afb64..1e66b8c4e 100644 --- a/repos/gems/src/server/file_terminal/main.cc +++ b/repos/gems/src/server/file_terminal/main.cc @@ -228,7 +228,7 @@ namespace Terminal { Genode::size_t io_buffer_size = 4096; try { - Genode::Session_label label(args); + Genode::Session_label label = Genode::label_from_args(args); Genode::Session_policy policy(label); char filename[256]; diff --git a/repos/gems/src/server/tcp_terminal/main.cc b/repos/gems/src/server/tcp_terminal/main.cc index e4e174b55..19d9691c6 100644 --- a/repos/gems/src/server/tcp_terminal/main.cc +++ b/repos/gems/src/server/tcp_terminal/main.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2011-2013 Genode Labs GmbH + * Copyright (C) 2011-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. @@ -469,26 +469,28 @@ namespace Terminal { Session_component *_create_session(const char *args) { + using namespace Genode; + /* * XXX read I/O buffer size from args */ - Genode::size_t io_buffer_size = 4096; + size_t io_buffer_size = 4096; try { - Genode::Session_label label(args); - Genode::Session_policy policy(label); + Session_label const label = label_from_args(args); + Session_policy policy(label); unsigned tcp_port = 0; policy.attribute("port").value(&tcp_port); return new (md_alloc()) Session_component(io_buffer_size, tcp_port); - } catch (Genode::Xml_node::Nonexistent_attribute) { - PERR("Missing \"port\" attribute in policy definition"); - throw Genode::Root::Unavailable(); - } catch (Genode::Session_policy::No_policy_defined) { - PERR("Invalid session request, no matching policy"); - throw Genode::Root::Unavailable(); + } catch (Xml_node::Nonexistent_attribute) { + error("Missing \"port\" attribute in policy definition"); + throw Root::Unavailable(); + } catch (Session_policy::No_policy_defined) { + error("Invalid session request, no matching policy"); + throw Root::Unavailable(); } } diff --git a/repos/gems/src/server/wm/nitpicker.h b/repos/gems/src/server/wm/nitpicker.h index 9935e8425..255dde0d1 100644 --- a/repos/gems/src/server/wm/nitpicker.h +++ b/repos/gems/src/server/wm/nitpicker.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -1108,8 +1108,8 @@ class Wm::Nitpicker::Root : public Genode::Rpc_object char root[ROOT_MAX_LEN]; root[0] = 0; - Session_label label(args); + Session_label const label = label_from_args(args); try { Session_policy policy(label); diff --git a/repos/os/include/init/child.h b/repos/os/include/init/child.h index 26a15a339..08c1e66f3 100644 --- a/repos/os/include/init/child.h +++ b/repos/os/include/init/child.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2010-2013 Genode Labs GmbH + * Copyright (C) 2010-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. @@ -177,10 +177,8 @@ namespace Init { if (!service_matches) return false; - typedef Genode::String<128> Label; - - Label const session_label = - Label(skip_label_prefix(child_name, Genode::Session_label(args).string())); + Genode::Session_label const session_label(skip_label_prefix( + child_name, Genode::label_from_args(args).string())); return !Genode::Xml_node_label_score(service_node, session_label).conflict(); } diff --git a/repos/os/include/init/child_policy.h b/repos/os/include/init/child_policy.h index 63fa17919..1c41e0f9e 100644 --- a/repos/os/include/init/child_policy.h +++ b/repos/os/include/init/child_policy.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -93,17 +94,13 @@ class Init::Child_policy_enforce_labeling { using namespace Genode; - char label_buf[Parent::Session_args::MAX_SIZE]; - Arg_string::find_arg(args, "label").string(label_buf, sizeof(label_buf), ""); - - char value_buf[Parent::Session_args::MAX_SIZE]; - Genode::snprintf(value_buf, sizeof(value_buf), - "\"%s%s%s\"", - _name, - Genode::strcmp(label_buf, "") == 0 ? "" : " -> ", - label_buf); - - Arg_string::set_arg(args, args_len, "label", value_buf); + Session_label const old_label = label_from_args(args); + if (old_label == "") { + Arg_string::set_arg_string(args, args_len, "label", _name); + } else { + Session_label const new_label = prefixed_label(_name, old_label.string()); + Arg_string::set_arg_string(args, args_len, "label", new_label.string()); + } } }; diff --git a/repos/os/include/os/session_policy.h b/repos/os/include/os/session_policy.h index bd2974e7f..7730184af 100644 --- a/repos/os/include/os/session_policy.h +++ b/repos/os/include/os/session_policy.h @@ -16,11 +16,11 @@ #include #include +#include namespace Genode { struct Xml_node_label_score; - struct Session_label; class Session_policy; } @@ -153,30 +153,6 @@ struct Genode::Xml_node_label_score }; -struct Genode::Session_label : String<128> -{ - Session_label() { } - - /** - * Constructor - * - * \param args session arguments as null-terminated string - * - * The constructor extracts the label from the supplied session-argument - * string. - */ - explicit Session_label(char const *args) - { - typedef String<128> String; - - char buf[String::capacity()]; - Arg_string::find_arg(args, "label").string(buf, sizeof(buf), - ""); - *static_cast(this) = String(buf); - } -}; - - /** * Query server-side policy for a session request */ diff --git a/repos/os/include/report_rom/report_service.h b/repos/os/include/report_rom/report_service.h index e8e26dda9..c01942b02 100644 --- a/repos/os/include/report_rom/report_service.h +++ b/repos/os/include/report_rom/report_service.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -116,7 +116,7 @@ struct Report::Root : Genode::Root_component Arg_string::find_arg(args, "buffer_size").ulong_value(0); return new (md_alloc()) - Session_component(Genode::Session_label(args), buffer_size, + Session_component(label_from_args(args), buffer_size, _rom_registry, _verbose); } diff --git a/repos/os/include/report_rom/rom_service.h b/repos/os/include/report_rom/rom_service.h index d8482c54c..c79be3d6c 100644 --- a/repos/os/include/report_rom/rom_service.h +++ b/repos/os/include/report_rom/rom_service.h @@ -170,7 +170,7 @@ class Rom::Root : public Genode::Root_component using namespace Genode; return new (md_alloc()) - Session_component(_registry, Session_label(args)); + Session_component(_registry, label_from_args(args)); } public: diff --git a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h index 043621620..179d70d3b 100644 --- a/repos/os/src/drivers/platform/spec/x86/pci_session_component.h +++ b/repos/os/src/drivers/platform/spec/x86/pci_session_component.h @@ -504,7 +504,8 @@ namespace Platform { _device_slab(&_md_alloc), _device_pd_ep(device_pd_ep), _resources(_md_alloc), - _label(args), _policy(_label) + _label(Genode::label_from_args(args)), + _policy(_label) { /* non-pci devices */ _policy.for_each_sub_node("device", [&] (Genode::Xml_node device_node) { @@ -1073,7 +1074,7 @@ class Platform::Root : public Genode::Root_component args, _device_pd_ep); } catch (Genode::Session_policy::No_policy_defined) { PERR("Invalid session request, no matching policy for '%s'", - Genode::Session_label(args).string()); + Genode::label_from_args(args).string()); throw Genode::Root::Unavailable(); } } diff --git a/repos/os/src/drivers/uart/uart_component.h b/repos/os/src/drivers/uart/uart_component.h index 3dad003b3..56e246608 100644 --- a/repos/os/src/drivers/uart/uart_component.h +++ b/repos/os/src/drivers/uart/uart_component.h @@ -221,7 +221,7 @@ namespace Uart { Session_component *_create_session(const char *args) { try { - Session_label label(args); + Session_label label = label_from_args(args); Session_policy policy(label); unsigned index = 0; diff --git a/repos/os/src/server/fs_log/main.cc b/repos/os/src/server/fs_log/main.cc index aec9ac2f7..e92d933c8 100644 --- a/repos/os/src/server/fs_log/main.cc +++ b/repos/os/src/server/fs_log/main.cc @@ -5,7 +5,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. @@ -72,7 +72,7 @@ class Fs_log::Root_component : dir_path[0] = '/'; bool truncate = false; - Session_label session_label(args); + Session_label const session_label = label_from_args(args); char const *label_str = session_label.string(); char const *label_prefix = ""; diff --git a/repos/os/src/server/iso9660/main.cc b/repos/os/src/server/iso9660/main.cc index 39611e1b9..6d8d387e1 100644 --- a/repos/os/src/server/iso9660/main.cc +++ b/repos/os/src/server/iso9660/main.cc @@ -23,6 +23,7 @@ #include #include #include +#inlcude /* local includes */ #include "iso9660.h" diff --git a/repos/os/src/server/lx_fs/main.cc b/repos/os/src/server/lx_fs/main.cc index 8b784f5e9..786c77c2b 100644 --- a/repos/os/src/server/lx_fs/main.cc +++ b/repos/os/src/server/lx_fs/main.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2012-2013 Genode Labs GmbH + * Copyright (C) 2012-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. @@ -336,7 +336,7 @@ class File_system::Root : public Root_component char root[ROOT_MAX_LEN]; root[0] = 0; - Session_label label(args); + Session_label const label = label_from_args(args); try { Session_policy policy(label); diff --git a/repos/os/src/server/nic_bridge/component.h b/repos/os/src/server/nic_bridge/component.h index 1f97ddd09..844ee7d1e 100644 --- a/repos/os/src/server/nic_bridge/component.h +++ b/repos/os/src/server/nic_bridge/component.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2010-2013 Genode Labs GmbH + * Copyright (C) 2010-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. @@ -198,14 +198,12 @@ class Net::Root : public Genode::Root_component memset(ip_addr, 0, MAX_IP_ADDR_LENGTH); try { - Session_label label(args); + Session_label const label = label_from_args(args); Session_policy policy(label, _config); policy.attribute("ip_addr").value(ip_addr, sizeof(ip_addr)); } catch (Xml_node::Nonexistent_attribute) { Genode::log("Missing \"ip_addr\" attribute in policy definition"); - } catch (Session_policy::No_policy_defined) { - Genode::log("Invalid session request, no matching policy");; - } + } catch (Session_policy::No_policy_defined) { } size_t ram_quota = Arg_string::find_arg(args, "ram_quota" ).ulong_value(0); diff --git a/repos/os/src/server/nitpicker/background.h b/repos/os/src/server/nitpicker/background.h index 0bc7a76ad..e794ac763 100644 --- a/repos/os/src/server/nitpicker/background.h +++ b/repos/os/src/server/nitpicker/background.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. @@ -30,7 +30,7 @@ struct Background : private Texture_base, Session, View */ Background(Area size) : - Texture_base(Area(0, 0)), Session(Genode::Session_label("label=\"\"")), + Texture_base(Area(0, 0)), Session(Genode::Session_label()), View(*this, View::NOT_TRANSPARENT, View::BACKGROUND, 0), color(25, 37, 50) { diff --git a/repos/os/src/server/nitpicker/main.cc b/repos/os/src/server/nitpicker/main.cc index dc7174809..6013318ef 100644 --- a/repos/os/src/server/nitpicker/main.cc +++ b/repos/os/src/server/nitpicker/main.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2006-2013 Genode Labs GmbH + * Copyright (C) 2006-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. @@ -1037,11 +1037,11 @@ class Nitpicker::Root : public Genode::Root_component size_t const unused_quota = ram_quota - required_quota; - Session_label const label(args); - bool const provides_default_bg = (strcmp(label.string(), "backdrop") == 0); + Genode::Session_label const label = Genode::label_from_args(args); + bool const provides_default_bg = (label == "backdrop"); Session_component *session = new (md_alloc()) - Session_component(Session_label(args), _view_stack, _mode, + Session_component(label, _view_stack, _mode, _pointer_origin, *ep(), _framebuffer, provides_default_bg, *md_alloc(), unused_quota, _focus_reporter); diff --git a/repos/os/src/server/nitpicker/pointer_origin.h b/repos/os/src/server/nitpicker/pointer_origin.h index b696728ec..11341f189 100644 --- a/repos/os/src/server/nitpicker/pointer_origin.h +++ b/repos/os/src/server/nitpicker/pointer_origin.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -21,7 +21,7 @@ struct Pointer_origin : Session, View { Pointer_origin() : - Session(Genode::Session_label("")), + Session(Genode::Session_label()), View(*this, View::TRANSPARENT, View::NOT_BACKGROUND, 0) { } diff --git a/repos/os/src/server/part_blk/component.h b/repos/os/src/server/part_blk/component.h index d28cbdc47..b6c75b673 100644 --- a/repos/os/src/server/part_blk/component.h +++ b/repos/os/src/server/part_blk/component.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2013-2015 Genode Labs GmbH + * Copyright (C) 2013-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. @@ -208,7 +208,7 @@ class Block::Root : { long num = -1; - Session_label label(args); + Session_label const label = label_from_args(args); char const *label_str = label.string(); try { Session_policy policy(label); diff --git a/repos/os/src/server/ram_fs/main.cc b/repos/os/src/server/ram_fs/main.cc index cdea03549..142c01f70 100644 --- a/repos/os/src/server/ram_fs/main.cc +++ b/repos/os/src/server/ram_fs/main.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2012-2013 Genode Labs GmbH + * Copyright (C) 2012-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. @@ -433,7 +433,7 @@ namespace File_system { char root[ROOT_MAX_LEN]; root[0] = 0; - Session_label label(args); + Session_label const label = label_from_args(args); try { Session_policy policy(label); diff --git a/repos/os/src/server/trace_fs/main.cc b/repos/os/src/server/trace_fs/main.cc index ba427f1e4..5c6c02f4c 100644 --- a/repos/os/src/server/trace_fs/main.cc +++ b/repos/os/src/server/trace_fs/main.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2014 Genode Labs GmbH + * Copyright (C) 2014-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. @@ -947,7 +947,7 @@ class File_system::Root : public Root_component Genode::Number_of_bytes buffer_size_max = 1 * (1 << 20); /* 1 MiB */ unsigned trace_parent_levels = 0; - Session_label label(args); + Session_label const label = label_from_args(args); try { Session_policy policy(label); diff --git a/repos/os/src/server/vfs/main.cc b/repos/os/src/server/vfs/main.cc index 9d8ca2c75..301621596 100644 --- a/repos/os/src/server/vfs/main.cc +++ b/repos/os/src/server/vfs/main.cc @@ -593,7 +593,7 @@ class Vfs_server::Root : Path session_root; bool writeable = false; - Session_label const label(args); + Session_label const label = label_from_args(args); char tmp[MAX_PATH_LEN]; try {