Remove format strings from connection types

Issue #2064
This commit is contained in:
Norman Feske 2023-03-03 12:07:28 +01:00 committed by Christian Helmuth
parent fb66e733b5
commit 9debad4e91
58 changed files with 199 additions and 457 deletions

View File

@ -29,7 +29,7 @@ struct Sync::Connection : public Genode::Connection<Session>,
{ {
explicit Connection(Genode::Env &env) explicit Connection(Genode::Env &env)
: :
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=4K")), Genode::Connection<Session>(env, Label(), Ram_quota { 4*1024 }, Args()),
Genode::Rpc_client<Session>(cap()) Genode::Rpc_client<Session>(cap())
{ } { }

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * 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>, Cpu_session_client struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
{ {
enum { RAM_QUOTA = 36*1024 };
/** /**
* Constructor * Constructor
* *
* \param label initial session label
* \param priority designated priority of all threads created * \param priority designated priority of all threads created
* with this CPU session * 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()) Affinity const &affinity = Affinity())
: :
Connection<Cpu_session>(env, Connection<Cpu_session>(env, label, Ram_quota { RAM_QUOTA }, affinity,
session(env.parent(), affinity, Args("priority=", Hex(priority))),
"priority=0x%lx, ram_quota=%u, "
"cap_quota=%u, label=\"%s\"",
priority, RAM_QUOTA, CAP_QUOTA, label)),
Cpu_session_client(cap()) Cpu_session_client(cap())
{ } { }

View File

@ -43,7 +43,7 @@ struct Genode::Cpu_session : Session
* allocation, its session capability, the capability of the 'Native_cpu' * allocation, its session capability, the capability of the 'Native_cpu'
* RPC interface, and a capability for the trace-control dataspace. * 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; typedef Cpu_session_client Client;

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * 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>, Io_mem_session_cl
*/ */
Io_mem_connection(Env &env, addr_t base, size_t size, bool write_combined = false) Io_mem_connection(Env &env, addr_t base, size_t size, bool write_combined = false)
: :
Connection<Io_mem_session>(env, Connection<Io_mem_session>(env, Label(), Ram_quota { RAM_QUOTA },
session(env.parent(), Args("base=", Hex(base), ", "
"cap_quota=%u, ram_quota=%u, " "size=", Hex(size), ", "
"base=0x%p, size=0x%lx, wc=%s", "wc=", write_combined ? "yes" : "no")),
CAP_QUOTA, RAM_QUOTA, base, size,
write_combined ? "yes" : "no")),
Io_mem_session_client(cap()) Io_mem_session_client(cap())
{ } { }
}; };

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * 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>, struct Genode::Io_port_connection : Connection<Io_port_session>,
Io_port_session_client Io_port_session_client
{ {
/**
* Issue session request
*
* \noapi
*/
Capability<Io_port_session> _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 * Constructor
* *
@ -42,11 +31,9 @@ struct Genode::Io_port_connection : Connection<Io_port_session>,
*/ */
Io_port_connection(Env &env, unsigned base, unsigned size) Io_port_connection(Env &env, unsigned base, unsigned size)
: :
Connection<Io_port_session>(env, Connection<Io_port_session>(env, Label(), Ram_quota { RAM_QUOTA },
session(env.parent(), Args("io_port_base=", base, ", "
"ram_quota=%u, cap_quota=%u, " "io_port_size=", size)),
"io_port_base=%u, io_port_size=%u",
RAM_QUOTA, CAP_QUOTA, base, size)),
Io_port_session_client(cap()) Io_port_session_client(cap())
{ } { }
}; };

View File

@ -38,10 +38,11 @@ struct Genode::Io_port_session : Session
*/ */
static const char *service_name() { return "IO_PORT"; } 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() { } virtual ~Io_port_session() { }
/****************************** /******************************
** Read value from I/O port ** ** Read value from I/O port **
******************************/ ******************************/

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -19,47 +19,27 @@
namespace Genode { struct Irq_connection; } namespace Genode { struct Irq_connection; }
struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client
{ {
/** /**
* Constructor * Constructor
* *
* \param irq physical interrupt number * \param label physical interrupt number
* \param trigger interrupt trigger (e.g., level/edge) * \param trigger interrupt trigger (e.g., level/edge)
* \param polarity interrupt trigger polarity (e.g., low/high) * \param polarity interrupt trigger polarity (e.g., low/high)
*/ */
Irq_connection(Env &env, Irq_connection(Env &env,
unsigned irq, Label const &label,
Irq_session::Trigger trigger = Irq_session::TRIGGER_UNCHANGED, Trigger trigger = Irq_session::TRIGGER_UNCHANGED,
Irq_session::Polarity polarity = Irq_session::POLARITY_UNCHANGED, Polarity polarity = Irq_session::POLARITY_UNCHANGED,
Genode::addr_t device_config_phys = 0) addr_t device_config_phys = 0)
: :
Connection<Irq_session>(env, session(env.parent(), Connection<Irq_session>(env, label, Ram_quota { RAM_QUOTA },
"ram_quota=%u, cap_quota=%u, " Args("irq_number=", label, ", "
"irq_number=%u, irq_trigger=%u, " "irq_trigger=", unsigned(trigger), ", "
"irq_polarity=%u, device_config_phys=0x%lx", "irq_polarity=", unsigned(polarity), ", "
RAM_QUOTA, CAP_QUOTA, "device_config_phys=", Hex(device_config_phys))),
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<Irq_session>(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)),
Irq_session_client(cap()) Irq_session_client(cap())
{ } { }
}; };

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -16,23 +16,15 @@
#include <log_session/client.h> #include <log_session/client.h>
#include <base/connection.h> #include <base/connection.h>
#include <base/session_label.h>
namespace Genode { struct Log_connection; } namespace Genode { struct Log_connection; }
struct Genode::Log_connection : Connection<Log_session>, Log_session_client struct Genode::Log_connection : Connection<Log_session>, Log_session_client
{ {
enum { RAM_QUOTA = 8*1024UL }; Log_connection(Env &env, Session_label const &label = Session_label())
/**
* Constructor
*/
Log_connection(Env &env, Session_label label = Session_label())
: :
Connection<Log_session>(env, session(env.parent(), Connection<Log_session>(env, label, Ram_quota { RAM_QUOTA }, Args()),
"ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label.string())),
Log_session_client(cap()) Log_session_client(cap())
{ } { }
}; };

View File

@ -37,7 +37,7 @@ struct Genode::Log_session : Session
* A LOG connection consumes a dataspace capability for the session-object * A LOG connection consumes a dataspace capability for the session-object
* allocation and its session capability. * allocation and its session capability.
*/ */
enum { CAP_QUOTA = 2 }; enum { CAP_QUOTA = 2, RAM_QUOTA = 8*1024 };
typedef Log_session_client Client; typedef Log_session_client Client;

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * 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>, Pd_session_client struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
{ {
enum { RAM_QUOTA = 24*1024*sizeof(long)};
enum Virt_space { UNCONSTRAIN = 0, CONSTRAIN = 1 }; enum Virt_space { UNCONSTRAIN = 0, CONSTRAIN = 1 };
/** Pd_connection(Env &env, Label const &label = Label(), Virt_space space = CONSTRAIN)
* Constructor
*
* \param label session label
*/
Pd_connection(Env &env, char const *label = "", Virt_space space = CONSTRAIN)
: :
Connection<Pd_session>(env, session(env.parent(), Connection<Pd_session>(env, label, Ram_quota { RAM_QUOTA },
"ram_quota=%u, cap_quota=%u, label=\"%s\", virt_space=%u", Args("virt_space=", unsigned(space))),
RAM_QUOTA, CAP_QUOTA, label, space)),
Pd_session_client(cap()) Pd_session_client(cap())
{ } { }
@ -45,11 +38,9 @@ struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
*/ */
Pd_connection(Env &env, Device_pd) Pd_connection(Env &env, Device_pd)
: :
Connection<Pd_session>(env, session(env.parent(), Connection<Pd_session>(env, "device PD", Ram_quota { RAM_QUOTA },
"ram_quota=%u, cap_quota=%u, " Args("virt_space=", unsigned(UNCONSTRAIN), ", "
"label=\"device PD\", virt_space=%u, " "managing_system=yes")),
"managing_system=yes",
RAM_QUOTA, CAP_QUOTA, UNCONSTRAIN)),
Pd_session_client(cap()) Pd_session_client(cap())
{ } { }
}; };

View File

@ -46,7 +46,7 @@ struct Genode::Pd_session : Session, Ram_allocator
* Furthermore, we account for the dataspace capabilities allocated during * Furthermore, we account for the dataspace capabilities allocated during
* the component bootstrapping. * the component bootstrapping.
*/ */
enum { CAP_QUOTA = 6 + 7 }; enum { CAP_QUOTA = 6 + 7, RAM_QUOTA = 24*1024*sizeof(long) };
typedef Pd_session_client Client; typedef Pd_session_client Client;

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * 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>, Rm_session_client struct Genode::Rm_connection : Connection<Rm_session>, Rm_session_client
{ {
enum { RAM_QUOTA = 64*1024 };
/**
* Constructor
*/
Rm_connection(Env &env) Rm_connection(Env &env)
: :
Connection<Rm_session>(env, session(env.parent(), "ram_quota=%u, cap_quota=%u", Connection<Rm_session>(env, Label(), Ram_quota { 64*1024 }, Args()),
RAM_QUOTA, CAP_QUOTA)),
Rm_session_client(cap()) Rm_session_client(cap())
{ } { }
/** /**
* Wrapper over 'create' that handles resource requests * Wrapper over 'create' that handles resource requests from the server
* from the server.
*/ */
Capability<Region_map> create(size_t size) override Capability<Region_map> create(size_t size) override
{ {

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -16,35 +16,28 @@
#include <rom_session/client.h> #include <rom_session/client.h>
#include <base/connection.h> #include <base/connection.h>
#include <base/log.h>
namespace Genode { class Rom_connection; } namespace Genode { class Rom_connection; }
struct Genode::Rom_connection : Connection<Rom_session>, struct Genode::Rom_connection : Connection<Rom_session>, Rom_session_client
Rom_session_client
{ {
class Rom_connection_failed : public Service_denied { }; struct Rom_connection_failed : Service_denied { };
enum { RAM_QUOTA = 6*1024UL };
/** /**
* Constructor * Constructor
* *
* \param label request label and name of ROM module * \param label name of requested ROM module
* *
* \throw Rom_connection_failed * \throw Rom_connection_failed
*/ */
Rom_connection(Env &env, const char *label) Rom_connection(Env &env, Session_label const &label)
try : try :
Connection<Rom_session>(env, Connection<Rom_session>(env, label, Ram_quota { RAM_QUOTA }, Args()),
session(env.parent(),
"ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Rom_session_client(cap()) Rom_session_client(cap())
{ } { }
catch (...) { catch (...) {
error("Could not open ROM session for \"", label, "\""); error("could not open ROM session for \"", label, "\"");
throw Rom_connection_failed(); throw Rom_connection_failed();
} }
}; };

View File

@ -46,7 +46,7 @@ struct Genode::Rom_session : Session
* allocation, a dataspace capability for the ROM dataspace, and its * allocation, a dataspace capability for the ROM dataspace, and its
* session capability. * session capability.
*/ */
enum { CAP_QUOTA = 3 }; enum { CAP_QUOTA = 3, RAM_QUOTA = 6*1024 };
typedef Rom_session_client Client; typedef Rom_session_client Client;

View File

@ -257,13 +257,14 @@ class Timer::Connection : public Genode::Connection<Session>,
*/ */
Connection(Genode::Env &env, Connection(Genode::Env &env,
Genode::Entrypoint &ep, Genode::Entrypoint &ep,
char const *label = ""); Label const &label = Label());
/** /**
* Convenience constructor wrapper using the environment's entrypoint as * Convenience constructor wrapper using the environment's entrypoint as
* timeout handler execution context * 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); } ~Connection() { _sig_rec.dissolve(&_default_sigh_ctx); }

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -39,9 +39,9 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
*/ */
Connection(Env &env, size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) Connection(Env &env, size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels)
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, Label(), Ram_quota { 10*1024 + ram_quota },
session(env.parent(), "ram_quota=%lu, arg_buffer_size=%lu, parent_levels=%u", Args("arg_buffer_size=", arg_buffer_size, ", "
ram_quota + 10*1024, arg_buffer_size, parent_levels)), "parent_levels=", parent_levels)),
Session_client(env.rm(), cap()) Session_client(env.rm(), cap())
{ } { }

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -35,19 +35,6 @@ namespace Genode {
struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session> struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
{ {
/**
* Issue session request
*
* \noapi
*/
Capability<Vm_session> _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 * VM-Exit state-transfer configuration
* *
@ -82,15 +69,16 @@ struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
/** /**
* Constructor * Constructor
* *
* \param label initial session label
* \param priority designated priority of the VM * \param priority designated priority of the VM
* \param affinity which physical CPU the VM should run on top of * \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, long priority = Cpu_session::DEFAULT_PRIORITY,
unsigned long affinity = 0) unsigned long affinity = 0)
: :
Connection<Vm_session>(env, _session(env.parent(), label, priority, affinity)), Connection<Vm_session>(env, label, Ram_quota { 16*1024 }, Affinity(),
Args("priority=", Hex(priority), ", "
"affinity=", Hex(affinity))),
Rpc_client<Vm_session>(cap()) Rpc_client<Vm_session>(cap())
{ } { }
@ -107,6 +95,7 @@ struct Genode::Vm_connection : Connection<Vm_session>, Rpc_client<Vm_session>
); );
} }
/************************** /**************************
** Vm_session interface ** ** Vm_session interface **
**************************/ **************************/

View File

@ -37,7 +37,7 @@ struct Genode::Vm_session : Session
bool writeable; bool writeable;
}; };
enum { CAP_QUOTA = 3 }; enum { CAP_QUOTA = 10 };
class Invalid_dataspace : Exception { }; class Invalid_dataspace : Exception { };
class Region_conflict : Exception { }; class Region_conflict : Exception { };

View File

@ -43,10 +43,8 @@ _Z16main_thread_utcbv T
_Z22__ldso_raise_exceptionv T _Z22__ldso_raise_exceptionv T
_ZN5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_handlerE T _ZN5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_handlerE T
_ZN5Timer10Connection9curr_timeEv T _ZN5Timer10Connection9curr_timeEv T
_ZN5Timer10ConnectionC1ERN6Genode3EnvEPKc T _ZN5Timer10ConnectionC1ERN6Genode3EnvERNS1_10EntrypointERKNS1_13Session_labelE T
_ZN5Timer10ConnectionC1ERN6Genode3EnvERNS1_10EntrypointEPKc T _ZN5Timer10ConnectionC2ERN6Genode3EnvERNS1_10EntrypointERKNS1_13Session_labelE T
_ZN5Timer10ConnectionC2ERN6Genode3EnvEPKc T
_ZN5Timer10ConnectionC2ERN6Genode3EnvERNS1_10EntrypointEPKc T
_ZN6Genode10Entrypoint16_dispatch_signalERNS_6SignalE T _ZN6Genode10Entrypoint16_dispatch_signalERNS_6SignalE T
_ZN6Genode10Entrypoint16schedule_suspendEPFvvES2_ T _ZN6Genode10Entrypoint16schedule_suspendEPFvvES2_ T
_ZN6Genode10Entrypoint22Signal_proxy_component6signalEv T _ZN6Genode10Entrypoint22Signal_proxy_component6signalEv T

View File

@ -304,7 +304,7 @@ int main()
/* CPU session representing core */ /* CPU session representing core */
static Cpu_session_component static Cpu_session_component
core_cpu(ep, core_cpu(ep,
Session::Resources{{Cpu_connection::RAM_QUOTA}, Session::Resources{{Cpu_session::RAM_QUOTA},
{Cpu_session::CAP_QUOTA}}, {Cpu_session::CAP_QUOTA}},
"core", Session::Diag{false}, "core", Session::Diag{false},
core_ram_alloc, local_rm, ep, pager_ep, Core::Trace::sources(), "", core_ram_alloc, local_rm, ep, pager_ep, Core::Trace::sources(), "",

View File

@ -120,12 +120,9 @@ void Timer::Connection::set_timeout(Microseconds duration,
} }
Timer::Connection::Connection(Genode::Env &env, Genode::Entrypoint &ep, Timer::Connection::Connection(Env &env, Entrypoint &ep, Label const &label)
char const *label)
: :
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, label, Ram_quota { 10*1024 }, Args()),
"ram_quota=10K, cap_quota=%u, label=\"%s\"",
CAP_QUOTA, label)),
Session_client(cap()), Session_client(cap()),
_signal_handler(ep, *this, &Connection::_handle_timeout) _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() Timeout_scheduler &Timer::Connection::_switch_to_timeout_framework_mode()
{ {
if (_mode == TIMEOUT_FRAMEWORK) { if (_mode == TIMEOUT_FRAMEWORK) {
@ -148,7 +141,6 @@ Timeout_scheduler &Timer::Connection::_switch_to_timeout_framework_mode()
_timeout_scheduler._enable(); _timeout_scheduler._enable();
/* do initial calibration burst to make interpolation available earlier */ /* do initial calibration burst to make interpolation available earlier */
for (unsigned i = 0; i < NR_OF_INITIAL_CALIBRATIONS; i++) { for (unsigned i = 0; i < NR_OF_INITIAL_CALIBRATIONS; i++) {
_update_real_time(); _update_real_time();

View File

@ -26,7 +26,7 @@ Timer::Time_source::Time_source(Env &env)
: :
Attached_mmio(env, Imx6::EPIT_2_MMIO_BASE, Imx6::EPIT_2_MMIO_SIZE), Attached_mmio(env, Imx6::EPIT_2_MMIO_BASE, Imx6::EPIT_2_MMIO_SIZE),
Signalled_time_source(env), Signalled_time_source(env),
_timer_irq(env, Imx6::EPIT_2_IRQ) _timer_irq(env, unsigned(Imx6::EPIT_2_IRQ))
{ {
_timer_irq.sigh(_signal_handler); _timer_irq.sigh(_signal_handler);
while (read<Cr::Swr>()) ; while (read<Cr::Swr>()) ;

View File

@ -26,4 +26,4 @@ enum {
Timer::Time_source::Time_source(Env &env) Timer::Time_source::Time_source(Env &env)
: Attached_mmio(env, MMIO_BASE, MMIO_SIZE), : Attached_mmio(env, MMIO_BASE, MMIO_SIZE),
Signalled_time_source(env), Signalled_time_source(env),
_timer_irq(env, IRQ) { _initialize(); } _timer_irq(env, unsigned(IRQ)) { _initialize(); }

View File

@ -200,7 +200,7 @@ Timer::Time_source::Time_source(Env &env)
: :
Signalled_time_source(env), Signalled_time_source(env),
_io_port(env, PIT_DATA_PORT_0, PIT_CMD_PORT - PIT_DATA_PORT_0 + 1), _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 */ /* operate PIT in one-shot mode */
_io_port.outb(PIT_CMD_PORT, PIT_CMD_SELECT_CHANNEL_0 | _io_port.outb(PIT_CMD_PORT, PIT_CMD_SELECT_CHANNEL_0 |

View File

@ -76,7 +76,7 @@ C++ class in 'include/hello_session/hello_session.h'
!{ !{
! static const char *service_name() { return "Hello"; } ! static const char *service_name() { return "Hello"; }
! !
! enum { CAP_QUOTA = 2 }; ! enum { CAP_QUOTA = 4 };
! !
! virtual void say_hello() = 0; ! virtual void say_hello() = 0;
! virtual int add(int a, int b) = 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 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 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 the server for announcing the service at its parent and the client for
requesting the creation of a "Hello" session. The 'CAP_QUOTA' definition requesting the creation of a "Hello" session. The 'resources' definition
specifies the amount of capabilities required to establish the session. specifies the amount of capabilities and RAM required by the server to
The specified amount is transferred from the client to the server at session establish the session. The specified amount is transferred from the client
creation time. For the "Hello" session, two capabilities are required, namely to the server at session creation time.
a dataspace capability for the server-side memory occupied by the session
object and the actual session capability that refers to the RPC interface.
The 'GENODE_RPC' macro is used to declare an RPC function. Its first argument 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 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) ! Connection(Genode::Env &env)
! : ! :
! /* create session */ ! /* create session */
! Genode::Connection<Hello::Session>(env, session(env.parent(), ! Genode::Connection<Hello::Session>(env, Label(),
! "ram_quota=4K, cap_quota=4")), ! Ram_quota { 8*1024 }, Args()),
! /* initialize RPC interface */ ! /* initialize RPC interface */
! Session_client(cap()) { } ! Session_client(cap())
! { }
!}; !};

View File

@ -25,11 +25,11 @@ struct Hello::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env) Connection(Genode::Env &env)
: :
/* create session */ /* create session */
Genode::Connection<Hello::Session>(env, session(env.parent(), Genode::Connection<Hello::Session>(env, Label(),
"ram_quota=6K, cap_quota=4")), Ram_quota { 8*1024 }, Args()),
/* initialize RPC interface */ /* initialize RPC interface */
Session_client(cap()) { } Session_client(cap())
{ }
}; };
#endif /* _INCLUDE__HELLO_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__HELLO_SESSION__CONNECTION_H_ */

View File

@ -24,7 +24,7 @@ struct Hello::Session : Genode::Session
{ {
static const char *service_name() { return "Hello"; } static const char *service_name() { return "Hello"; }
enum { CAP_QUOTA = 2 }; enum { CAP_QUOTA = 4 };
virtual void say_hello() = 0; virtual void say_hello() = 0;
virtual int add(int a, int b) = 0; virtual int add(int a, int b) = 0;

View File

@ -57,10 +57,7 @@ struct Libc::Clone_connection : Connection<Clone_session>,
Clone_connection(Genode::Env &env) Clone_connection(Genode::Env &env)
: :
Connection<Clone_session>(env, Connection<Clone_session>(env, Label(), Ram_quota { RAM_QUOTA }, Args()),
session(env.parent(),
"ram_quota=%ld, cap_quota=%ld",
RAM_QUOTA, CAP_QUOTA)),
Rpc_client<Clone_session>(cap()), Rpc_client<Clone_session>(cap()),
_buffer(env.rm(), call<Rpc_dataspace>()) _buffer(env.rm(), call<Rpc_dataspace>())
{ } { }

View File

@ -23,17 +23,6 @@ namespace Audio_in { struct Connection; }
struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_client struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_client
{ {
/**
* Issue session request
*
* \noapi
*/
Genode::Capability<Audio_in::Session> _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 * Constructor
* *
@ -43,7 +32,9 @@ struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_cli
*/ */
Connection(Genode::Env &env, char const *channel, bool progress_signal = false) Connection(Genode::Env &env, char const *channel, bool progress_signal = false)
: :
Genode::Connection<Session>(env, _session(env.parent(), channel)), Genode::Connection<Session>(env, Label(),
Ram_quota { 10*1024 + sizeof(Stream) },
Args("channel=\"", channel, "\"")),
Session_client(env.rm(), cap(), progress_signal) Session_client(env.rm(), cap(), progress_signal)
{ } { }
}; };

View File

@ -38,10 +38,9 @@ struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_c
bool alloc_signal = true, bool alloc_signal = true,
bool progress_signal = false) bool progress_signal = false)
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, Label(),
session(env.parent(), Ram_quota { 2*4096 + 2048 + sizeof(Stream) },
"ram_quota=%ld, cap_quota=%ld, channel=\"%s\"", Args("channel=\"", channel, "\"")),
2*4096 + 2048 + sizeof(Stream), CAP_QUOTA, channel)),
Session_client(env.rm(), cap(), alloc_signal, progress_signal) Session_client(env.rm(), cap(), alloc_signal, progress_signal)
{ } { }
}; };

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -233,12 +233,11 @@ struct Block::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env, Connection(Genode::Env &env,
Genode::Range_allocator *tx_block_alloc, Genode::Range_allocator *tx_block_alloc,
Genode::size_t tx_buf_size = 128*1024, Genode::size_t tx_buf_size = 128*1024,
const char *label = "") Label const &label = Label())
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label,
session(env.parent(), Ram_quota { 14*1024 + tx_buf_size },
"ram_quota=%ld, cap_quota=%ld, tx_buf_size=%ld, label=\"%s\"", Args("tx_buf_size=", tx_buf_size)),
14*1024 + tx_buf_size, CAP_QUOTA, tx_buf_size, label)),
Session_client(cap(), *tx_block_alloc, env.rm()), Session_client(cap(), *tx_block_alloc, env.rm()),
_max_block_count(_init_max_block_count(_tx.source()->bulk_buffer_size())) _max_block_count(_init_max_block_count(_tx.source()->bulk_buffer_size()))
{ } { }

View File

@ -26,10 +26,6 @@ namespace Capture { class Connection; }
class Capture::Connection : public Genode::Connection<Session>, class Capture::Connection : public Genode::Connection<Session>,
public Session_client public Session_client
{ {
public:
enum { RAM_QUOTA = 36*1024UL };
private: private:
size_t _session_quota = 0; size_t _session_quota = 0;
@ -39,12 +35,10 @@ class Capture::Connection : public Genode::Connection<Session>,
/** /**
* Constructor * Constructor
*/ */
Connection(Genode::Env &env, char const *label = "") Connection(Genode::Env &env, Label const &label = Label())
: :
Genode::Connection<Capture::Session>( Genode::Connection<Capture::Session>(env, label,
env, session(env.parent(), Ram_quota { 36*1024 }, Args()),
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Session_client(cap()) Session_client(cap())
{ } { }

View File

@ -19,19 +19,12 @@
namespace Event { struct Connection; } namespace Event { struct Connection; }
struct Event::Connection : Genode::Connection<Session>, Session_client struct Event::Connection : Genode::Connection<Session>, Session_client
{ {
enum { RAM_QUOTA = 18*1024UL }; Connection(Genode::Env &env, Label const &label = Label())
/**
* Constructor
*/
Connection(Genode::Env &env, char const *label = "")
: :
Genode::Connection<Event::Session>(env, Genode::Connection<Event::Session>(env, label, Ram_quota { 18*1024 }, Args()),
session(env.parent(),
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Session_client(env.rm(), cap()) Session_client(env.rm(), cap())
{ } { }
}; };

View File

@ -66,23 +66,16 @@ struct File_system::Connection : Genode::Connection<Session>, Session_client
*/ */
Connection(Genode::Env &env, Connection(Genode::Env &env,
Genode::Range_allocator &tx_block_alloc, Genode::Range_allocator &tx_block_alloc,
char const *label = "", Label const &label = Label(),
char const *root = "/", char const *root = "/",
bool writeable = true, bool writeable = true,
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE) size_t tx_buf_size = DEFAULT_TX_BUF_SIZE)
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label,
session(env.parent(), Ram_quota { 8*1024*sizeof(long) + tx_buf_size },
"ram_quota=%ld, " Args("root=\"", root, "\", "
"cap_quota=%ld, " "writeable=", writeable, ", "
"tx_buf_size=%ld, " "tx_buf_size=", tx_buf_size)),
"label=\"%s\", "
"root=\"%s\", "
"writeable=%d",
8*1024*sizeof(long) + tx_buf_size,
CAP_QUOTA,
tx_buf_size,
label, root, writeable)),
Session_client(cap(), tx_block_alloc, env.rm()) Session_client(cap(), tx_block_alloc, env.rm())
{ } { }

View File

@ -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 * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3. * under the terms of the GNU Affero General Public License version 3.
@ -15,47 +15,13 @@
#define _INCLUDE__FRAMEBUFFER_SESSION__CONNECTION_H_ #define _INCLUDE__FRAMEBUFFER_SESSION__CONNECTION_H_
#include <framebuffer_session/client.h> #include <framebuffer_session/client.h>
#include <util/arg_string.h>
#include <base/connection.h> #include <base/connection.h>
namespace Framebuffer { class Connection; } namespace Framebuffer { class Connection; }
class Framebuffer::Connection : public Genode::Connection<Session>, struct Framebuffer::Connection : Genode::Connection<Session>, Session_client
public 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 * Constructor
* *
@ -67,8 +33,9 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
*/ */
Connection(Genode::Env &env, Framebuffer::Mode mode) Connection(Genode::Env &env, Framebuffer::Mode mode)
: :
Genode::Connection<Session>(env, _connect(env.parent(), Genode::Connection<Session>(env, Label(), Ram_quota { 8*1024 },
mode.area)), Args("fb_width=", mode.area.w(), ", "
"fb_height=", mode.area.h())),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -21,16 +21,13 @@
namespace Gpio { struct Connection; } namespace Gpio { struct Connection; }
struct Gpio::Connection : Genode::Connection<Session>, Session_client struct Gpio::Connection : Genode::Connection<Session>, Session_client
{ {
/**
* Constructor
*/
Connection(Genode::Env &env, unsigned long gpio_pin) Connection(Genode::Env &env, unsigned long gpio_pin)
: :
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, Label(), Ram_quota { 8*1024 },
"ram_quota=8K, cap_quota=%ld, gpio=%ld", Args("gpio=", gpio_pin)),
CAP_QUOTA, gpio_pin)),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -21,6 +21,7 @@
namespace Gpu { struct Connection; } namespace Gpu { struct Connection; }
struct Gpu::Connection : Genode::Connection<Session>, Session_client struct Gpu::Connection : Genode::Connection<Session>, Session_client
{ {
/** /**
@ -30,29 +31,16 @@ struct Gpu::Connection : Genode::Connection<Session>, Session_client
*/ */
Genode::Attached_dataspace _info_dataspace; Genode::Attached_dataspace _info_dataspace;
/**
* Issue session request
*
* \noapi
*/
Genode::Capability<Gpu::Session> _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 * Constructor
* *
* \param quota initial amount of quota used for allocating Gpu * \param quota initial amount of quota used for allocating GPU memory
* memory
*/ */
Connection(Genode::Env &env, Connection(Genode::Env &env,
Genode::size_t quota = Session::REQUIRED_QUOTA, Genode::size_t quota = Session::REQUIRED_QUOTA,
const char *label = "") Label const &label = Label())
: :
Genode::Connection<Session>(env, _session(env.parent(), label, quota)), Genode::Connection<Session>(env, label, Ram_quota { quota }, Args()),
Session_client(cap()), Session_client(cap()),
_info_dataspace(env.rm(), info_dataspace()) _info_dataspace(env.rm(), info_dataspace())
{ } { }

View File

@ -17,7 +17,6 @@
#include <gui_session/client.h> #include <gui_session/client.h>
#include <framebuffer_session/client.h> #include <framebuffer_session/client.h>
#include <input_session/client.h> #include <input_session/client.h>
#include <util/arg_string.h>
#include <base/connection.h> #include <base/connection.h>
namespace Gui { class Connection; } namespace Gui { class Connection; }
@ -26,47 +25,21 @@ namespace Gui { class Connection; }
class Gui::Connection : public Genode::Connection<Session>, class Gui::Connection : public Genode::Connection<Session>,
public Session_client public Session_client
{ {
public:
enum { RAM_QUOTA = 36*1024UL };
private: private:
Framebuffer::Session_client _framebuffer; Framebuffer::Session_client _framebuffer;
Input::Session_client _input; Input::Session_client _input;
Genode::size_t _session_quota = 0; 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: public:
/** /**
* Constructor * Constructor
*/ */
Connection(Genode::Env &env, char const *label = "") Connection(Genode::Env &env, Label const &label = Label())
: :
/* establish nitpicker session */ /* establish nitpicker session */
Genode::Connection<Session>(env, _connect(env.parent(), label)), Genode::Connection<Session>(env, label, Ram_quota { 36*1024 }, Args()),
Session_client(env.rm(), cap()), Session_client(env.rm(), cap()),
/* request frame-buffer and input sub sessions */ /* request frame-buffer and input sub sessions */

View File

@ -23,9 +23,9 @@ namespace I2c { struct Connection; }
struct I2c::Connection : Genode::Connection<I2c::Session>, I2c::Session_client struct I2c::Connection : Genode::Connection<I2c::Session>, I2c::Session_client
{ {
Connection(Genode::Env &env, char const *label = "") Connection(Genode::Env &env, Label const &label = Label())
: :
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=8K, label=%s", label)), Genode::Connection<Session>(env, label, Ram_quota { 8*1024 }, Args()),
Session_client(cap()) Session_client(cap())
{ } { }

View File

@ -34,11 +34,6 @@ struct I2c::Session : public Genode::Session
enum { CAP_QUOTA = 2 }; enum { CAP_QUOTA = 2 };
/***************
** Exception **
***************/
/** /**
* Exception thrown in case of a bus error * Exception thrown in case of a bus error
* *

View File

@ -19,17 +19,12 @@
namespace Input { struct Connection; } namespace Input { struct Connection; }
struct Input::Connection : Genode::Connection<Session>, Session_client struct Input::Connection : Genode::Connection<Session>, Session_client
{ {
/** Connection(Genode::Env &env, Label const &label = Label())
* Constructor
*/
Connection(Genode::Env &env, char const *label = "")
: :
Genode::Connection<Input::Session>(env, Genode::Connection<Input::Session>(env, label, Ram_quota { 18*1024 }, Args()),
session(env.parent(),
"ram_quota=18K, cap_quota=%u, label=\"%s\"",
CAP_QUOTA, label)),
Session_client(env.rm(), cap()) Session_client(env.rm(), cap())
{ } { }
}; };

View File

@ -23,17 +23,13 @@ namespace Loader { struct Connection; }
struct Loader::Connection : Genode::Connection<Session>, Session_client struct Loader::Connection : Genode::Connection<Session>, Session_client
{ {
/**
* Constructor
*/
Connection(Genode::Env &env, Ram_quota ram_quota, Cap_quota cap_quota) Connection(Genode::Env &env, Ram_quota ram_quota, Cap_quota cap_quota)
: :
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, Label(), ram_quota, Args()),
"ram_quota=%ld, cap_quota=%ld",
ram_quota.value,
CAP_QUOTA + cap_quota.value)),
Session_client(cap()) Session_client(cap())
{ } {
upgrade_caps(cap_quota.value);
}
}; };
#endif /* _INCLUDE__LOADER_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__LOADER_SESSION__CONNECTION_H_ */

View File

@ -35,14 +35,13 @@ struct Nic::Connection : Genode::Connection<Session>, Session_client
Genode::Range_allocator *tx_block_alloc, Genode::Range_allocator *tx_block_alloc,
Genode::size_t tx_buf_size, Genode::size_t tx_buf_size,
Genode::size_t rx_buf_size, Genode::size_t rx_buf_size,
char const *label = "") Label const &label = Label())
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(
session(env.parent(), env, label,
"ram_quota=%ld, cap_quota=%ld, " Ram_quota { 32*1024*sizeof(long) + tx_buf_size + rx_buf_size },
"tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", Args("tx_buf_size=", tx_buf_size, ", "
32*1024*sizeof(long) + tx_buf_size + rx_buf_size, "rx_buf_size=", rx_buf_size)),
CAP_QUOTA, tx_buf_size, rx_buf_size, label)),
Session_client(cap(), *tx_block_alloc, env.rm()) Session_client(cap(), *tx_block_alloc, env.rm())
{ } { }
}; };

View File

@ -20,17 +20,13 @@
namespace Pin_control { struct Connection; } namespace Pin_control { struct Connection; }
struct Pin_control::Connection : private Genode::Connection<Session>, struct Pin_control::Connection : private Genode::Connection<Session>,
private Rpc_client<Session> private Rpc_client<Session>
{ {
enum { RAM_QUOTA = 8*1024UL }; Connection(Env &env, Label const &label = Label())
Connection(Env &env, char const *label = "")
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label, Ram_quota { 8*1024 }, Args()),
session(env.parent(),
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Rpc_client<Session>(cap()) Rpc_client<Session>(cap())
{ } { }

View File

@ -19,17 +19,13 @@
namespace Pin_state { struct Connection; } namespace Pin_state { struct Connection; }
struct Pin_state::Connection : private Genode::Connection<Session>, struct Pin_state::Connection : private Genode::Connection<Session>,
private Rpc_client<Session> private Rpc_client<Session>
{ {
enum { RAM_QUOTA = 8*1024UL }; Connection(Env &env, Label const &label = Label())
Connection(Env &env, char const *label = "")
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label, Ram_quota { 8*1024 }, Args()),
session(env.parent(),
"ram_quota=%u, cap_quota=%u, label=\"%s\"",
RAM_QUOTA, CAP_QUOTA, label)),
Rpc_client<Session>(cap()) Rpc_client<Session>(cap())
{ } { }

View File

@ -72,9 +72,7 @@ class Platform::Connection : public Genode::Connection<Session>,
Connection(Env &env) Connection(Env &env)
: :
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, Label(), Ram_quota { 32*1024 }, Args()),
"ram_quota=%u, cap_quota=%u",
RAM_QUOTA, CAP_QUOTA)),
Client(cap()), Client(cap()),
_env(env) _env(env)
{ {

View File

@ -57,7 +57,7 @@ struct Platform::Session : Genode::Session
*/ */
static const char *service_name() { return "Platform"; } static const char *service_name() { return "Platform"; }
enum { RAM_QUOTA = 32 * 1024, CAP_QUOTA = 6 }; enum { CAP_QUOTA = 6 };
virtual ~Session() { } virtual ~Session() { }

View File

@ -22,16 +22,10 @@ namespace Report { struct Connection; }
struct Report::Connection : Genode::Connection<Session>, Session_client struct Report::Connection : Genode::Connection<Session>, Session_client
{ {
enum { RAM_QUOTA = 10*1024 }; /* value used for 'Slave::Connection' */ Connection(Genode::Env &env, Label const &label, size_t buffer_size = 4096)
Connection(Genode::Env &env, char const *label, size_t buffer_size = 4096)
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label, Ram_quota { 10*1024 + buffer_size },
session(env.parent(), Args("buffer_size=", buffer_size)),
"label=\"%s\", ram_quota=%ld, "
"cap_quota=%ld, buffer_size=%zd",
label, RAM_QUOTA + buffer_size,
CAP_QUOTA, buffer_size)),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -23,13 +23,9 @@ namespace Rtc { struct Connection; }
struct Rtc::Connection : Genode::Connection<Session>, Session_client struct Rtc::Connection : Genode::Connection<Session>, Session_client
{ {
/** Connection(Genode::Env &env, Label const &label = Label())
* Constructor
*/
Connection(Genode::Env &env, char const *label = "")
: :
Genode::Connection<Rtc::Session>( Genode::Connection<Rtc::Session>(env, label, Ram_quota { 8*1024 }, Args()),
env, session(env.parent(), "ram_quota=8K, label=\"%s\"", label)),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -57,6 +57,7 @@ struct Rtc::Session : Genode::Session
enum { CAP_QUOTA = 2 }; enum { CAP_QUOTA = 2 };
/*********************** /***********************
** Session interface ** ** Session interface **
***********************/ ***********************/

View File

@ -44,14 +44,9 @@ struct Terminal::Connection : Genode::Connection<Session>, Session_client
sig_rec.dissolve(&sig_ctx); sig_rec.dissolve(&sig_ctx);
} }
/** Connection(Genode::Env &env, Label const &label = Label())
* Constructor
*/
Connection(Genode::Env &env, char const *label = "")
: :
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, label, Ram_quota { 10*1024 }, Args()),
"ram_quota=%ld, cap_quota=%ld, label=\"%s\"",
10*1024, CAP_QUOTA, label)),
Session_client(env.rm(), cap()) Session_client(env.rm(), cap())
{ {
wait_for_connection(cap()); wait_for_connection(cap());

View File

@ -22,12 +22,9 @@ namespace Uart { struct Connection; }
struct Uart::Connection : Genode::Connection<Session>, Session_client struct Uart::Connection : Genode::Connection<Session>, Session_client
{ {
/**
* Constructor
*/
Connection(Genode::Env &env) Connection(Genode::Env &env)
: :
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=%ld", 2*4096)), Genode::Connection<Session>(env, Label(), Ram_quota { 2*4096 }, Args()),
Session_client(env.rm(), cap()) Session_client(env.rm(), cap())
{ {
Terminal::Connection::wait_for_connection(cap()); Terminal::Connection::wait_for_connection(cap());

View File

@ -38,21 +38,14 @@ struct Uplink::Connection : Genode::Connection<Session>, Session_client
Genode::size_t tx_buf_size, Genode::size_t tx_buf_size,
Genode::size_t rx_buf_size, Genode::size_t rx_buf_size,
Net::Mac_address const &mac_address, Net::Mac_address const &mac_address,
char const *label = "") Label const &label = Label())
: :
Genode::Connection<Session>( Genode::Connection<Session>(
env, env, label,
session( Ram_quota { 32*1024*sizeof(long) + tx_buf_size + rx_buf_size },
env.parent(), Args("mac_address=\"", mac_address, "\", "
"ram_quota=%ld, cap_quota=%ld, mac_address=\"%s\", " "tx_buf_size=", tx_buf_size, ", "
"tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"", "rx_buf_size=", rx_buf_size)),
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)),
Session_client(cap(), *tx_block_alloc, env.rm()) Session_client(cap(), *tx_block_alloc, env.rm())
{ } { }
}; };

View File

@ -22,20 +22,15 @@ namespace Usb { struct Connection; }
struct Usb::Connection : Genode::Connection<Session>, Session_client struct Usb::Connection : Genode::Connection<Session>, Session_client
{ {
/**
* Constructor
*/
Connection(Genode::Env &env, Connection(Genode::Env &env,
Genode::Range_allocator *tx_block_alloc, Genode::Range_allocator *tx_block_alloc,
char const *label = "", Label const &label = Label(),
Genode::size_t tx_buf_size = 512*1024, Genode::size_t tx_buf_size = 512*1024,
Genode::Signal_context_capability sigh_state_changed = Genode::Signal_context_capability sigh_state_changed =
Genode::Signal_context_capability()) Genode::Signal_context_capability())
: :
Genode::Connection<Session>(env, Genode::Connection<Session>(env, label, Ram_quota { 5*4096 + tx_buf_size },
session(env.parent(), Args("tx_buf_size=", tx_buf_size)),
"ram_quota=%ld, cap_quota=%ld, tx_buf_size=%ld, label=\"%s\"",
5 * 4096 + tx_buf_size, CAP_QUOTA, tx_buf_size, label)),
Session_client(cap(), *tx_block_alloc, env.rm(), sigh_state_changed) Session_client(cap(), *tx_block_alloc, env.rm(), sigh_state_changed)
{ } { }
}; };

View File

@ -68,7 +68,7 @@ class Gpio::Rpi_driver : public Driver
Rpi_driver(Genode::Env &env) Rpi_driver(Genode::Env &env)
: :
_reg(env, Rpi::GPIO_CONTROLLER_BASE, 0, Rpi::GPIO_CONTROLLER_SIZE), _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), _dispatcher(env.ep(), *this, &Rpi_driver::_handle),
_async(false) _async(false)
{ {

View File

@ -23,25 +23,20 @@
namespace Local { namespace Local {
using namespace Genode; using namespace Genode;
struct Bad_args_nic;
struct Construct_destruct_test; struct Construct_destruct_test;
struct Main; struct Main;
} }
struct Bad_args_nic : Genode::Connection<Nic::Session> struct Local::Bad_args_nic : Connection<Nic::Session>
{ {
Bad_args_nic(Genode::Env &env, Bad_args_nic(Env &env, size_t ram_quota, size_t tx_buf_size, size_t rx_buf_size,
Genode::size_t ram_quota, Session::Label const &label)
Genode::size_t cap_quota,
Genode::size_t tx_buf_size,
Genode::size_t rx_buf_size,
char const *label)
: :
Genode::Connection<Nic::Session>(env, Genode::Connection<Nic::Session>(env, label, Ram_quota { ram_quota },
session(env.parent(), Args("tx_buf_size=", tx_buf_size, ", "
"ram_quota=%ld, cap_quota=%ld, " "rx_buf_size=", rx_buf_size))
"tx_buf_size=%ld, rx_buf_size=%ld, label=\"%s\"",
ram_quota, cap_quota, tx_buf_size, rx_buf_size, label))
{ } { }
}; };
@ -81,7 +76,7 @@ struct Local::Construct_destruct_test
unsigned const round) unsigned const round)
{ {
_bad_args_nic.construct( _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++) { for (unsigned idx = 0; idx < _nr_of_sessions; idx++) {
try { try {
nic[idx].construct(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE); nic[idx].construct(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE);