diff --git a/repos/base-hw/src/test/cpu_quota/include/sync_session/connection.h b/repos/base-hw/src/test/cpu_quota/include/sync_session/connection.h index 725f6eec2d..049530a455 100644 --- a/repos/base-hw/src/test/cpu_quota/include/sync_session/connection.h +++ b/repos/base-hw/src/test/cpu_quota/include/sync_session/connection.h @@ -29,7 +29,7 @@ struct Sync::Connection : public Genode::Connection, { explicit Connection(Genode::Env &env) : - Genode::Connection(env, session(env.parent(), "ram_quota=4K")), + Genode::Connection(env, Label(), Ram_quota { 4*1024 }, Args()), Genode::Rpc_client(cap()) { } diff --git a/repos/base/include/cpu_session/connection.h b/repos/base/include/cpu_session/connection.h index ac0368abfd..30a44dfb4c 100644 --- a/repos/base/include/cpu_session/connection.h +++ b/repos/base/include/cpu_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -22,23 +22,19 @@ namespace Genode { struct Cpu_connection; } struct Genode::Cpu_connection : Connection, Cpu_session_client { - enum { RAM_QUOTA = 36*1024 }; - /** * Constructor * - * \param label initial session label * \param priority designated priority of all threads created * with this CPU session */ - Cpu_connection(Env &env, const char *label = "", long priority = DEFAULT_PRIORITY, + Cpu_connection(Env &env, + Label const &label = Label(), + long priority = DEFAULT_PRIORITY, Affinity const &affinity = Affinity()) : - Connection(env, - session(env.parent(), affinity, - "priority=0x%lx, ram_quota=%u, " - "cap_quota=%u, label=\"%s\"", - priority, RAM_QUOTA, CAP_QUOTA, label)), + Connection(env, label, Ram_quota { RAM_QUOTA }, affinity, + Args("priority=", Hex(priority))), Cpu_session_client(cap()) { } diff --git a/repos/base/include/cpu_session/cpu_session.h b/repos/base/include/cpu_session/cpu_session.h index 67389f49e1..1af3b390a2 100644 --- a/repos/base/include/cpu_session/cpu_session.h +++ b/repos/base/include/cpu_session/cpu_session.h @@ -43,7 +43,7 @@ struct Genode::Cpu_session : Session * allocation, its session capability, the capability of the 'Native_cpu' * RPC interface, and a capability for the trace-control dataspace. */ - enum { CAP_QUOTA = 6 }; + enum { CAP_QUOTA = 6, RAM_QUOTA = 36*1024 }; typedef Cpu_session_client Client; diff --git a/repos/base/include/io_mem_session/connection.h b/repos/base/include/io_mem_session/connection.h index e8deb1969b..18ae658d90 100644 --- a/repos/base/include/io_mem_session/connection.h +++ b/repos/base/include/io_mem_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -31,12 +31,10 @@ struct Genode::Io_mem_connection : Connection, Io_mem_session_cl */ Io_mem_connection(Env &env, addr_t base, size_t size, bool write_combined = false) : - Connection(env, - session(env.parent(), - "cap_quota=%u, ram_quota=%u, " - "base=0x%p, size=0x%lx, wc=%s", - CAP_QUOTA, RAM_QUOTA, base, size, - write_combined ? "yes" : "no")), + Connection(env, Label(), Ram_quota { RAM_QUOTA }, + Args("base=", Hex(base), ", " + "size=", Hex(size), ", " + "wc=", write_combined ? "yes" : "no")), Io_mem_session_client(cap()) { } }; diff --git a/repos/base/include/io_mem_session/io_mem_session.h b/repos/base/include/io_mem_session/io_mem_session.h index 90d774e939..bdb1e4a8a1 100644 --- a/repos/base/include/io_mem_session/io_mem_session.h +++ b/repos/base/include/io_mem_session/io_mem_session.h @@ -41,7 +41,7 @@ struct Genode::Io_mem_session : Session * session-object allocation, its session capability, and a dataspace * capability for the handed-out memory-mapped I/O dataspace. */ - enum { CAP_QUOTA = 3, RAM_QUOTA = 6 * 1024 }; + enum { CAP_QUOTA = 3, RAM_QUOTA = 6*1024 }; virtual ~Io_mem_session() { } diff --git a/repos/base/include/io_port_session/connection.h b/repos/base/include/io_port_session/connection.h index c7384b4b23..783875c72f 100644 --- a/repos/base/include/io_port_session/connection.h +++ b/repos/base/include/io_port_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -23,17 +23,6 @@ namespace Genode { struct Io_port_connection; } struct Genode::Io_port_connection : Connection, Io_port_session_client { - /** - * Issue session request - * - * \noapi - */ - Capability _session(Parent &parent, unsigned base, unsigned size) - { - return session(parent, "ram_quota=%u, cap_quota=%u, io_port_base=%u, io_port_size=%u", - RAM_QUOTA, CAP_QUOTA, base, size); - } - /** * Constructor * @@ -42,11 +31,9 @@ struct Genode::Io_port_connection : Connection, */ Io_port_connection(Env &env, unsigned base, unsigned size) : - Connection(env, - session(env.parent(), - "ram_quota=%u, cap_quota=%u, " - "io_port_base=%u, io_port_size=%u", - RAM_QUOTA, CAP_QUOTA, base, size)), + Connection(env, Label(), Ram_quota { RAM_QUOTA }, + Args("io_port_base=", base, ", " + "io_port_size=", size)), Io_port_session_client(cap()) { } }; diff --git a/repos/base/include/io_port_session/io_port_session.h b/repos/base/include/io_port_session/io_port_session.h index 24d7cfcd9d..b440d44803 100644 --- a/repos/base/include/io_port_session/io_port_session.h +++ b/repos/base/include/io_port_session/io_port_session.h @@ -38,10 +38,11 @@ struct Genode::Io_port_session : Session */ static const char *service_name() { return "IO_PORT"; } - enum { RAM_QUOTA = 6 * 1024, CAP_QUOTA = 2 }; + enum { CAP_QUOTA = 2, RAM_QUOTA = 6*1024 }; virtual ~Io_port_session() { } + /****************************** ** Read value from I/O port ** ******************************/ diff --git a/repos/base/include/irq_session/connection.h b/repos/base/include/irq_session/connection.h index f4b8f85ced..d502c7a69c 100644 --- a/repos/base/include/irq_session/connection.h +++ b/repos/base/include/irq_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -19,47 +19,27 @@ namespace Genode { struct Irq_connection; } + struct Genode::Irq_connection : Connection, Irq_session_client { /** * Constructor * - * \param irq physical interrupt number + * \param label physical interrupt number * \param trigger interrupt trigger (e.g., level/edge) * \param polarity interrupt trigger polarity (e.g., low/high) */ - Irq_connection(Env &env, - unsigned irq, - Irq_session::Trigger trigger = Irq_session::TRIGGER_UNCHANGED, - Irq_session::Polarity polarity = Irq_session::POLARITY_UNCHANGED, - Genode::addr_t device_config_phys = 0) + Irq_connection(Env &env, + Label const &label, + Trigger trigger = Irq_session::TRIGGER_UNCHANGED, + Polarity polarity = Irq_session::POLARITY_UNCHANGED, + addr_t device_config_phys = 0) : - Connection(env, session(env.parent(), - "ram_quota=%u, cap_quota=%u, " - "irq_number=%u, irq_trigger=%u, " - "irq_polarity=%u, device_config_phys=0x%lx", - RAM_QUOTA, CAP_QUOTA, - irq, trigger, polarity, device_config_phys)), - Irq_session_client(cap()) - { } - - /** - * Constructor for label-based configuration (used by pin driver) - * - * \param label session label - */ - Irq_connection(Env &env, - char const *label) - : - Connection(env, session(env.parent(), - "ram_quota=%u, cap_quota=%u, " - "irq_number=%u, irq_trigger=%u, " - "irq_polarity=%u, device_config_phys=0x%lx, " - "label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, 0, - Irq_session::TRIGGER_UNCHANGED, - Irq_session::POLARITY_UNCHANGED, - 0, label)), + Connection(env, label, Ram_quota { RAM_QUOTA }, + Args("irq_number=", label, ", " + "irq_trigger=", unsigned(trigger), ", " + "irq_polarity=", unsigned(polarity), ", " + "device_config_phys=", Hex(device_config_phys))), Irq_session_client(cap()) { } }; diff --git a/repos/base/include/irq_session/irq_session.h b/repos/base/include/irq_session/irq_session.h index cb6807bc49..900816e11f 100644 --- a/repos/base/include/irq_session/irq_session.h +++ b/repos/base/include/irq_session/irq_session.h @@ -78,7 +78,7 @@ struct Genode::Irq_session : Session */ static const char * service_name() { return "IRQ"; } - enum { CAP_QUOTA = 3, RAM_QUOTA = 6 * 1024 }; + enum { CAP_QUOTA = 3, RAM_QUOTA = 6*1024 }; /********************* diff --git a/repos/base/include/log_session/connection.h b/repos/base/include/log_session/connection.h index 330e92ddb0..1ed3ef2f53 100644 --- a/repos/base/include/log_session/connection.h +++ b/repos/base/include/log_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -16,23 +16,15 @@ #include #include -#include namespace Genode { struct Log_connection; } struct Genode::Log_connection : Connection, Log_session_client { - enum { RAM_QUOTA = 8*1024UL }; - - /** - * Constructor - */ - Log_connection(Env &env, Session_label label = Session_label()) + Log_connection(Env &env, Session_label const &label = Session_label()) : - Connection(env, session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label.string())), + Connection(env, label, Ram_quota { RAM_QUOTA }, Args()), Log_session_client(cap()) { } }; diff --git a/repos/base/include/log_session/log_session.h b/repos/base/include/log_session/log_session.h index 5c7969824a..4c029ac3a0 100644 --- a/repos/base/include/log_session/log_session.h +++ b/repos/base/include/log_session/log_session.h @@ -37,7 +37,7 @@ struct Genode::Log_session : Session * A LOG connection consumes a dataspace capability for the session-object * allocation and its session capability. */ - enum { CAP_QUOTA = 2 }; + enum { CAP_QUOTA = 2, RAM_QUOTA = 8*1024 }; typedef Log_session_client Client; diff --git a/repos/base/include/pd_session/connection.h b/repos/base/include/pd_session/connection.h index 49a8911a4a..94bcf38968 100644 --- a/repos/base/include/pd_session/connection.h +++ b/repos/base/include/pd_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -22,19 +22,12 @@ namespace Genode { struct Pd_connection; } struct Genode::Pd_connection : Connection, Pd_session_client { - enum { RAM_QUOTA = 24*1024*sizeof(long)}; enum Virt_space { UNCONSTRAIN = 0, CONSTRAIN = 1 }; - /** - * Constructor - * - * \param label session label - */ - Pd_connection(Env &env, char const *label = "", Virt_space space = CONSTRAIN) + Pd_connection(Env &env, Label const &label = Label(), Virt_space space = CONSTRAIN) : - Connection(env, session(env.parent(), - "ram_quota=%u, cap_quota=%u, label=\"%s\", virt_space=%u", - RAM_QUOTA, CAP_QUOTA, label, space)), + Connection(env, label, Ram_quota { RAM_QUOTA }, + Args("virt_space=", unsigned(space))), Pd_session_client(cap()) { } @@ -45,11 +38,9 @@ struct Genode::Pd_connection : Connection, Pd_session_client */ Pd_connection(Env &env, Device_pd) : - Connection(env, session(env.parent(), - "ram_quota=%u, cap_quota=%u, " - "label=\"device PD\", virt_space=%u, " - "managing_system=yes", - RAM_QUOTA, CAP_QUOTA, UNCONSTRAIN)), + Connection(env, "device PD", Ram_quota { RAM_QUOTA }, + Args("virt_space=", unsigned(UNCONSTRAIN), ", " + "managing_system=yes")), Pd_session_client(cap()) { } }; diff --git a/repos/base/include/pd_session/pd_session.h b/repos/base/include/pd_session/pd_session.h index 9f6c7871c4..ca42977660 100644 --- a/repos/base/include/pd_session/pd_session.h +++ b/repos/base/include/pd_session/pd_session.h @@ -46,7 +46,7 @@ struct Genode::Pd_session : Session, Ram_allocator * Furthermore, we account for the dataspace capabilities allocated during * the component bootstrapping. */ - enum { CAP_QUOTA = 6 + 7 }; + enum { CAP_QUOTA = 6 + 7, RAM_QUOTA = 24*1024*sizeof(long) }; typedef Pd_session_client Client; diff --git a/repos/base/include/rm_session/connection.h b/repos/base/include/rm_session/connection.h index 0b6b7cf92c..0ef432bf7c 100644 --- a/repos/base/include/rm_session/connection.h +++ b/repos/base/include/rm_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2018 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -23,21 +23,14 @@ namespace Genode { struct Rm_connection; } struct Genode::Rm_connection : Connection, Rm_session_client { - enum { RAM_QUOTA = 64*1024 }; - - /** - * Constructor - */ Rm_connection(Env &env) : - Connection(env, session(env.parent(), "ram_quota=%u, cap_quota=%u", - RAM_QUOTA, CAP_QUOTA)), + Connection(env, Label(), Ram_quota { 64*1024 }, Args()), Rm_session_client(cap()) { } /** - * Wrapper over 'create' that handles resource requests - * from the server. + * Wrapper over 'create' that handles resource requests from the server */ Capability create(size_t size) override { diff --git a/repos/base/include/rom_session/connection.h b/repos/base/include/rom_session/connection.h index ce1b9badf4..fd33e0ac71 100644 --- a/repos/base/include/rom_session/connection.h +++ b/repos/base/include/rom_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -16,35 +16,28 @@ #include #include -#include namespace Genode { class Rom_connection; } -struct Genode::Rom_connection : Connection, - Rom_session_client +struct Genode::Rom_connection : Connection, Rom_session_client { - class Rom_connection_failed : public Service_denied { }; - - enum { RAM_QUOTA = 6*1024UL }; + struct Rom_connection_failed : Service_denied { }; /** * Constructor * - * \param label request label and name of ROM module + * \param label name of requested ROM module * * \throw Rom_connection_failed */ - Rom_connection(Env &env, const char *label) + Rom_connection(Env &env, Session_label const &label) try : - Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label)), + Connection(env, label, Ram_quota { RAM_QUOTA }, Args()), Rom_session_client(cap()) { } catch (...) { - error("Could not open ROM session for \"", label, "\""); + error("could not open ROM session for \"", label, "\""); throw Rom_connection_failed(); } }; diff --git a/repos/base/include/rom_session/rom_session.h b/repos/base/include/rom_session/rom_session.h index 9a81086acc..d79efd3efc 100644 --- a/repos/base/include/rom_session/rom_session.h +++ b/repos/base/include/rom_session/rom_session.h @@ -46,7 +46,7 @@ struct Genode::Rom_session : Session * allocation, a dataspace capability for the ROM dataspace, and its * session capability. */ - enum { CAP_QUOTA = 3 }; + enum { CAP_QUOTA = 3, RAM_QUOTA = 6*1024 }; typedef Rom_session_client Client; diff --git a/repos/base/include/timer_session/connection.h b/repos/base/include/timer_session/connection.h index 4f24dea770..c077ce0e99 100644 --- a/repos/base/include/timer_session/connection.h +++ b/repos/base/include/timer_session/connection.h @@ -256,14 +256,15 @@ class Timer::Connection : public Genode::Connection, * \param label optional label used in session routing */ Connection(Genode::Env &env, - Genode::Entrypoint & ep, - char const *label = ""); + Genode::Entrypoint &ep, + Label const &label = Label()); /** * Convenience constructor wrapper using the environment's entrypoint as * timeout handler execution context */ - Connection(Genode::Env &env, char const *label = ""); + Connection(Genode::Env &env, Label const &label = Label()) + : Connection(env, env.ep(), label) { } ~Connection() { _sig_rec.dissolve(&_default_sigh_ctx); } diff --git a/repos/base/include/trace_session/connection.h b/repos/base/include/trace_session/connection.h index 260d3eff79..3306690aa7 100644 --- a/repos/base/include/trace_session/connection.h +++ b/repos/base/include/trace_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2013-2017 Genode Labs GmbH + * Copyright (C) 2013-2023 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. @@ -39,9 +39,9 @@ struct Genode::Trace::Connection : Genode::Connection, */ Connection(Env &env, size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) : - Genode::Connection(env, - session(env.parent(), "ram_quota=%lu, arg_buffer_size=%lu, parent_levels=%u", - ram_quota + 10*1024, arg_buffer_size, parent_levels)), + Genode::Connection(env, Label(), Ram_quota { 10*1024 + ram_quota }, + Args("arg_buffer_size=", arg_buffer_size, ", " + "parent_levels=", parent_levels)), Session_client(env.rm(), cap()) { } diff --git a/repos/base/include/vm_session/connection.h b/repos/base/include/vm_session/connection.h index b957846fa9..080582b078 100644 --- a/repos/base/include/vm_session/connection.h +++ b/repos/base/include/vm_session/connection.h @@ -9,7 +9,7 @@ */ /* - * Copyright (C) 2012-2021 Genode Labs GmbH + * Copyright (C) 2012-2023 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. @@ -35,19 +35,6 @@ namespace Genode { struct Genode::Vm_connection : Connection, Rpc_client { - /** - * Issue session request - * - * \noapi - */ - Capability _session(Parent &parent, char const *label, long priority, - unsigned long affinity) - { - return session(parent, - "priority=0x%lx, affinity=0x%lx, ram_quota=16K, cap_quota=10, label=\"%s\"", - priority, affinity, label); - } - /* * VM-Exit state-transfer configuration * @@ -82,15 +69,16 @@ struct Genode::Vm_connection : Connection, Rpc_client /** * Constructor * - * \param label initial session label * \param priority designated priority of the VM * \param affinity which physical CPU the VM should run on top of */ - Vm_connection(Env &env, const char *label = "", + Vm_connection(Env &env, Label const &label = Label(), long priority = Cpu_session::DEFAULT_PRIORITY, unsigned long affinity = 0) : - Connection(env, _session(env.parent(), label, priority, affinity)), + Connection(env, label, Ram_quota { 16*1024 }, Affinity(), + Args("priority=", Hex(priority), ", " + "affinity=", Hex(affinity))), Rpc_client(cap()) { } @@ -107,6 +95,7 @@ struct Genode::Vm_connection : Connection, Rpc_client ); } + /************************** ** Vm_session interface ** **************************/ diff --git a/repos/base/include/vm_session/vm_session.h b/repos/base/include/vm_session/vm_session.h index e4087759c3..1872f9ce3c 100644 --- a/repos/base/include/vm_session/vm_session.h +++ b/repos/base/include/vm_session/vm_session.h @@ -37,7 +37,7 @@ struct Genode::Vm_session : Session bool writeable; }; - enum { CAP_QUOTA = 3 }; + enum { CAP_QUOTA = 10 }; class Invalid_dataspace : Exception { }; class Region_conflict : Exception { }; diff --git a/repos/base/lib/symbols/ld b/repos/base/lib/symbols/ld index 5a04b7470d..4af8270e0a 100644 --- a/repos/base/lib/symbols/ld +++ b/repos/base/lib/symbols/ld @@ -43,10 +43,8 @@ _Z16main_thread_utcbv T _Z22__ldso_raise_exceptionv T _ZN5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_handlerE T _ZN5Timer10Connection9curr_timeEv T -_ZN5Timer10ConnectionC1ERN6Genode3EnvEPKc T -_ZN5Timer10ConnectionC1ERN6Genode3EnvERNS1_10EntrypointEPKc T -_ZN5Timer10ConnectionC2ERN6Genode3EnvEPKc T -_ZN5Timer10ConnectionC2ERN6Genode3EnvERNS1_10EntrypointEPKc T +_ZN5Timer10ConnectionC1ERN6Genode3EnvERNS1_10EntrypointERKNS1_13Session_labelE T +_ZN5Timer10ConnectionC2ERN6Genode3EnvERNS1_10EntrypointERKNS1_13Session_labelE T _ZN6Genode10Entrypoint16_dispatch_signalERNS_6SignalE T _ZN6Genode10Entrypoint16schedule_suspendEPFvvES2_ T _ZN6Genode10Entrypoint22Signal_proxy_component6signalEv T diff --git a/repos/base/src/core/main.cc b/repos/base/src/core/main.cc index e0c3fb0f1e..2d1d15f250 100644 --- a/repos/base/src/core/main.cc +++ b/repos/base/src/core/main.cc @@ -304,7 +304,7 @@ int main() /* CPU session representing core */ static Cpu_session_component core_cpu(ep, - Session::Resources{{Cpu_connection::RAM_QUOTA}, + Session::Resources{{Cpu_session::RAM_QUOTA}, {Cpu_session::CAP_QUOTA}}, "core", Session::Diag{false}, core_ram_alloc, local_rm, ep, pager_ep, Core::Trace::sources(), "", diff --git a/repos/base/src/lib/timeout/timer_connection.cc b/repos/base/src/lib/timeout/timer_connection.cc index 8d90e56459..c38718e711 100644 --- a/repos/base/src/lib/timeout/timer_connection.cc +++ b/repos/base/src/lib/timeout/timer_connection.cc @@ -120,12 +120,9 @@ void Timer::Connection::set_timeout(Microseconds duration, } -Timer::Connection::Connection(Genode::Env &env, Genode::Entrypoint &ep, - char const *label) +Timer::Connection::Connection(Env &env, Entrypoint &ep, Label const &label) : - Genode::Connection(env, session(env.parent(), - "ram_quota=10K, cap_quota=%u, label=\"%s\"", - CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 10*1024 }, Args()), Session_client(cap()), _signal_handler(ep, *this, &Connection::_handle_timeout) { @@ -134,10 +131,6 @@ Timer::Connection::Connection(Genode::Env &env, Genode::Entrypoint &ep, } -Timer::Connection::Connection(Genode::Env &env, char const *label) -: Timer::Connection(env, env.ep(), label) {} - - Timeout_scheduler &Timer::Connection::_switch_to_timeout_framework_mode() { if (_mode == TIMEOUT_FRAMEWORK) { @@ -148,7 +141,6 @@ Timeout_scheduler &Timer::Connection::_switch_to_timeout_framework_mode() _timeout_scheduler._enable(); - /* do initial calibration burst to make interpolation available earlier */ for (unsigned i = 0; i < NR_OF_INITIAL_CALIBRATIONS; i++) { _update_real_time(); diff --git a/repos/base/src/timer/epit/imx6/timer.cc b/repos/base/src/timer/epit/imx6/timer.cc index 9747f8e072..39ff5e5e10 100644 --- a/repos/base/src/timer/epit/imx6/timer.cc +++ b/repos/base/src/timer/epit/imx6/timer.cc @@ -26,7 +26,7 @@ Timer::Time_source::Time_source(Env &env) : Attached_mmio(env, Imx6::EPIT_2_MMIO_BASE, Imx6::EPIT_2_MMIO_SIZE), Signalled_time_source(env), - _timer_irq(env, Imx6::EPIT_2_IRQ) + _timer_irq(env, unsigned(Imx6::EPIT_2_IRQ)) { _timer_irq.sigh(_signal_handler); while (read()) ; diff --git a/repos/base/src/timer/gpt/imx7/timer.cc b/repos/base/src/timer/gpt/imx7/timer.cc index b7d841ec54..b62e97c4a6 100644 --- a/repos/base/src/timer/gpt/imx7/timer.cc +++ b/repos/base/src/timer/gpt/imx7/timer.cc @@ -26,4 +26,4 @@ enum { Timer::Time_source::Time_source(Env &env) : Attached_mmio(env, MMIO_BASE, MMIO_SIZE), Signalled_time_source(env), - _timer_irq(env, IRQ) { _initialize(); } + _timer_irq(env, unsigned(IRQ)) { _initialize(); } diff --git a/repos/base/src/timer/pit/time_source.cc b/repos/base/src/timer/pit/time_source.cc index 83b47bc72d..86458070d4 100644 --- a/repos/base/src/timer/pit/time_source.cc +++ b/repos/base/src/timer/pit/time_source.cc @@ -200,7 +200,7 @@ Timer::Time_source::Time_source(Env &env) : Signalled_time_source(env), _io_port(env, PIT_DATA_PORT_0, PIT_CMD_PORT - PIT_DATA_PORT_0 + 1), - _timer_irq(env, IRQ_PIT) + _timer_irq(env, unsigned(IRQ_PIT)) { /* operate PIT in one-shot mode */ _io_port.outb(PIT_CMD_PORT, PIT_CMD_SELECT_CHANNEL_0 | diff --git a/repos/hello_tutorial/doc/hello_tutorial.txt b/repos/hello_tutorial/doc/hello_tutorial.txt index 8cf1a95a6e..7c7cb2e1f6 100644 --- a/repos/hello_tutorial/doc/hello_tutorial.txt +++ b/repos/hello_tutorial/doc/hello_tutorial.txt @@ -76,7 +76,7 @@ C++ class in 'include/hello_session/hello_session.h' !{ ! static const char *service_name() { return "Hello"; } ! -! enum { CAP_QUOTA = 2 }; +! enum { CAP_QUOTA = 4 }; ! ! virtual void say_hello() = 0; ! virtual int add(int a, int b) = 0; @@ -93,12 +93,10 @@ across component boundaries. Furthermore, we use the interface to specify the name of the service by providing the 'service_name' method. This method will later be used by both the server for announcing the service at its parent and the client for -requesting the creation of a "Hello" session. The 'CAP_QUOTA' definition -specifies the amount of capabilities required to establish the session. -The specified amount is transferred from the client to the server at session -creation time. For the "Hello" session, two capabilities are required, namely -a dataspace capability for the server-side memory occupied by the session -object and the actual session capability that refers to the RPC interface. +requesting the creation of a "Hello" session. The 'resources' definition +specifies the amount of capabilities and RAM required by the server to +establish the session. The specified amount is transferred from the client +to the server at session creation time. The 'GENODE_RPC' macro is used to declare an RPC function. Its first argument is a type name that is used to refer to the RPC function. The type name can @@ -351,10 +349,11 @@ of the session interface. For our case, the file ! Connection(Genode::Env &env) ! : ! /* create session */ -! Genode::Connection(env, session(env.parent(), -! "ram_quota=4K, cap_quota=4")), +! Genode::Connection(env, Label(), +! Ram_quota { 8*1024 }, Args()), ! /* initialize RPC interface */ -! Session_client(cap()) { } +! Session_client(cap()) +! { } !}; diff --git a/repos/hello_tutorial/include/hello_session/connection.h b/repos/hello_tutorial/include/hello_session/connection.h index a21b0109fe..c5cc2cdddf 100644 --- a/repos/hello_tutorial/include/hello_session/connection.h +++ b/repos/hello_tutorial/include/hello_session/connection.h @@ -25,11 +25,11 @@ struct Hello::Connection : Genode::Connection, Session_client Connection(Genode::Env &env) : /* create session */ - Genode::Connection(env, session(env.parent(), - "ram_quota=6K, cap_quota=4")), - + Genode::Connection(env, Label(), + Ram_quota { 8*1024 }, Args()), /* initialize RPC interface */ - Session_client(cap()) { } + Session_client(cap()) + { } }; #endif /* _INCLUDE__HELLO_SESSION__CONNECTION_H_ */ diff --git a/repos/hello_tutorial/include/hello_session/hello_session.h b/repos/hello_tutorial/include/hello_session/hello_session.h index 8ff65e2ea8..7dfa2f10bf 100644 --- a/repos/hello_tutorial/include/hello_session/hello_session.h +++ b/repos/hello_tutorial/include/hello_session/hello_session.h @@ -24,7 +24,7 @@ struct Hello::Session : Genode::Session { static const char *service_name() { return "Hello"; } - enum { CAP_QUOTA = 2 }; + enum { CAP_QUOTA = 4 }; virtual void say_hello() = 0; virtual int add(int a, int b) = 0; diff --git a/repos/libports/src/lib/libc/internal/clone_session.h b/repos/libports/src/lib/libc/internal/clone_session.h index c390822f4e..074d0c307f 100644 --- a/repos/libports/src/lib/libc/internal/clone_session.h +++ b/repos/libports/src/lib/libc/internal/clone_session.h @@ -57,10 +57,7 @@ struct Libc::Clone_connection : Connection, Clone_connection(Genode::Env &env) : - Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld", - RAM_QUOTA, CAP_QUOTA)), + Connection(env, Label(), Ram_quota { RAM_QUOTA }, Args()), Rpc_client(cap()), _buffer(env.rm(), call()) { } diff --git a/repos/os/include/audio_in_session/connection.h b/repos/os/include/audio_in_session/connection.h index 26b48aa8c3..4893c80d05 100644 --- a/repos/os/include/audio_in_session/connection.h +++ b/repos/os/include/audio_in_session/connection.h @@ -23,17 +23,6 @@ namespace Audio_in { struct Connection; } struct Audio_in::Connection : Genode::Connection, Audio_in::Session_client { - /** - * Issue session request - * - * \noapi - */ - Genode::Capability _session(Genode::Parent &parent, char const *channel) - { - return session(parent, "ram_quota=%ld, cap_quota=%ld, channel=\"%s\"", - 10*1024 + sizeof(Stream), CAP_QUOTA, channel); - } - /** * Constructor * @@ -43,7 +32,9 @@ struct Audio_in::Connection : Genode::Connection, Audio_in::Session_cli */ Connection(Genode::Env &env, char const *channel, bool progress_signal = false) : - Genode::Connection(env, _session(env.parent(), channel)), + Genode::Connection(env, Label(), + Ram_quota { 10*1024 + sizeof(Stream) }, + Args("channel=\"", channel, "\"")), Session_client(env.rm(), cap(), progress_signal) { } }; diff --git a/repos/os/include/audio_out_session/connection.h b/repos/os/include/audio_out_session/connection.h index 9c11a7c96a..32589464b4 100644 --- a/repos/os/include/audio_out_session/connection.h +++ b/repos/os/include/audio_out_session/connection.h @@ -38,10 +38,9 @@ struct Audio_out::Connection : Genode::Connection, Audio_out::Session_c bool alloc_signal = true, bool progress_signal = false) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, channel=\"%s\"", - 2*4096 + 2048 + sizeof(Stream), CAP_QUOTA, channel)), + Genode::Connection(env, Label(), + Ram_quota { 2*4096 + 2048 + sizeof(Stream) }, + Args("channel=\"", channel, "\"")), Session_client(env.rm(), cap(), alloc_signal, progress_signal) { } }; diff --git a/repos/os/include/block_session/connection.h b/repos/os/include/block_session/connection.h index 5b6a9c9e07..d4478892d8 100644 --- a/repos/os/include/block_session/connection.h +++ b/repos/os/include/block_session/connection.h @@ -19,7 +19,7 @@ */ /* - * Copyright (C) 2019 Genode Labs GmbH + * Copyright (C) 2019-2023 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. @@ -233,12 +233,11 @@ struct Block::Connection : Genode::Connection, Session_client Connection(Genode::Env &env, Genode::Range_allocator *tx_block_alloc, Genode::size_t tx_buf_size = 128*1024, - const char *label = "") + Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, tx_buf_size=%ld, label=\"%s\"", - 14*1024 + tx_buf_size, CAP_QUOTA, tx_buf_size, label)), + Genode::Connection(env, label, + Ram_quota { 14*1024 + tx_buf_size }, + Args("tx_buf_size=", tx_buf_size)), Session_client(cap(), *tx_block_alloc, env.rm()), _max_block_count(_init_max_block_count(_tx.source()->bulk_buffer_size())) { } diff --git a/repos/os/include/capture_session/connection.h b/repos/os/include/capture_session/connection.h index 5123702cdb..975cc9e9bc 100644 --- a/repos/os/include/capture_session/connection.h +++ b/repos/os/include/capture_session/connection.h @@ -26,10 +26,6 @@ namespace Capture { class Connection; } class Capture::Connection : public Genode::Connection, public Session_client { - public: - - enum { RAM_QUOTA = 36*1024UL }; - private: size_t _session_quota = 0; @@ -39,12 +35,10 @@ class Capture::Connection : public Genode::Connection, /** * Constructor */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection( - env, session(env.parent(), - "ram_quota=%u, cap_quota=%u, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label)), + Genode::Connection(env, label, + Ram_quota { 36*1024 }, Args()), Session_client(cap()) { } diff --git a/repos/os/include/event_session/connection.h b/repos/os/include/event_session/connection.h index 664185f69a..9623bfa04f 100644 --- a/repos/os/include/event_session/connection.h +++ b/repos/os/include/event_session/connection.h @@ -19,19 +19,12 @@ namespace Event { struct Connection; } + struct Event::Connection : Genode::Connection, Session_client { - enum { RAM_QUOTA = 18*1024UL }; - - /** - * Constructor - */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%u, cap_quota=%u, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 18*1024 }, Args()), Session_client(env.rm(), cap()) { } }; diff --git a/repos/os/include/file_system_session/connection.h b/repos/os/include/file_system_session/connection.h index 8b7ea53f83..6ddf61d816 100644 --- a/repos/os/include/file_system_session/connection.h +++ b/repos/os/include/file_system_session/connection.h @@ -66,23 +66,16 @@ struct File_system::Connection : Genode::Connection, Session_client */ Connection(Genode::Env &env, Genode::Range_allocator &tx_block_alloc, - char const *label = "", - char const *root = "/", + Label const &label = Label(), + char const *root = "/", bool writeable = true, size_t tx_buf_size = DEFAULT_TX_BUF_SIZE) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, " - "cap_quota=%ld, " - "tx_buf_size=%ld, " - "label=\"%s\", " - "root=\"%s\", " - "writeable=%d", - 8*1024*sizeof(long) + tx_buf_size, - CAP_QUOTA, - tx_buf_size, - label, root, writeable)), + Genode::Connection(env, label, + Ram_quota { 8*1024*sizeof(long) + tx_buf_size }, + Args("root=\"", root, "\", " + "writeable=", writeable, ", " + "tx_buf_size=", tx_buf_size)), Session_client(cap(), tx_block_alloc, env.rm()) { } diff --git a/repos/os/include/framebuffer_session/connection.h b/repos/os/include/framebuffer_session/connection.h index 17fe028fbb..6dfd1ed1d6 100644 --- a/repos/os/include/framebuffer_session/connection.h +++ b/repos/os/include/framebuffer_session/connection.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2008-2017 Genode Labs GmbH + * Copyright (C) 2008-2023 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. @@ -15,62 +15,29 @@ #define _INCLUDE__FRAMEBUFFER_SESSION__CONNECTION_H_ #include -#include #include namespace Framebuffer { class Connection; } -class Framebuffer::Connection : public Genode::Connection, - public Session_client +struct Framebuffer::Connection : Genode::Connection, Session_client { - public: - - enum { RAM_QUOTA = 8*1024UL }; - - private: - - /** - * Create session and return typed session capability - */ - Session_capability _connect(Genode::Parent &parent, Area area) - { - using namespace Genode; - - enum { ARGBUF_SIZE = 128 }; - char argbuf[ARGBUF_SIZE]; - argbuf[0] = 0; - - /* donate ram and cap quota for storing server-side meta data */ - Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota", RAM_QUOTA); - Arg_string::set_arg(argbuf, sizeof(argbuf), "cap_quota", CAP_QUOTA); - - /* set optional session-constructor arguments */ - if (area.w()) - Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_width", area.w()); - if (area.h()) - Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_height", area.h()); - - return session(parent, argbuf); - } - - public: - - /** - * Constructor - * - * \param mode desired size and pixel format - * - * The specified values are not enforced. After creating the - * session, you should validate the actual frame-buffer attributes - * by calling the 'info' method of the frame-buffer interface. - */ - Connection(Genode::Env &env, Framebuffer::Mode mode) - : - Genode::Connection(env, _connect(env.parent(), - mode.area)), - Session_client(cap()) - { } + /** + * Constructor + * + * \param mode desired size and pixel format + * + * The specified values are not enforced. After creating the + * session, you should validate the actual frame-buffer attributes + * by calling the 'info' method of the frame-buffer interface. + */ + Connection(Genode::Env &env, Framebuffer::Mode mode) + : + Genode::Connection(env, Label(), Ram_quota { 8*1024 }, + Args("fb_width=", mode.area.w(), ", " + "fb_height=", mode.area.h())), + Session_client(cap()) + { } }; #endif /* _INCLUDE__FRAMEBUFFER_SESSION__CONNECTION_H_ */ diff --git a/repos/os/include/gpio_session/connection.h b/repos/os/include/gpio_session/connection.h index ea006d5dca..f7a36bf711 100644 --- a/repos/os/include/gpio_session/connection.h +++ b/repos/os/include/gpio_session/connection.h @@ -21,16 +21,13 @@ namespace Gpio { struct Connection; } + struct Gpio::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ Connection(Genode::Env &env, unsigned long gpio_pin) : - Genode::Connection(env, session(env.parent(), - "ram_quota=8K, cap_quota=%ld, gpio=%ld", - CAP_QUOTA, gpio_pin)), + Genode::Connection(env, Label(), Ram_quota { 8*1024 }, + Args("gpio=", gpio_pin)), Session_client(cap()) { } }; diff --git a/repos/os/include/gpu_session/connection.h b/repos/os/include/gpu_session/connection.h index 1f5645ef09..747724ab65 100644 --- a/repos/os/include/gpu_session/connection.h +++ b/repos/os/include/gpu_session/connection.h @@ -21,6 +21,7 @@ namespace Gpu { struct Connection; } + struct Gpu::Connection : Genode::Connection, Session_client { /** @@ -30,29 +31,16 @@ struct Gpu::Connection : Genode::Connection, Session_client */ Genode::Attached_dataspace _info_dataspace; - /** - * Issue session request - * - * \noapi - */ - Genode::Capability _session(Genode::Parent &parent, - char const *label, Genode::size_t quota) - { - return session(parent, "ram_quota=%ld, cap_quota=%ld, label=\"%s\"", - quota, CAP_QUOTA, label); - } - /** * Constructor * - * \param quota initial amount of quota used for allocating Gpu - * memory + * \param quota initial amount of quota used for allocating GPU memory */ - Connection(Genode::Env &env, - Genode::size_t quota = Session::REQUIRED_QUOTA, - const char *label = "") + Connection(Genode::Env &env, + Genode::size_t quota = Session::REQUIRED_QUOTA, + Label const &label = Label()) : - Genode::Connection(env, _session(env.parent(), label, quota)), + Genode::Connection(env, label, Ram_quota { quota }, Args()), Session_client(cap()), _info_dataspace(env.rm(), info_dataspace()) { } diff --git a/repos/os/include/gui_session/connection.h b/repos/os/include/gui_session/connection.h index 91ee7ec922..289a9e38b3 100644 --- a/repos/os/include/gui_session/connection.h +++ b/repos/os/include/gui_session/connection.h @@ -17,7 +17,6 @@ #include #include #include -#include #include namespace Gui { class Connection; } @@ -26,47 +25,21 @@ namespace Gui { class Connection; } class Gui::Connection : public Genode::Connection, public Session_client { - public: - - enum { RAM_QUOTA = 36*1024UL }; - private: Framebuffer::Session_client _framebuffer; Input::Session_client _input; Genode::size_t _session_quota = 0; - /** - * Create session and return typed session capability - */ - Session_capability _connect(Genode::Parent &parent, char const *label) - { - enum { ARGBUF_SIZE = 128 }; - char argbuf[ARGBUF_SIZE]; - argbuf[0] = 0; - - if (Genode::strlen(label) > 0) - Genode::snprintf(argbuf, sizeof(argbuf), "label=\"%s\"", label); - - /* - * Declare ram-quota donation - */ - using Genode::Arg_string; - Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota", RAM_QUOTA); - Arg_string::set_arg(argbuf, sizeof(argbuf), "cap_quota", CAP_QUOTA); - - return session(parent, argbuf); - } - public: /** * Constructor */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : /* establish nitpicker session */ - Genode::Connection(env, _connect(env.parent(), label)), + Genode::Connection(env, label, Ram_quota { 36*1024 }, Args()), Session_client(env.rm(), cap()), /* request frame-buffer and input sub sessions */ diff --git a/repos/os/include/i2c_session/connection.h b/repos/os/include/i2c_session/connection.h index 911546fcb4..938e5d3869 100644 --- a/repos/os/include/i2c_session/connection.h +++ b/repos/os/include/i2c_session/connection.h @@ -23,9 +23,9 @@ namespace I2c { struct Connection; } struct I2c::Connection : Genode::Connection, I2c::Session_client { - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection(env, session(env.parent(), "ram_quota=8K, label=%s", label)), + Genode::Connection(env, label, Ram_quota { 8*1024 }, Args()), Session_client(cap()) { } diff --git a/repos/os/include/i2c_session/i2c_session.h b/repos/os/include/i2c_session/i2c_session.h index 7d8d3c2356..da3362a846 100644 --- a/repos/os/include/i2c_session/i2c_session.h +++ b/repos/os/include/i2c_session/i2c_session.h @@ -34,11 +34,6 @@ struct I2c::Session : public Genode::Session enum { CAP_QUOTA = 2 }; - - /*************** - ** Exception ** - ***************/ - /** * Exception thrown in case of a bus error * diff --git a/repos/os/include/input_session/connection.h b/repos/os/include/input_session/connection.h index 57b6e549f3..80f55487c8 100644 --- a/repos/os/include/input_session/connection.h +++ b/repos/os/include/input_session/connection.h @@ -19,17 +19,12 @@ namespace Input { struct Connection; } + struct Input::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=18K, cap_quota=%u, label=\"%s\"", - CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 18*1024 }, Args()), Session_client(env.rm(), cap()) { } }; diff --git a/repos/os/include/loader_session/connection.h b/repos/os/include/loader_session/connection.h index 42f80b61aa..5ab130b44f 100644 --- a/repos/os/include/loader_session/connection.h +++ b/repos/os/include/loader_session/connection.h @@ -23,17 +23,13 @@ namespace Loader { struct Connection; } struct Loader::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ Connection(Genode::Env &env, Ram_quota ram_quota, Cap_quota cap_quota) : - Genode::Connection(env, session(env.parent(), - "ram_quota=%ld, cap_quota=%ld", - ram_quota.value, - CAP_QUOTA + cap_quota.value)), + Genode::Connection(env, Label(), ram_quota, Args()), Session_client(cap()) - { } + { + upgrade_caps(cap_quota.value); + } }; #endif /* _INCLUDE__LOADER_SESSION__CONNECTION_H_ */ diff --git a/repos/os/include/nic_session/connection.h b/repos/os/include/nic_session/connection.h index 3b8e9ebe79..3e8c333dd6 100644 --- a/repos/os/include/nic_session/connection.h +++ b/repos/os/include/nic_session/connection.h @@ -35,14 +35,13 @@ struct Nic::Connection : Genode::Connection, Session_client Genode::Range_allocator *tx_block_alloc, Genode::size_t tx_buf_size, Genode::size_t rx_buf_size, - char const *label = "") + Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, " - "tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", - 32*1024*sizeof(long) + tx_buf_size + rx_buf_size, - CAP_QUOTA, tx_buf_size, rx_buf_size, label)), + Genode::Connection( + env, label, + Ram_quota { 32*1024*sizeof(long) + tx_buf_size + rx_buf_size }, + Args("tx_buf_size=", tx_buf_size, ", " + "rx_buf_size=", rx_buf_size)), Session_client(cap(), *tx_block_alloc, env.rm()) { } }; diff --git a/repos/os/include/pin_control_session/connection.h b/repos/os/include/pin_control_session/connection.h index 0806c2bf08..00477444bf 100644 --- a/repos/os/include/pin_control_session/connection.h +++ b/repos/os/include/pin_control_session/connection.h @@ -20,17 +20,13 @@ namespace Pin_control { struct Connection; } + struct Pin_control::Connection : private Genode::Connection, private Rpc_client { - enum { RAM_QUOTA = 8*1024UL }; - - Connection(Env &env, char const *label = "") + Connection(Env &env, Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%u, cap_quota=%u, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 8*1024 }, Args()), Rpc_client(cap()) { } diff --git a/repos/os/include/pin_state_session/connection.h b/repos/os/include/pin_state_session/connection.h index f9c4ef810c..e223123ffa 100644 --- a/repos/os/include/pin_state_session/connection.h +++ b/repos/os/include/pin_state_session/connection.h @@ -19,17 +19,13 @@ namespace Pin_state { struct Connection; } + struct Pin_state::Connection : private Genode::Connection, private Rpc_client { - enum { RAM_QUOTA = 8*1024UL }; - - Connection(Env &env, char const *label = "") + Connection(Env &env, Label const &label = Label()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%u, cap_quota=%u, label=\"%s\"", - RAM_QUOTA, CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 8*1024 }, Args()), Rpc_client(cap()) { } diff --git a/repos/os/include/platform_session/connection.h b/repos/os/include/platform_session/connection.h index a0e8a4f2b0..1f8ec60c8c 100644 --- a/repos/os/include/platform_session/connection.h +++ b/repos/os/include/platform_session/connection.h @@ -72,9 +72,7 @@ class Platform::Connection : public Genode::Connection, Connection(Env &env) : - Genode::Connection(env, session(env.parent(), - "ram_quota=%u, cap_quota=%u", - RAM_QUOTA, CAP_QUOTA)), + Genode::Connection(env, Label(), Ram_quota { 32*1024 }, Args()), Client(cap()), _env(env) { diff --git a/repos/os/include/platform_session/platform_session.h b/repos/os/include/platform_session/platform_session.h index 863764f9f0..700e72dc79 100644 --- a/repos/os/include/platform_session/platform_session.h +++ b/repos/os/include/platform_session/platform_session.h @@ -57,7 +57,7 @@ struct Platform::Session : Genode::Session */ static const char *service_name() { return "Platform"; } - enum { RAM_QUOTA = 32 * 1024, CAP_QUOTA = 6 }; + enum { CAP_QUOTA = 6 }; virtual ~Session() { } diff --git a/repos/os/include/report_session/connection.h b/repos/os/include/report_session/connection.h index aaac5380e9..0554dd19d9 100644 --- a/repos/os/include/report_session/connection.h +++ b/repos/os/include/report_session/connection.h @@ -22,16 +22,10 @@ namespace Report { struct Connection; } struct Report::Connection : Genode::Connection, Session_client { - enum { RAM_QUOTA = 10*1024 }; /* value used for 'Slave::Connection' */ - - Connection(Genode::Env &env, char const *label, size_t buffer_size = 4096) + Connection(Genode::Env &env, Label const &label, size_t buffer_size = 4096) : - Genode::Connection(env, - session(env.parent(), - "label=\"%s\", ram_quota=%ld, " - "cap_quota=%ld, buffer_size=%zd", - label, RAM_QUOTA + buffer_size, - CAP_QUOTA, buffer_size)), + Genode::Connection(env, label, Ram_quota { 10*1024 + buffer_size }, + Args("buffer_size=", buffer_size)), Session_client(cap()) { } }; diff --git a/repos/os/include/rtc_session/connection.h b/repos/os/include/rtc_session/connection.h index ef7827c5b9..fe53a5ccee 100644 --- a/repos/os/include/rtc_session/connection.h +++ b/repos/os/include/rtc_session/connection.h @@ -23,13 +23,9 @@ namespace Rtc { struct Connection; } struct Rtc::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection( - env, session(env.parent(), "ram_quota=8K, label=\"%s\"", label)), + Genode::Connection(env, label, Ram_quota { 8*1024 }, Args()), Session_client(cap()) { } }; diff --git a/repos/os/include/rtc_session/rtc_session.h b/repos/os/include/rtc_session/rtc_session.h index 64e096a3c4..968a2b0e3e 100644 --- a/repos/os/include/rtc_session/rtc_session.h +++ b/repos/os/include/rtc_session/rtc_session.h @@ -57,6 +57,7 @@ struct Rtc::Session : Genode::Session enum { CAP_QUOTA = 2 }; + /*********************** ** Session interface ** ***********************/ diff --git a/repos/os/include/terminal_session/connection.h b/repos/os/include/terminal_session/connection.h index acc27c64f6..d377e2b85d 100644 --- a/repos/os/include/terminal_session/connection.h +++ b/repos/os/include/terminal_session/connection.h @@ -44,14 +44,9 @@ struct Terminal::Connection : Genode::Connection, Session_client sig_rec.dissolve(&sig_ctx); } - /** - * Constructor - */ - Connection(Genode::Env &env, char const *label = "") + Connection(Genode::Env &env, Label const &label = Label()) : - Genode::Connection(env, session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, label=\"%s\"", - 10*1024, CAP_QUOTA, label)), + Genode::Connection(env, label, Ram_quota { 10*1024 }, Args()), Session_client(env.rm(), cap()) { wait_for_connection(cap()); diff --git a/repos/os/include/uart_session/connection.h b/repos/os/include/uart_session/connection.h index 4ebf5a80fc..200f197311 100644 --- a/repos/os/include/uart_session/connection.h +++ b/repos/os/include/uart_session/connection.h @@ -22,12 +22,9 @@ namespace Uart { struct Connection; } struct Uart::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ Connection(Genode::Env &env) : - Genode::Connection(env, session(env.parent(), "ram_quota=%ld", 2*4096)), + Genode::Connection(env, Label(), Ram_quota { 2*4096 }, Args()), Session_client(env.rm(), cap()) { Terminal::Connection::wait_for_connection(cap()); diff --git a/repos/os/include/uplink_session/connection.h b/repos/os/include/uplink_session/connection.h index 6165cb162a..67005a5bc7 100644 --- a/repos/os/include/uplink_session/connection.h +++ b/repos/os/include/uplink_session/connection.h @@ -38,21 +38,14 @@ struct Uplink::Connection : Genode::Connection, Session_client Genode::size_t tx_buf_size, Genode::size_t rx_buf_size, Net::Mac_address const &mac_address, - char const *label = "") + Label const &label = Label()) : Genode::Connection( - env, - session( - env.parent(), - "ram_quota=%ld, cap_quota=%ld, mac_address=\"%s\", " - "tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", - 32 * 1024 * sizeof(long) + tx_buf_size + rx_buf_size, - CAP_QUOTA, - Genode::String<18>(mac_address).string(), - tx_buf_size, - rx_buf_size, - label)), - + env, label, + Ram_quota { 32*1024*sizeof(long) + tx_buf_size + rx_buf_size }, + Args("mac_address=\"", mac_address, "\", " + "tx_buf_size=", tx_buf_size, ", " + "rx_buf_size=", rx_buf_size)), Session_client(cap(), *tx_block_alloc, env.rm()) { } }; diff --git a/repos/os/include/usb_session/connection.h b/repos/os/include/usb_session/connection.h index d10105dd30..6e010d9c81 100644 --- a/repos/os/include/usb_session/connection.h +++ b/repos/os/include/usb_session/connection.h @@ -22,20 +22,15 @@ namespace Usb { struct Connection; } struct Usb::Connection : Genode::Connection, Session_client { - /** - * Constructor - */ Connection(Genode::Env &env, Genode::Range_allocator *tx_block_alloc, - char const *label = "", - Genode::size_t tx_buf_size = 512 * 1024, + Label const &label = Label(), + Genode::size_t tx_buf_size = 512*1024, Genode::Signal_context_capability sigh_state_changed = Genode::Signal_context_capability()) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, tx_buf_size=%ld, label=\"%s\"", - 5 * 4096 + tx_buf_size, CAP_QUOTA, tx_buf_size, label)), + Genode::Connection(env, label, Ram_quota { 5*4096 + tx_buf_size }, + Args("tx_buf_size=", tx_buf_size)), Session_client(cap(), *tx_block_alloc, env.rm(), sigh_state_changed) { } }; diff --git a/repos/os/src/drivers/gpio/rpi/driver.h b/repos/os/src/drivers/gpio/rpi/driver.h index a68895fd8f..8db153129b 100644 --- a/repos/os/src/drivers/gpio/rpi/driver.h +++ b/repos/os/src/drivers/gpio/rpi/driver.h @@ -68,7 +68,7 @@ class Gpio::Rpi_driver : public Driver Rpi_driver(Genode::Env &env) : _reg(env, Rpi::GPIO_CONTROLLER_BASE, 0, Rpi::GPIO_CONTROLLER_SIZE), - _irq(env, IRQ), + _irq(env, unsigned(IRQ)), _dispatcher(env.ep(), *this, &Rpi_driver::_handle), _async(false) { diff --git a/repos/os/src/test/nic_stress/main.cc b/repos/os/src/test/nic_stress/main.cc index a8995a081a..59c84ac017 100644 --- a/repos/os/src/test/nic_stress/main.cc +++ b/repos/os/src/test/nic_stress/main.cc @@ -23,25 +23,20 @@ namespace Local { using namespace Genode; + struct Bad_args_nic; struct Construct_destruct_test; struct Main; } -struct Bad_args_nic : Genode::Connection +struct Local::Bad_args_nic : Connection { - Bad_args_nic(Genode::Env &env, - Genode::size_t ram_quota, - Genode::size_t cap_quota, - Genode::size_t tx_buf_size, - Genode::size_t rx_buf_size, - char const *label) + Bad_args_nic(Env &env, size_t ram_quota, size_t tx_buf_size, size_t rx_buf_size, + Session::Label const &label) : - Genode::Connection(env, - session(env.parent(), - "ram_quota=%ld, cap_quota=%ld, " - "tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", - ram_quota, cap_quota, tx_buf_size, rx_buf_size, label)) + Genode::Connection(env, label, Ram_quota { ram_quota }, + Args("tx_buf_size=", tx_buf_size, ", " + "rx_buf_size=", rx_buf_size)) { } }; @@ -81,7 +76,7 @@ struct Local::Construct_destruct_test unsigned const round) { _bad_args_nic.construct( - _env, 0, 0, BUF_SIZE, BUF_SIZE, "bad_args"); + _env, 0, BUF_SIZE, BUF_SIZE, "bad_args"); for (unsigned idx = 0; idx < _nr_of_sessions; idx++) { try { nic[idx].construct(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE);