mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-10 21:01:49 +00:00
init: access Ram_session as const
This is now possible because the new 'used_ram' and 'ram_quota' RPC functions are declared as const. Issue #2398
This commit is contained in:
parent
6609aafb05
commit
f02c8328db
@ -535,7 +535,8 @@ class Genode::Child : protected Rpc_object<Parent>,
|
||||
|
||||
typedef typename CONNECTION::Session_type SESSION;
|
||||
|
||||
SESSION &session() { return _connection->session(); }
|
||||
SESSION &session() { return _connection->session(); }
|
||||
SESSION const &session() const { return _connection->session(); }
|
||||
|
||||
Capability<SESSION> cap() const {
|
||||
return _connection.constructed() ? _connection->cap()
|
||||
@ -661,9 +662,10 @@ class Genode::Child : protected Rpc_object<Parent>,
|
||||
|
||||
Parent_capability parent_cap() const { return cap(); }
|
||||
|
||||
Ram_session &ram() { return _ram.session(); }
|
||||
Cpu_session &cpu() { return _cpu.session(); }
|
||||
Pd_session &pd() { return _pd .session(); }
|
||||
Ram_session &ram() { return _ram.session(); }
|
||||
Ram_session const &ram() const { return _ram.session(); }
|
||||
Cpu_session &cpu() { return _cpu.session(); }
|
||||
Pd_session &pd() { return _pd .session(); }
|
||||
|
||||
/**
|
||||
* Request factory for creating session-state objects
|
||||
|
@ -135,6 +135,11 @@ class Genode::Local_connection : Local_connection_base
|
||||
throw Parent::Service_denied();
|
||||
}
|
||||
|
||||
SESSION const &session() const
|
||||
{
|
||||
return const_cast<Local_connection *>(this)->session();
|
||||
}
|
||||
|
||||
Local_connection(Service &service, Id_space<Parent::Client> &id_space,
|
||||
Parent::Client::Id id, Args const &args,
|
||||
Affinity const &affinity,
|
||||
|
@ -287,12 +287,7 @@ void Init::Child::report_state(Xml_generator &xml, Report_detail const &detail)
|
||||
xml.attribute("assigned", String<32> {
|
||||
Number_of_bytes(_resources.assigned_ram_quota.value) });
|
||||
|
||||
/*
|
||||
* The const cast is needed because there is no const
|
||||
* accessor for the RAM session of the child.
|
||||
*/
|
||||
auto &nonconst_child = const_cast<Genode::Child &>(_child);
|
||||
generate_ram_info(xml, nonconst_child.ram());
|
||||
generate_ram_info(xml, _child.ram());
|
||||
|
||||
if (_requested_resources.constructed())
|
||||
xml.attribute("requested", String<32> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user