From 9c1563be6728cea4be9d9adb889236ea4307708c Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 31 Jan 2014 14:04:04 +0100 Subject: [PATCH] base: ease Platform_env::Resources It is unnecessary to remember session caps in a Resources object as the contained connections can cast implicitely to the appropriate caps. ref #989 --- base/src/base/env/platform_env.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/base/src/base/env/platform_env.h b/base/src/base/env/platform_env.h index 0cbabbb440..79063d8c3f 100644 --- a/base/src/base/env/platform_env.h +++ b/base/src/base/env/platform_env.h @@ -96,21 +96,22 @@ class Genode::Platform_env : public Genode::Env, public Emergency_ram_reserve struct Resources { template - Capability request(Parent &parent, char const *service) { - return static_cap_cast(parent.session(service, "")); } + Capability request(Parent &parent, char const *service) + { + return static_cap_cast(parent.session(service, "")); + } - Ram_session_capability ram_cap; - Expanding_ram_session_client ram = { ram_cap }; - Cpu_session_capability cpu_cap; - Expanding_cpu_session_client cpu = { cpu_cap }; + Expanding_ram_session_client ram; + Expanding_cpu_session_client cpu; Expanding_rm_session_client rm; Pd_session_client pd; - Resources(Parent &parent) : - ram_cap(request(parent, "Env::ram_session")), - cpu_cap(request(parent, "Env::cpu_session")), - rm (request (parent, "Env::rm_session")), - pd (request (parent, "Env::pd_session")) + Resources(Parent &parent) + : + ram(request(parent, "Env::ram_session")), + cpu(request(parent, "Env::cpu_session")), + rm (request (parent, "Env::rm_session")), + pd (request (parent, "Env::pd_session")) { } }; @@ -184,9 +185,9 @@ class Genode::Platform_env : public Genode::Env, public Emergency_ram_reserve Parent *parent() { return &_parent_client; } Ram_session *ram_session() { return &_resources.ram; } - Ram_session_capability ram_session_cap() { return _resources.ram_cap; } + Ram_session_capability ram_session_cap() { return _resources.ram; } Cpu_session *cpu_session() { return &_resources.cpu; } - Cpu_session_capability cpu_session_cap() { return _resources.cpu_cap; } + Cpu_session_capability cpu_session_cap() { return _resources.cpu; } Rm_session *rm_session() { return &_resources.rm; } Pd_session *pd_session() { return &_resources.pd; } Allocator *heap() { return &_heap; }