From 0d744354487ea612231a67b18015c27cdefdee12 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 24 Mar 2015 13:20:28 +0100 Subject: [PATCH] base: remove Genode::parent_cap from the API Components interact with their environments using the Genode::Env class instead of directly using the parent capability. --- repos/base/include/base/env.h | 34 ++++++++++--------- repos/base/src/base/env/platform_env_common.h | 3 ++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/repos/base/include/base/env.h b/repos/base/include/base/env.h index 7ef86abd5b..0467150b4f 100644 --- a/repos/base/include/base/env.h +++ b/repos/base/include/base/env.h @@ -32,18 +32,20 @@ namespace Genode { struct Env; - extern Env *env(); - /** - * Return parent capability - * - * Platforms have to implement this function for environment - * initialization. + * Return the interface to the component's environment */ - Parent_capability parent_cap(); + extern Env *env(); } +/** + * Component runtime environment + * + * The environment of a Genode component is defined by its parent. The 'Env' + * class allows the component to interact with its environment. It is + * initialized at the startup of the component. + */ struct Genode::Env { virtual ~Env() { } @@ -54,35 +56,35 @@ struct Genode::Env virtual Parent *parent() = 0; /** - * RAM session for the program + * RAM session of the component * - * The RAM Session represents a quota of memory that is - * available to the program. Quota can be used to allocate - * RAM-Dataspaces. + * The RAM Session represents a budget of memory (quota) that is + * available to the component. This budget can be used to allocate + * RAM dataspaces. */ virtual Ram_session *ram_session() = 0; virtual Ram_session_capability ram_session_cap() = 0; /** - * CPU session for the program + * CPU session of the component * - * This session is used to create threads. + * This session is used to create the threads of the component. */ virtual Cpu_session *cpu_session() = 0; virtual Cpu_session_capability cpu_session_cap() = 0; /** - * Region manager session of the program + * Region-manager session of the component as created by the parent */ virtual Rm_session *rm_session() = 0; /** - * Pd session of the program + * PD session of the component as created by the parent */ virtual Pd_session *pd_session() = 0; /** - * Heap backed by the ram_session of the environment. + * Heap backed by the RAM session of the environment */ virtual Allocator *heap() = 0; }; diff --git a/repos/base/src/base/env/platform_env_common.h b/repos/base/src/base/env/platform_env_common.h index b1891f65dd..8b73be3270 100644 --- a/repos/base/src/base/env/platform_env_common.h +++ b/repos/base/src/base/env/platform_env_common.h @@ -25,10 +25,13 @@ #include namespace Genode { + class Expanding_rm_session_client; class Expanding_ram_session_client; class Expanding_cpu_session_client; class Expanding_parent_client; + + Parent_capability parent_cap(); }