mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-02 09:18:18 +00:00
Pass Env & as first argument to connection objects
This patch supplements each existing connection type with an new constructor that is meant to replace the original one. The new one takes a reference to the component's environment as argument and thereby does not rely on the presence of the globally accessible 'env()' interface. The original constructors are marked as deprecated. Once we have completely abolished the use of the global 'env()', we will remove them. Fixes #1960
This commit is contained in:
parent
3361651e9e
commit
a7b3072cc2
@ -18,27 +18,49 @@
|
||||
#include <cpu_session/client.h>
|
||||
#include <base/connection.h>
|
||||
|
||||
namespace Genode {
|
||||
namespace Genode { struct Cpu_connection; }
|
||||
|
||||
struct Cpu_connection : Connection<Cpu_session>, Cpu_session_client
|
||||
|
||||
struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
|
||||
{
|
||||
enum { RAM_QUOTA = 128*1024 };
|
||||
|
||||
Capability<Cpu_session> _session(Parent &parent,
|
||||
char const *label, long priority,
|
||||
Affinity const &affinity)
|
||||
{
|
||||
enum { RAM_QUOTA = 128*1024 };
|
||||
return session(parent, affinity,
|
||||
"priority=0x%lx, ram_quota=128K, label=\"%s\"",
|
||||
priority, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param label initial session label
|
||||
* \param priority designated priority of all threads created
|
||||
* with this CPU session
|
||||
*/
|
||||
Cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY,
|
||||
Affinity const &affinity = Affinity())
|
||||
:
|
||||
Connection<Cpu_session>(
|
||||
session(affinity, "priority=0x%lx, ram_quota=128K, label=\"%s\"",
|
||||
priority, label)),
|
||||
Cpu_session_client(cap()) { }
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 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,
|
||||
Affinity const &affinity = Affinity())
|
||||
:
|
||||
Connection<Cpu_session>(env, _session(env.parent(), label, priority, affinity)),
|
||||
Cpu_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY,
|
||||
Affinity const &affinity = Affinity())
|
||||
:
|
||||
Connection<Cpu_session>(_session(*env()->parent(), label, priority, affinity)),
|
||||
Cpu_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__CPU_SESSION__CONNECTION_H_ */
|
||||
|
@ -18,28 +18,48 @@
|
||||
#include <cpu_session/cpu_session.h>
|
||||
#include <base/connection.h>
|
||||
|
||||
namespace Genode
|
||||
namespace Genode { struct Vm_connection; }
|
||||
|
||||
|
||||
struct Genode::Vm_connection : Connection<Vm_session>, Vm_session_client
|
||||
{
|
||||
/**
|
||||
* Connection to a VM service
|
||||
*/
|
||||
struct Vm_connection : Connection<Vm_session>, Vm_session_client
|
||||
Capability<Vm_session> _session(Parent &parent, char const *label, long priority,
|
||||
unsigned long affinity)
|
||||
{
|
||||
/**
|
||||
* 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(const char *label = "",
|
||||
long priority = Cpu_session::DEFAULT_PRIORITY,
|
||||
unsigned long affinity = 0)
|
||||
: Connection<Vm_session>(
|
||||
session("priority=0x%lx, affinity=0x%lx, ram_quota=16K, label=\"%s\"",
|
||||
priority, affinity, label)),
|
||||
Vm_session_client(cap()) { }
|
||||
};
|
||||
}
|
||||
return session(parent,
|
||||
"priority=0x%lx, affinity=0x%lx, ram_quota=16K, label=\"%s\"",
|
||||
priority, affinity, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = "",
|
||||
long priority = Cpu_session::DEFAULT_PRIORITY,
|
||||
unsigned long affinity = 0)
|
||||
:
|
||||
Connection<Vm_session>(env, _session(env.parent(), label, priority, affinity)),
|
||||
Vm_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Vm_connection(const char *label = "",
|
||||
long priority = Cpu_session::DEFAULT_PRIORITY,
|
||||
unsigned long affinity = 0)
|
||||
:
|
||||
Connection<Vm_session>(_session(*env()->parent(), label, priority, affinity)),
|
||||
Vm_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__VM_SESSION__CONNECTION_H_ */
|
||||
|
@ -42,9 +42,12 @@ class Genode::Connection : public Noncopyable
|
||||
|
||||
Capability<SESSION_TYPE> _cap;
|
||||
|
||||
Parent &_parent;
|
||||
|
||||
On_destruction _on_destruction;
|
||||
|
||||
Capability<SESSION_TYPE> _session(Affinity const &affinity,
|
||||
Capability<SESSION_TYPE> _session(Parent &parent,
|
||||
Affinity const &affinity,
|
||||
const char *format_args, va_list list)
|
||||
{
|
||||
char buf[FORMAT_STRING_SIZE];
|
||||
@ -55,7 +58,7 @@ class Genode::Connection : public Noncopyable
|
||||
va_end(list);
|
||||
|
||||
/* call parent interface with the resulting argument buffer */
|
||||
return env()->parent()->session<SESSION_TYPE>(buf, affinity);
|
||||
return parent.session<SESSION_TYPE>(buf, affinity);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -73,8 +76,18 @@ class Genode::Connection : public Noncopyable
|
||||
* session capability of the connection to another party but never
|
||||
* invokes any of the session's RPC functions.
|
||||
*/
|
||||
Connection(Capability<SESSION_TYPE> cap, On_destruction od = CLOSE):
|
||||
_cap(cap), _on_destruction(od) { }
|
||||
Connection(Env &env, Capability<SESSION_TYPE> cap, On_destruction od = CLOSE)
|
||||
: _cap(cap), _parent(env.parent()), _on_destruction(od) { }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(Capability<SESSION_TYPE> cap, On_destruction od = CLOSE)
|
||||
: _cap(cap), _parent(*env()->parent()), _on_destruction(od) { }
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -82,7 +95,7 @@ class Genode::Connection : public Noncopyable
|
||||
~Connection()
|
||||
{
|
||||
if (_on_destruction == CLOSE)
|
||||
env()->parent()->close(_cap);
|
||||
_parent.close(_cap);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,19 +108,49 @@ class Genode::Connection : public Noncopyable
|
||||
*/
|
||||
void on_destruction(On_destruction od) { _on_destruction = od; }
|
||||
|
||||
/**
|
||||
* Issue session request to the parent
|
||||
*/
|
||||
Capability<SESSION_TYPE> session(Parent &parent, const char *format_args, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format_args);
|
||||
|
||||
return _session(parent, Affinity(), format_args, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue session request to the parent
|
||||
*/
|
||||
Capability<SESSION_TYPE> session(Parent &parent,
|
||||
Affinity const &affinity,
|
||||
char const *format_args, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format_args);
|
||||
|
||||
return _session(parent, affinity, format_args, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for env()->parent()->session()
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated to be removed along with Genode::env()
|
||||
*/
|
||||
Capability<SESSION_TYPE> session(const char *format_args, ...)
|
||||
{
|
||||
va_list list;
|
||||
va_start(list, format_args);
|
||||
|
||||
return _session(Affinity(), format_args, list);
|
||||
return _session(*env()->parent(), Affinity(), format_args, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for env()->parent()->session()
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated to be removed along with Genode::env()
|
||||
*/
|
||||
Capability<SESSION_TYPE> session(Affinity const &affinity,
|
||||
char const *format_args, ...)
|
||||
|
@ -24,6 +24,14 @@ struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
|
||||
{
|
||||
enum { RAM_QUOTA = 36*1024 };
|
||||
|
||||
Capability<Cpu_session> _session(Parent &parent, char const *label,
|
||||
long priority, Affinity const &affinity)
|
||||
{
|
||||
return session(parent, affinity,
|
||||
"priority=0x%lx, ram_quota=128K, label=\"%s\"",
|
||||
priority, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -31,14 +39,26 @@ struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
|
||||
* \param priority designated priority of all threads created
|
||||
* with this CPU session
|
||||
*/
|
||||
Cpu_connection(char const *label = "",
|
||||
long priority = DEFAULT_PRIORITY,
|
||||
Cpu_connection(Env &env, const char *label = "", long priority = DEFAULT_PRIORITY,
|
||||
Affinity const &affinity = Affinity())
|
||||
:
|
||||
Connection<Cpu_session>(
|
||||
session(affinity, "priority=0x%lx, ram_quota=%u, label=\"%s\"",
|
||||
priority, RAM_QUOTA, label)),
|
||||
Cpu_session_client(cap()) { }
|
||||
Connection<Cpu_session>(env, _session(env.parent(), label, priority, affinity)),
|
||||
Cpu_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY,
|
||||
Affinity const &affinity = Affinity())
|
||||
:
|
||||
Connection<Cpu_session>(_session(*env()->parent(), label, priority, affinity)),
|
||||
Cpu_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__CPU_SESSION__CONNECTION_H_ */
|
||||
|
@ -22,6 +22,13 @@ namespace Genode { struct Io_mem_connection; }
|
||||
|
||||
struct Genode::Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_client
|
||||
{
|
||||
Capability<Io_mem_session> _session(Parent &parent, addr_t base, size_t size,
|
||||
bool write_combined)
|
||||
{
|
||||
return session("ram_quota=4K, base=0x%p, size=0x%zx, wc=%s",
|
||||
base, size, write_combined ? "yes" : "no");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -31,10 +38,7 @@ 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)
|
||||
:
|
||||
Connection<Io_mem_session>(
|
||||
session("ram_quota=4K, base=0x%p, size=0x%zx, wc=%s",
|
||||
base, size, write_combined ? "yes" : "no")),
|
||||
|
||||
Connection<Io_mem_session>(env, _session(env.parent(), base, size, write_combined)),
|
||||
Io_mem_session_client(cap())
|
||||
{ }
|
||||
|
||||
@ -47,10 +51,7 @@ struct Genode::Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_cl
|
||||
*/
|
||||
Io_mem_connection(addr_t base, size_t size, bool write_combined = false)
|
||||
:
|
||||
Connection<Io_mem_session>(
|
||||
session("ram_quota=4K, base=0x%p, size=0x%zx, wc=%s",
|
||||
base, size, write_combined ? "yes" : "no")),
|
||||
|
||||
Connection<Io_mem_session>(_session(*env()->parent(), base, size, write_combined)),
|
||||
Io_mem_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -23,18 +23,34 @@ namespace Genode { struct Io_port_connection; }
|
||||
struct Genode::Io_port_connection : Connection<Io_port_session>,
|
||||
Io_port_session_client
|
||||
{
|
||||
Capability<Io_port_session> _session(Parent &parent, unsigned base, unsigned size)
|
||||
{
|
||||
return session(parent, "ram_quota=4K, io_port_base=%u, io_port_size=%u",
|
||||
base, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param base base address of port range
|
||||
* \param size size of port range
|
||||
*/
|
||||
Io_port_connection(Env &env, unsigned base, unsigned size)
|
||||
:
|
||||
Connection<Io_port_session>(env, _session(env.parent(), base, size)),
|
||||
Io_port_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Io_port_connection(unsigned base, unsigned size)
|
||||
:
|
||||
Connection<Io_port_session>(
|
||||
session("ram_quota=4K, io_port_base=%u, io_port_size=%u",
|
||||
base, size)),
|
||||
|
||||
Connection<Io_port_session>(_session(*env()->parent(), base, size)),
|
||||
Io_port_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -21,26 +21,51 @@ namespace Genode { struct Irq_connection; }
|
||||
|
||||
struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client
|
||||
{
|
||||
public:
|
||||
Capability<Irq_session> _session(Parent &parent,
|
||||
unsigned irq,
|
||||
Irq_session::Trigger trigger,
|
||||
Irq_session::Polarity polarity,
|
||||
Genode::addr_t device_config_phys)
|
||||
{
|
||||
return session("ram_quota=4K, irq_number=%u, irq_trigger=%u, "
|
||||
" irq_polarity=%u, device_config_phys=0x%lx",
|
||||
irq, trigger, polarity, device_config_phys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param irq physical interrupt number
|
||||
* \param trigger interrupt trigger (e.g., level/edge)
|
||||
* \param polarity interrupt trigger polarity (e.g., low/high)
|
||||
*/
|
||||
Irq_connection(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)
|
||||
:
|
||||
Connection<Irq_session>(
|
||||
session("ram_quota=4K, irq_number=%u, irq_trigger=%u, "
|
||||
" irq_polarity=%u, device_config_phys=0x%lx",
|
||||
irq, trigger, polarity, device_config_phys)),
|
||||
Irq_session_client(cap())
|
||||
{ }
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param irq 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)
|
||||
:
|
||||
Connection<Irq_session>(env, _session(env.parent(), irq, trigger,
|
||||
polarity, device_config_phys)),
|
||||
Irq_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Irq_connection(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)
|
||||
:
|
||||
Connection<Irq_session>(_session(*Genode::env()->parent(), irq,
|
||||
trigger, polarity, device_config_phys)),
|
||||
Irq_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__IRQ_SESSION__CONNECTION_H_ */
|
||||
|
@ -22,6 +22,22 @@ namespace Genode { struct Log_connection; }
|
||||
|
||||
struct Genode::Log_connection : Connection<Log_session>, Log_session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Log_connection(Env &env)
|
||||
:
|
||||
Connection<Log_session>(env, session(env.parent(), "ram_quota=8K")),
|
||||
Log_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Log_connection()
|
||||
:
|
||||
Connection<Log_session>(session("ram_quota=8K")),
|
||||
|
@ -29,9 +29,24 @@ struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
|
||||
*
|
||||
* \param label session label
|
||||
*/
|
||||
Pd_connection(Env &env, char const *label = "")
|
||||
:
|
||||
Connection<Pd_session>(env, session(env.parent(),
|
||||
"ram_quota=%u, label=\"%s\"",
|
||||
RAM_QUOTA, label)),
|
||||
Pd_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Pd_connection(char const *label = "")
|
||||
: Connection<Pd_session>(session("ram_quota=%u, label=\"%s\"",
|
||||
RAM_QUOTA, label)),
|
||||
:
|
||||
Connection<Pd_session>(session("ram_quota=%u, label=\"%s\"", RAM_QUOTA, label)),
|
||||
Pd_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -24,18 +24,37 @@ struct Genode::Ram_connection : Connection<Ram_session>, Ram_session_client
|
||||
{
|
||||
enum { RAM_QUOTA = 4*1024*sizeof(long) };
|
||||
|
||||
Capability<Ram_session> _session(Parent &parent, char const *label,
|
||||
addr_t phys_start, size_t phys_size)
|
||||
{
|
||||
return session(parent,
|
||||
"ram_quota=%u, phys_start=0x%lx, phys_size=0x%zx, "
|
||||
"label=\"%s\"", RAM_QUOTA, phys_start, phys_size, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param label session label
|
||||
*/
|
||||
Ram_connection(Env &env, const char *label = "", unsigned long phys_start = 0UL,
|
||||
unsigned long phys_size = 0UL)
|
||||
:
|
||||
Connection<Ram_session>(env, _session(env.parent(), label, phys_start, phys_size)),
|
||||
Ram_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Ram_connection(const char *label = "", unsigned long phys_start = 0UL,
|
||||
unsigned long phys_size = 0UL)
|
||||
:
|
||||
Connection<Ram_session>(
|
||||
session("ram_quota=%u, phys_start=0x%lx, phys_size=0x%lx, "
|
||||
"label=\"%s\"", RAM_QUOTA, phys_start, phys_size, label)),
|
||||
|
||||
Connection<Ram_session>(_session(*env()->parent(), label, phys_start, phys_size)),
|
||||
Ram_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -24,9 +24,27 @@ struct Genode::Rm_connection : Connection<Rm_session>, Rm_session_client
|
||||
{
|
||||
enum { RAM_QUOTA = 64*1024 };
|
||||
|
||||
Rm_connection() :
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Rm_connection(Env &env)
|
||||
:
|
||||
Connection<Rm_session>(env, session(env.parent(), "ram_quota=%u", RAM_QUOTA)),
|
||||
Rm_session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Rm_connection()
|
||||
:
|
||||
Connection<Rm_session>(session("ram_quota=%u", RAM_QUOTA)),
|
||||
Rm_session_client(cap()) { }
|
||||
Rm_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__RM_SESSION__CONNECTION_H_ */
|
||||
|
@ -30,10 +30,12 @@ class Genode::Rom_connection : public Connection<Rom_session>,
|
||||
|
||||
private:
|
||||
|
||||
Rom_session_capability _create_session(const char *module_name, const char *label)
|
||||
Rom_session_capability _session(Parent &parent,
|
||||
char const *module_name,
|
||||
char const *label)
|
||||
{
|
||||
try {
|
||||
return session("ram_quota=4K, filename=\"%s\", label=\"%s\"",
|
||||
return session(parent, "ram_quota=4K, filename=\"%s\", label=\"%s\"",
|
||||
module_name, label ? label: module_name); }
|
||||
catch (...) {
|
||||
PERR("Could not open ROM session for module \"%s\"", module_name);
|
||||
@ -53,7 +55,7 @@ class Genode::Rom_connection : public Connection<Rom_session>,
|
||||
*/
|
||||
Rom_connection(Env &env, const char *module_name, const char *label = 0)
|
||||
:
|
||||
Connection<Rom_session>(_create_session(module_name, label)),
|
||||
Connection<Rom_session>(env, _session(env.parent(), module_name, label)),
|
||||
Rom_session_client(cap())
|
||||
{ }
|
||||
|
||||
@ -66,7 +68,7 @@ class Genode::Rom_connection : public Connection<Rom_session>,
|
||||
*/
|
||||
Rom_connection(const char *module_name, const char *label = 0)
|
||||
:
|
||||
Connection<Rom_session>(_create_session(module_name, label)),
|
||||
Connection<Rom_session>(_session(*env()->parent(), module_name, label)),
|
||||
Rom_session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -23,6 +23,16 @@ namespace Genode { namespace Trace { struct Connection; } }
|
||||
struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
||||
Genode::Trace::Session_client
|
||||
{
|
||||
Capability<Trace::Session> _session(Parent &parent,
|
||||
size_t ram_quota,
|
||||
size_t arg_buffer_size,
|
||||
unsigned parent_levels)
|
||||
{
|
||||
return session(parent,
|
||||
"ram_quota=%zu, arg_buffer_size=%zu, parent_levels=%u",
|
||||
ram_quota, arg_buffer_size, parent_levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -30,11 +40,26 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
||||
* \param arg_buffer_size session argument-buffer size
|
||||
* \param parent_levels number of parent levels to trace
|
||||
*/
|
||||
Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) :
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zu, arg_buffer_size=%zu, parent_levels=%u",
|
||||
ram_quota, arg_buffer_size, parent_levels)),
|
||||
Session_client(cap()) { }
|
||||
Connection(Env &env, size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels)
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), ram_quota,
|
||||
arg_buffer_size, parent_levels)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels)
|
||||
:
|
||||
Genode::Connection<Session>(_session(*env()->parent(), ram_quota,
|
||||
arg_buffer_size, parent_levels)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__TRACE_SESSION__CONNECTION_H_ */
|
||||
|
@ -18,12 +18,17 @@
|
||||
#include <base/connection.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
|
||||
namespace Audio_in { struct Connection; }
|
||||
|
||||
|
||||
struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_client
|
||||
{
|
||||
Capability<Audio_in::Session> _session(Genode::Parent &parent, char const *channel)
|
||||
{
|
||||
return session(parent, "ram_quota=%zd, channel=\"%s\"",
|
||||
2*4096 + sizeof(Stream), channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -31,11 +36,22 @@ struct Audio_in::Connection : Genode::Connection<Session>, Audio_in::Session_cli
|
||||
* call 'wait_for_progress', which is sent when the
|
||||
* server processed one or more packets
|
||||
*/
|
||||
Connection(Genode::Env &env, char const *channel, bool progress_signal = false)
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), channel)),
|
||||
Session_client(cap(), progress_signal)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(char const *channel, bool progress_signal = false)
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, channel=\"%s\"",
|
||||
2*4096 + sizeof(Stream), channel)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), channel)),
|
||||
Session_client(cap(), progress_signal)
|
||||
{ }
|
||||
};
|
||||
|
@ -18,12 +18,17 @@
|
||||
#include <base/connection.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
|
||||
namespace Audio_out { struct Connection; }
|
||||
|
||||
|
||||
struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_client
|
||||
{
|
||||
Capability<Audio_out::Session> _session(Genode::Parent &parent, char const *channel)
|
||||
{
|
||||
return session(parent, "ram_quota=%zd, channel=\"%s\"",
|
||||
2*4096 + sizeof(Stream), channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -34,13 +39,27 @@ struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_c
|
||||
* call 'wait_for_progress', which is sent when the
|
||||
* server processed one or more packets
|
||||
*/
|
||||
Connection(Genode::Env &env,
|
||||
char const *channel,
|
||||
bool alloc_signal = true,
|
||||
bool progress_signal = false)
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), channel)),
|
||||
Session_client(cap(), alloc_signal, progress_signal)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(const char *channel,
|
||||
bool alloc_signal = true,
|
||||
bool progress_signal = false)
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, channel=\"%s\"",
|
||||
2*4096 + sizeof(Stream), channel)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), channel)),
|
||||
Session_client(cap(), alloc_signal, progress_signal)
|
||||
{ }
|
||||
};
|
||||
|
@ -22,6 +22,13 @@ namespace Block { struct Connection; }
|
||||
|
||||
struct Block::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<Block::Session> _session(Genode::Parent &parent,
|
||||
char const *label, Genode::size_t tx_buf_size)
|
||||
{
|
||||
return session(parent, "ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"",
|
||||
3*4096 + tx_buf_size, tx_buf_size, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -29,14 +36,29 @@ struct Block::Connection : Genode::Connection<Session>, Session_client
|
||||
* transmission buffer
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
*/
|
||||
Connection(Genode::Env &env,
|
||||
Genode::Range_allocator *tx_block_alloc,
|
||||
Genode::size_t tx_buf_size = 128*1024,
|
||||
const char *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(Genode::Range_allocator *tx_block_alloc,
|
||||
Genode::size_t tx_buf_size = 128*1024,
|
||||
const char *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"",
|
||||
3*4096 + tx_buf_size, tx_buf_size, label)),
|
||||
Session_client(cap(), tx_block_alloc) { }
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__BLOCK_SESSION__CONNECTION_H_ */
|
||||
|
@ -35,15 +35,51 @@ namespace File_system {
|
||||
*/
|
||||
struct File_system::Connection_base : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<File_system::Session> _session(Genode::Parent &parent,
|
||||
char const *label,
|
||||
char const *root,
|
||||
bool writeable,
|
||||
size_t tx_buf_size)
|
||||
{
|
||||
return session(parent,
|
||||
"ram_quota=%zd, "
|
||||
"tx_buf_size=%zd, "
|
||||
"label=\"%s\", "
|
||||
"root=\"%s\", "
|
||||
"writeable=%d",
|
||||
8*1024*sizeof(long) + tx_buf_size,
|
||||
tx_buf_size,
|
||||
label, root, writeable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param tx_buffer_alloc allocator used for managing the
|
||||
* transmission buffer
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
* \param label session label
|
||||
* \param root root directory of session
|
||||
* \param writeable session is writable
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
*/
|
||||
Connection_base(Genode::Env &env,
|
||||
Genode::Range_allocator &tx_block_alloc,
|
||||
char const *label = "",
|
||||
char const *root = "/",
|
||||
bool writeable = true,
|
||||
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE)
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label, root,
|
||||
writeable, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection_base(Genode::Range_allocator &tx_block_alloc,
|
||||
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE,
|
||||
@ -51,15 +87,8 @@ struct File_system::Connection_base : Genode::Connection<Session>, Session_clien
|
||||
char const *root = "/",
|
||||
bool writeable = true)
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, "
|
||||
"tx_buf_size=%zd, "
|
||||
"label=\"%s\", "
|
||||
"root=\"%s\", "
|
||||
"writeable=%d",
|
||||
8*1024*sizeof(long) + tx_buf_size,
|
||||
tx_buf_size,
|
||||
label, root, writeable)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label,
|
||||
root, writeable, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
};
|
||||
|
@ -29,7 +29,8 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
/**
|
||||
* Create session and return typed session capability
|
||||
*/
|
||||
Session_capability _connect(unsigned width, unsigned height,
|
||||
Session_capability _connect(Genode::Parent &parent,
|
||||
unsigned width, unsigned height,
|
||||
Mode::Format format)
|
||||
{
|
||||
using namespace Genode;
|
||||
@ -48,7 +49,7 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
if (format != Mode::INVALID)
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_format", format);
|
||||
|
||||
return session(argbuf);
|
||||
return session(parent, argbuf);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -56,19 +57,33 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param width desired frame-buffer width
|
||||
* \param height desired frame-buffer height
|
||||
* \param mode desired pixel format
|
||||
* \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<Session>(env, _connect(env.parent(),
|
||||
mode.width(), mode.height(),
|
||||
mode.format())),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(unsigned width = 0,
|
||||
unsigned height = 0,
|
||||
Mode::Format format = Mode::INVALID)
|
||||
:
|
||||
Genode::Connection<Session>(_connect(width, height, format)),
|
||||
Genode::Connection<Session>(_connect(*Genode::env()->parent(),
|
||||
width, height, format)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -23,9 +23,28 @@ namespace Gpio { struct Connection; }
|
||||
|
||||
struct Gpio::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env, unsigned long gpio_pin)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(),
|
||||
"ram_quota=8K, gpio=%zd", gpio_pin)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(unsigned long gpio_pin)
|
||||
: Genode::Connection<Session>(session("ram_quota=8K, gpio=%zd", gpio_pin)),
|
||||
Session_client(cap()) { }
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=8K, gpio=%zd", gpio_pin)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__GPIO_SESSION__CONNECTION_H_ */
|
||||
|
@ -21,6 +21,22 @@ namespace Input { struct Connection; }
|
||||
|
||||
struct Input::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=16K")),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=16K")),
|
||||
|
@ -23,6 +23,23 @@ namespace Loader { struct Connection; }
|
||||
|
||||
struct Loader::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env, size_t ram_quota)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(),
|
||||
"ram_quota=%zd", ram_quota)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(size_t ram_quota)
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=%zd", ram_quota)),
|
||||
|
@ -23,6 +23,16 @@ namespace Nic { struct Connection; }
|
||||
|
||||
struct Nic::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<Nic::Session> _session(Genode::Parent &parent,
|
||||
char const *label,
|
||||
Genode::size_t tx_buf_size,
|
||||
Genode::size_t rx_buf_size)
|
||||
{
|
||||
return session(parent,
|
||||
"ram_quota=%zd, tx_buf_size=%zd, rx_buf_size=%zd, label=\"%s\"",
|
||||
6*4096 + tx_buf_size + rx_buf_size, tx_buf_size, rx_buf_size, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -31,15 +41,31 @@ struct Nic::Connection : Genode::Connection<Session>, Session_client
|
||||
* \param tx_buf_size size of transmission buffer in bytes
|
||||
* \param rx_buf_size size of reception buffer in bytes
|
||||
*/
|
||||
Connection(Genode::Env &env,
|
||||
Genode::Range_allocator *tx_block_alloc,
|
||||
Genode::size_t tx_buf_size,
|
||||
Genode::size_t rx_buf_size,
|
||||
char const *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label,
|
||||
tx_buf_size, rx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(Genode::Range_allocator *tx_block_alloc,
|
||||
Genode::size_t tx_buf_size,
|
||||
Genode::size_t rx_buf_size,
|
||||
char const *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("ram_quota=%zd, tx_buf_size=%zd, rx_buf_size=%zd, label=\"%s\"",
|
||||
6*4096 + tx_buf_size + rx_buf_size,
|
||||
tx_buf_size, rx_buf_size, label)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label,
|
||||
tx_buf_size, rx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc)
|
||||
{ }
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
|
||||
/**
|
||||
* Create session and return typed session capability
|
||||
*/
|
||||
Session_capability _connect(char const *label)
|
||||
Session_capability _connect(Genode::Parent &parent, char const *label)
|
||||
{
|
||||
enum { ARGBUF_SIZE = 128 };
|
||||
char argbuf[ARGBUF_SIZE];
|
||||
@ -51,7 +51,7 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
|
||||
enum { SESSION_METADATA = 36*1024 };
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota", SESSION_METADATA);
|
||||
|
||||
return session(argbuf);
|
||||
return session(parent, argbuf);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -59,10 +59,28 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env, char const *label = "")
|
||||
:
|
||||
/* establish nitpicker session */
|
||||
Genode::Connection<Session>(env, _connect(env.parent(), label)),
|
||||
Session_client(cap()),
|
||||
|
||||
/* request frame-buffer and input sub sessions */
|
||||
_framebuffer(framebuffer_session()),
|
||||
_input(input_session())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(char const *label = "")
|
||||
:
|
||||
/* establish nitpicker session */
|
||||
Genode::Connection<Session>(_connect(label)),
|
||||
Genode::Connection<Session>(_connect(*Genode::env()->parent(), label)),
|
||||
Session_client(cap()),
|
||||
|
||||
/* request frame-buffer and input sub sessions */
|
||||
|
@ -23,6 +23,20 @@ namespace Platform { class Connection; }
|
||||
|
||||
struct Platform::Connection : Genode::Connection<Session>, Client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
: Genode::Connection<Session>(env, session(env.parent(), "ram_quota=4K")),
|
||||
Client(cap()) { }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
: Genode::Connection<Session>(session("ram_quota=4K")),
|
||||
Client(cap()) { }
|
||||
|
@ -23,6 +23,26 @@ namespace Regulator { struct Connection; }
|
||||
|
||||
struct Regulator::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<Regulator::Session> _session(Genode::Parent &parent,
|
||||
char const *label,
|
||||
Regulator_id regulator)
|
||||
{
|
||||
return session("ram_quota=8K, regulator=\"%s\", label=\"%s\"",
|
||||
regulator_name_by_id(regulator), label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param regulator identifier for the specific regulator
|
||||
* \param label string identifier of the client
|
||||
*/
|
||||
Connection(Genode::Env &env, Regulator_id regulator, const char * label = "")
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label, regulator)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -30,10 +50,10 @@ struct Regulator::Connection : Genode::Connection<Session>, Session_client
|
||||
* \param label string identifier of the client
|
||||
*/
|
||||
Connection(Regulator_id regulator, const char * label = "")
|
||||
: Genode::Connection<Session>(
|
||||
session("ram_quota=8K, regulator=\"%s\", label=\"%s\"",
|
||||
regulator_name_by_id(regulator), label)),
|
||||
Session_client(cap()) { }
|
||||
:
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, regulator)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__REGULATOR_SESSION__CONNECTION_H_ */
|
||||
|
@ -22,11 +22,32 @@ namespace Report { struct Connection; }
|
||||
|
||||
struct Report::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<Report::Session> _session(Genode::Parent &parent,
|
||||
char const *label, size_t buffer_size)
|
||||
{
|
||||
return session(parent, "label=\"%s\", ram_quota=%zd, buffer_size=%zd",
|
||||
label, 2*4096 + buffer_size, buffer_size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env, char const *label, size_t buffer_size = 4096)
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label, buffer_size)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(char const *label, size_t buffer_size = 4096)
|
||||
:
|
||||
Genode::Connection<Session>(
|
||||
session("label=\"%s\", ram_quota=%zd, buffer_size=%zd",
|
||||
label, 2*4096 + buffer_size, buffer_size)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, buffer_size)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -23,9 +23,27 @@ namespace Rtc { struct Connection; }
|
||||
|
||||
struct Rtc::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Connection() :
|
||||
Genode::Connection<Rtc::Session>(session("foo, ram_quota=4K")),
|
||||
Session_client(cap()) { }
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Rtc::Session>(env, session(env.parent(), "ram_quota=4K")),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
:
|
||||
Genode::Connection<Rtc::Session>(session("ram_quota=4K")),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__RTC_SESSION__CONNECTION_H_ */
|
||||
|
@ -29,7 +29,8 @@ class Framebuffer::Imx_connection : public Genode::Connection<Imx_session>,
|
||||
/**
|
||||
* Create session and return typed session capability
|
||||
*/
|
||||
Capability<Imx_session> _connect(unsigned width, unsigned height,
|
||||
Capability<Imx_session> _connect(Genode::Parent &parent,
|
||||
unsigned width, unsigned height,
|
||||
Mode::Format format)
|
||||
{
|
||||
using namespace Genode;
|
||||
@ -48,7 +49,7 @@ class Framebuffer::Imx_connection : public Genode::Connection<Imx_session>,
|
||||
if (format != Mode::INVALID)
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_format", format);
|
||||
|
||||
return session(argbuf);
|
||||
return session(parent, argbuf);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -56,18 +57,32 @@ class Framebuffer::Imx_connection : public Genode::Connection<Imx_session>,
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param width desired frame-buffer width
|
||||
* \param height desired frame-buffer height
|
||||
* \param mode desired pixel format
|
||||
* \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.
|
||||
*/
|
||||
Imx_connection(Genode::Env &env, Framebuffer::Mode mode)
|
||||
:
|
||||
Genode::Connection<Imx_session>(env, _connect(env.parent(),
|
||||
mode.width(), mode.height(),
|
||||
mode.format())),
|
||||
Imx_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Imx_connection(unsigned width = 0,
|
||||
unsigned height = 0,
|
||||
Mode::Format format = Mode::INVALID)
|
||||
: Genode::Connection<Imx_session>(_connect(width, height, format)),
|
||||
: Genode::Connection<Imx_session>(_connect(*Genode::env()->parent(),
|
||||
width, height, format)),
|
||||
Imx_client(cap()) { }
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,22 @@ namespace Platform { struct Connection; }
|
||||
|
||||
struct Platform::Connection : Genode::Connection<Session>, Client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Session>(env, session("ram_quota=20K")),
|
||||
Client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=20K")),
|
||||
|
@ -42,6 +42,26 @@ struct Terminal::Connection : Genode::Connection<Session>, Session_client
|
||||
sig_rec.dissolve(&sig_ctx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env, char const *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(),
|
||||
"ram_quota=%zd, label=\"%s\"",
|
||||
2*4096, label)),
|
||||
Session_client(cap())
|
||||
{
|
||||
wait_for_connection(cap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(char const *label = "")
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=%zd, label=\"%s\"",
|
||||
|
@ -24,19 +24,40 @@ class Timer::Connection : public Genode::Connection<Session>, public Session_cli
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Lock _lock;
|
||||
Genode::Signal_receiver _sig_rec;
|
||||
Genode::Signal_context _default_sigh_ctx;
|
||||
Genode::Signal_context_capability _default_sigh_cap;
|
||||
Genode::Lock _lock;
|
||||
Genode::Signal_receiver _sig_rec;
|
||||
Genode::Signal_context _default_sigh_ctx;
|
||||
|
||||
Genode::Signal_context_capability
|
||||
_default_sigh_cap = _sig_rec.manage(&_default_sigh_ctx);
|
||||
|
||||
Genode::Signal_context_capability _custom_sigh_cap;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=8K")),
|
||||
Session_client(cap())
|
||||
{
|
||||
/* register default signal handler */
|
||||
Session_client::sigh(_default_sigh_cap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=8K")),
|
||||
Session_client(cap()),
|
||||
_default_sigh_cap(_sig_rec.manage(&_default_sigh_ctx))
|
||||
Session_client(cap())
|
||||
{
|
||||
/* register default signal handler */
|
||||
Session_client::sigh(_default_sigh_cap);
|
||||
|
@ -22,6 +22,24 @@ namespace Uart { struct Connection; }
|
||||
|
||||
struct Uart::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=%zd", 2*4096)),
|
||||
Session_client(cap())
|
||||
{
|
||||
Terminal::Connection::wait_for_connection(cap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=%zd", 2*4096)),
|
||||
|
@ -22,17 +22,42 @@ namespace Usb { struct Connection; }
|
||||
|
||||
struct Usb::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Capability<Usb::Session> _session(Genode::Parent &parent,
|
||||
char const *label,
|
||||
Genode::size_t tx_buf_size)
|
||||
{
|
||||
return session(parent, "ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"",
|
||||
3 * 4096 + tx_buf_size, tx_buf_size, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a USB device.
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env,
|
||||
Genode::Range_allocator *tx_block_alloc,
|
||||
char const *label = "",
|
||||
Genode::size_t tx_buf_size = 512 * 1024,
|
||||
Genode::Signal_context_capability sigh_state_changed =
|
||||
Genode::Signal_context_capability())
|
||||
:
|
||||
Genode::Connection<Session>(env, _session(env.parent(), label, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc, sigh_state_changed)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection(Genode::Range_allocator *tx_block_alloc,
|
||||
char const *label = "",
|
||||
Genode::size_t tx_buf_size = 512 * 1024,
|
||||
Genode::Signal_context_capability sigh_state_changed =
|
||||
Genode::Signal_context_capability())
|
||||
Genode::Signal_context_capability())
|
||||
:
|
||||
Genode::Connection<Session>(session("ram_quota=%zd, tx_buf_size=%zd, label=\"%s\"",
|
||||
3 * 4096 + tx_buf_size, tx_buf_size, label)),
|
||||
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, tx_buf_size)),
|
||||
Session_client(cap(), tx_block_alloc, sigh_state_changed)
|
||||
{ }
|
||||
};
|
||||
|
@ -17,15 +17,29 @@
|
||||
#include <noux_session/client.h>
|
||||
#include <base/connection.h>
|
||||
|
||||
namespace Noux {
|
||||
namespace Noux { struct Connection; }
|
||||
|
||||
struct Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Connection() :
|
||||
Genode::Connection<Session>(session("")),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
}
|
||||
|
||||
struct Noux::Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Connection(Genode::Env &env)
|
||||
:
|
||||
Genode::Connection<Session>(env, session(env.parent(), "")),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \noapi
|
||||
* \deprecated Use the constructor with 'Env &' as first
|
||||
* argument instead
|
||||
*/
|
||||
Connection()
|
||||
: Genode::Connection<Session>(session("")), Session_client(cap()) { }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__NOUX_SESSION__CONNECTION_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user