Warn about the use of deprecated env() function

This patch enables warnings if one of the deprecate functions that rely
in the implicit use of the global Genode::env() accessor are called.

For the time being, some places within the base framework continue
to rely on the global function while omitting the warning by calling
'env_deprecated' instead of 'env'.

Issue #1987
This commit is contained in:
Norman Feske 2017-01-09 15:18:49 +01:00
parent 4c7ab07480
commit a7f40b24ca
80 changed files with 360 additions and 178 deletions

View File

@ -37,5 +37,5 @@ void Thread::_thread_bootstrap() { }
void Thread::_init_platform_thread(size_t, Type type) void Thread::_init_platform_thread(size_t, Type type)
{ {
if (type == NORMAL) { return; } if (type == NORMAL) { return; }
_thread_cap = Genode::env()->parent()->main_thread_cap(); _thread_cap = Genode::env_deprecated()->parent()->main_thread_cap();
} }

View File

@ -60,9 +60,9 @@ struct Genode::Vm_connection : Connection<Vm_session>, Vm_session_client
*/ */
Vm_connection(const char *label = "", Vm_connection(const char *label = "",
long priority = Cpu_session::DEFAULT_PRIORITY, long priority = Cpu_session::DEFAULT_PRIORITY,
unsigned long affinity = 0) unsigned long affinity = 0) __attribute__((deprecated))
: :
Connection<Vm_session>(_session(*env()->parent(), label, priority, affinity)), Connection<Vm_session>(_session(*env_deprecated()->parent(), label, priority, affinity)),
Vm_session_client(cap()) Vm_session_client(cap())
{ } { }
}; };

View File

@ -37,12 +37,12 @@ namespace Hw {
void Thread::_init_platform_thread(size_t weight, Type type) void Thread::_init_platform_thread(size_t weight, Type type)
{ {
if (!_cpu_session) { _cpu_session = env()->cpu_session(); } if (!_cpu_session) { _cpu_session = env_deprecated()->cpu_session(); }
if (type == NORMAL) { if (type == NORMAL) {
/* create server object */ /* create server object */
addr_t const utcb = (addr_t)&_stack->utcb(); addr_t const utcb = (addr_t)&_stack->utcb();
_thread_cap = _cpu_session->create_thread(env()->pd_session_cap(), _thread_cap = _cpu_session->create_thread(env_deprecated()->pd_session_cap(),
name(), _affinity, name(), _affinity,
Weight(weight), utcb); Weight(weight), utcb);
return; return;
@ -63,14 +63,14 @@ void Thread::_init_platform_thread(size_t weight, Type type)
} }
/* adjust initial object state in case of a main thread */ /* adjust initial object state in case of a main thread */
native_thread().cap = Hw::_main_thread_cap; native_thread().cap = Hw::_main_thread_cap;
_thread_cap = env()->parent()->main_thread_cap(); _thread_cap = env_deprecated()->parent()->main_thread_cap();
} }
void Thread::_deinit_platform_thread() void Thread::_deinit_platform_thread()
{ {
if (!_cpu_session) if (!_cpu_session)
_cpu_session = env()->cpu_session(); _cpu_session = env_deprecated()->cpu_session();
_cpu_session->kill_thread(_thread_cap); _cpu_session->kill_thread(_thread_cap);

View File

@ -50,7 +50,8 @@ class Sync::Connection : public Genode::Connection<Session>,
* *
* \throw Connection_failed * \throw Connection_failed
*/ */
Connection() : Connection() __attribute__((deprecated))
:
Genode::Connection<Session>(_create_session()), Genode::Connection<Session>(_create_session()),
Session_client(cap()) Session_client(cap())
{ } { }

View File

@ -107,7 +107,7 @@ class Genode::Region_map_mmap : public Region_map, public Dataspace
{ {
/* detach sub RM session when destructed */ /* detach sub RM session when destructed */
if (_sub_rm && _is_attached()) if (_sub_rm && _is_attached())
env()->rm_session()->detach((void *)_base); env_deprecated()->rm_session()->detach((void *)_base);
} }

View File

@ -180,7 +180,7 @@ namespace Genode {
Socket_pair server_socket_pair() Socket_pair server_socket_pair()
{ {
Linux_native_cpu_client native_cpu(env()->cpu_session()->native_cpu()); Linux_native_cpu_client native_cpu(env_deprecated()->cpu_session()->native_cpu());
Socket_pair socket_pair; Socket_pair socket_pair;

View File

@ -86,11 +86,11 @@ void Thread::_init_platform_thread(size_t weight, Type type)
{ {
/* if no cpu session is given, use it from the environment */ /* if no cpu session is given, use it from the environment */
if (!_cpu_session) if (!_cpu_session)
_cpu_session = env()->cpu_session(); _cpu_session = env_deprecated()->cpu_session();
/* for normal threads create an object at the CPU session */ /* for normal threads create an object at the CPU session */
if (type == NORMAL) { if (type == NORMAL) {
_thread_cap = _cpu_session->create_thread(env()->pd_session_cap(), _thread_cap = _cpu_session->create_thread(env_deprecated()->pd_session_cap(),
_stack->name().string(), _stack->name().string(),
Affinity::Location(), Affinity::Location(),
Weight()); Weight());
@ -98,7 +98,7 @@ void Thread::_init_platform_thread(size_t weight, Type type)
} }
/* adjust initial object state for main threads */ /* adjust initial object state for main threads */
native_thread().futex_counter = main_thread_futex_counter; native_thread().futex_counter = main_thread_futex_counter;
_thread_cap = env()->parent()->main_thread_cap(); _thread_cap = env_deprecated()->parent()->main_thread_cap();
} }

View File

@ -79,7 +79,7 @@ void Thread::_init_platform_thread(size_t weight, Type type)
/* for main threads the member initialization differs */ /* for main threads the member initialization differs */
if (type == MAIN || type == REINITIALIZED_MAIN) { if (type == MAIN || type == REINITIALIZED_MAIN) {
_thread_cap = env()->parent()->main_thread_cap(); _thread_cap = env_deprecated()->parent()->main_thread_cap();
native_thread().exc_pt_sel = 0; native_thread().exc_pt_sel = 0;
native_thread().ec_sel = Nova::PT_SEL_MAIN_EC; native_thread().ec_sel = Nova::PT_SEL_MAIN_EC;
@ -107,10 +107,10 @@ void Thread::_init_platform_thread(size_t weight, Type type)
/* if no cpu session is given, use it from the environment */ /* if no cpu session is given, use it from the environment */
if (!_cpu_session) if (!_cpu_session)
_cpu_session = env()->cpu_session(); _cpu_session = env_deprecated()->cpu_session();
/* create thread at core */ /* create thread at core */
_thread_cap = _cpu_session->create_thread(env()->pd_session_cap(), name(), _thread_cap = _cpu_session->create_thread(env_deprecated()->pd_session_cap(), name(),
_affinity, Weight(weight)); _affinity, Weight(weight));
if (!_thread_cap.valid()) if (!_thread_cap.valid())
throw Cpu_session::Thread_creation_failed(); throw Cpu_session::Thread_creation_failed();

View File

@ -84,5 +84,5 @@ void Genode::Thread::_init_platform_thread(size_t, Type type)
{ {
if (type == NORMAL) { return; } if (type == NORMAL) { return; }
native_thread().l4id.raw = main_thread_tid.raw; native_thread().l4id.raw = main_thread_tid.raw;
_thread_cap = env()->parent()->main_thread_cap(); _thread_cap = env_deprecated()->parent()->main_thread_cap();
} }

View File

@ -52,5 +52,5 @@ void Genode::Thread::_init_platform_thread(size_t, Type type)
{ {
if (type == NORMAL) { return; } if (type == NORMAL) { return; }
native_thread().l4id = main_thread_tid; native_thread().l4id = main_thread_tid;
_thread_cap = env()->parent()->main_thread_cap(); _thread_cap = env_deprecated()->parent()->main_thread_cap();
} }

View File

@ -33,6 +33,8 @@ class Genode::Attached_dataspace : Noncopyable
Dataspace_capability _ds; Dataspace_capability _ds;
Region_map &_rm;
size_t const _size = { Dataspace_client(_ds).size() }; size_t const _size = { Dataspace_client(_ds).size() };
void * _local_addr = nullptr; void * _local_addr = nullptr;
@ -54,7 +56,7 @@ class Genode::Attached_dataspace : Noncopyable
* \throw Invalid_dataspace * \throw Invalid_dataspace
*/ */
Attached_dataspace(Region_map &rm, Dataspace_capability ds) Attached_dataspace(Region_map &rm, Dataspace_capability ds)
: _ds(_check(ds)), _local_addr(rm.attach(_ds)) { } : _ds(_check(ds)), _rm(rm), _local_addr(_rm.attach(_ds)) { }
/** /**
* Constructor * Constructor
@ -63,8 +65,8 @@ class Genode::Attached_dataspace : Noncopyable
* \deprecated Use the constructor with 'Region_map &' as first * \deprecated Use the constructor with 'Region_map &' as first
* argument instead * argument instead
*/ */
Attached_dataspace(Dataspace_capability ds) Attached_dataspace(Dataspace_capability ds) __attribute__((deprecated))
: _ds(_check(ds)), _local_addr(env()->rm_session()->attach(_ds)) { } : _ds(_check(ds)), _rm(*env_deprecated()->rm_session()), _local_addr(_rm.attach(_ds)) { }
/** /**
* Destructor * Destructor
@ -72,7 +74,7 @@ class Genode::Attached_dataspace : Noncopyable
~Attached_dataspace() ~Attached_dataspace()
{ {
if (_local_addr) if (_local_addr)
env()->rm_session()->detach(_local_addr); _rm.detach(_local_addr);
} }
/** /**

View File

@ -70,10 +70,10 @@ class Genode::Attached_io_mem_dataspace
* argument instead * argument instead
*/ */
Attached_io_mem_dataspace(Genode::addr_t base, Genode::size_t size, Attached_io_mem_dataspace(Genode::addr_t base, Genode::size_t size,
bool write_combined = false) bool write_combined = false) __attribute__((deprecated))
: :
_env_rm(*env()->rm_session()), _env_rm(*env_deprecated()->rm_session()),
_mmio(base, size, write_combined), _mmio(false, base, size, write_combined),
_ds(_mmio.dataspace()), _ds(_mmio.dataspace()),
_local_addr(_env_rm.attach(_ds)) _local_addr(_env_rm.attach(_ds))
{ {

View File

@ -109,9 +109,9 @@ class Genode::Attached_ram_dataspace
* 'Region_map &' arguments instead. * 'Region_map &' arguments instead.
*/ */
Attached_ram_dataspace(Ram_session *ram, size_t size, Attached_ram_dataspace(Ram_session *ram, size_t size,
Cache_attribute cached = CACHED) Cache_attribute cached = CACHED) __attribute__((deprecated))
: :
_size(size), _ram(ram), _rm(env()->rm_session()), _cached(cached) _size(size), _ram(ram), _rm(env_deprecated()->rm_session()), _cached(cached)
{ {
_alloc_and_attach(); _alloc_and_attach();
} }

View File

@ -78,8 +78,9 @@ class Genode::Attached_rom_dataspace
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Attached_rom_dataspace(char const *name) Attached_rom_dataspace(char const *name) __attribute__((deprecated))
: _rm(*env()->rm_session()), _rom(name) { _try_attach(); } : _rm(*env_deprecated()->rm_session()), _rom(false /* deprecated */, name)
{ _try_attach(); }
/** /**
* Return capability of the used dataspace * Return capability of the used dataspace

View File

@ -175,7 +175,7 @@ class Genode::Connection : public Connection_base
va_list list; va_list list;
va_start(list, format_args); va_start(list, format_args);
_session(*env()->parent(), Affinity(), format_args, list); _session(*env_deprecated()->parent(), Affinity(), format_args, list);
return Capability<SESSION_TYPE>(); return Capability<SESSION_TYPE>();
} }

View File

@ -24,6 +24,10 @@
namespace Genode { struct Cap_connection; } namespace Genode { struct Cap_connection; }
#ifndef INCLUDED_BY_ENTRYPOINT_CC
#warning cap_session.h is deprecated
#endif
/* /*
* There are no CAP connections anymore. The only situation where CAP * There are no CAP connections anymore. The only situation where CAP
@ -37,7 +41,7 @@ namespace Genode { struct Cap_connection; }
*/ */
struct Genode::Cap_connection : Pd_session_client struct Genode::Cap_connection : Pd_session_client
{ {
Cap_connection() : Pd_session_client(env()->pd_session_cap()) { } Cap_connection() : Pd_session_client(env_deprecated()->pd_session_cap()) { }
}; } __attribute__((deprecated));
#endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */ #endif /* _INCLUDE__CAP_SESSION__CONNECTION_H_ */

View File

@ -59,9 +59,9 @@ struct Genode::Cpu_connection : Connection<Cpu_session>, Cpu_session_client
* argument instead * argument instead
*/ */
Cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY, Cpu_connection(const char *label = "", long priority = DEFAULT_PRIORITY,
Affinity const &affinity = Affinity()) Affinity const &affinity = Affinity()) __attribute__((deprecated))
: :
Connection<Cpu_session>(_session(*env()->parent(), label, priority, affinity)), Connection<Cpu_session>(_session(*env_deprecated()->parent(), label, priority, affinity)),
Cpu_session_client(cap()) Cpu_session_client(cap())
{ } { }
}; };

View File

@ -35,8 +35,22 @@ namespace Genode {
/** /**
* Return the interface to the component's environment * Return the interface to the component's environment
*
* \noapi
* \deprecated
*/ */
extern Env_deprecated *env(); extern Env_deprecated *env_deprecated();
/**
* Return the interface to the component's environment
*
* \deprecated
*/
static inline Env_deprecated *env() __attribute__((deprecated));
static inline Env_deprecated *env()
{
return env_deprecated();
}
} }

View File

@ -54,9 +54,25 @@ struct Genode::Io_mem_connection : Connection<Io_mem_session>, Io_mem_session_cl
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Io_mem_connection(addr_t base, size_t size, bool write_combined = false) Io_mem_connection(addr_t base, size_t size, bool write_combined = false) __attribute__((deprecated))
: :
Connection<Io_mem_session>(_session(*env()->parent(), base, size, write_combined)), Connection<Io_mem_session>(_session(*env_deprecated()->parent(), base, size, write_combined)),
Io_mem_session_client(cap())
{ }
/**
* Constructor
*
* \noapi
* \deprecated Use the constructor with 'Env &' as first
* argument instead
*
* This variant is solely meant to be called from deprecated functions.
* It will be removed along with these functions.
*/
Io_mem_connection(bool, addr_t base, size_t size, bool write_combined = false)
:
Connection<Io_mem_session>(_session(*env_deprecated()->parent(), base, size, write_combined)),
Io_mem_session_client(cap()) Io_mem_session_client(cap())
{ } { }
}; };

View File

@ -53,9 +53,9 @@ struct Genode::Io_port_connection : Connection<Io_port_session>,
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Io_port_connection(unsigned base, unsigned size) Io_port_connection(unsigned base, unsigned size) __attribute__((deprecated))
: :
Connection<Io_port_session>(_session(*env()->parent(), base, size)), Connection<Io_port_session>(_session(*env_deprecated()->parent(), base, size)),
Io_port_session_client(cap()) Io_port_session_client(cap())
{ } { }
}; };

View File

@ -65,9 +65,9 @@ struct Genode::Irq_connection : Connection<Irq_session>, Irq_session_client
Irq_connection(unsigned irq, Irq_connection(unsigned irq,
Irq_session::Trigger trigger = Irq_session::TRIGGER_UNCHANGED, Irq_session::Trigger trigger = Irq_session::TRIGGER_UNCHANGED,
Irq_session::Polarity polarity = Irq_session::POLARITY_UNCHANGED, Irq_session::Polarity polarity = Irq_session::POLARITY_UNCHANGED,
Genode::addr_t device_config_phys = 0) Genode::addr_t device_config_phys = 0) __attribute__((deprecated))
: :
Connection<Irq_session>(_session(*Genode::env()->parent(), irq, Connection<Irq_session>(_session(*Genode::env_deprecated()->parent(), irq,
trigger, polarity, device_config_phys)), trigger, polarity, device_config_phys)),
Irq_session_client(cap()) Irq_session_client(cap())
{ } { }

View File

@ -43,7 +43,7 @@ struct Genode::Log_connection : Connection<Log_session>, Log_session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Log_connection(Session_label label = Session_label()) Log_connection(Session_label label = Session_label()) __attribute__((deprecated))
: :
Connection<Log_session>(session("ram_quota=%ld, label=\"%s\"", Connection<Log_session>(session("ram_quota=%ld, label=\"%s\"",
RAM_QUOTA, label.string())), RAM_QUOTA, label.string())),

View File

@ -44,7 +44,7 @@ struct Genode::Pd_connection : Connection<Pd_session>, Pd_session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Pd_connection(char const *label = "") Pd_connection(char const *label = "") __attribute__((deprecated))
: :
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()) Pd_session_client(cap())

View File

@ -57,9 +57,9 @@ struct Genode::Ram_connection : Connection<Ram_session>, Ram_session_client
* argument instead * argument instead
*/ */
Ram_connection(const char *label = "", unsigned long phys_start = 0UL, Ram_connection(const char *label = "", unsigned long phys_start = 0UL,
unsigned long phys_size = 0UL) unsigned long phys_size = 0UL) __attribute__((deprecated))
: :
Connection<Ram_session>(_session(*env()->parent(), label, phys_start, phys_size)), Connection<Ram_session>(_session(*env_deprecated()->parent(), label, phys_start, phys_size)),
Ram_session_client(cap()) Ram_session_client(cap())
{ } { }
}; };

View File

@ -40,7 +40,7 @@ struct Genode::Rm_connection : Connection<Rm_session>, Rm_session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Rm_connection() Rm_connection() __attribute__((deprecated))
: :
Connection<Rm_session>(session("ram_quota=%u", RAM_QUOTA)), Connection<Rm_session>(session("ram_quota=%u", RAM_QUOTA)),
Rm_session_client(cap()) Rm_session_client(cap())

View File

@ -63,9 +63,33 @@ class Genode::Rom_connection : public Connection<Rom_session>,
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Rom_connection(const char *label) Rom_connection(const char *label) __attribute__((deprecated))
try : try :
Connection<Rom_session>(_session(*env()->parent(), label)), Connection<Rom_session>(_session(*env_deprecated()->parent(), label)),
Rom_session_client(cap())
{ }
catch (...) {
error("Could not open ROM session for \"", label, "\"");
throw Rom_connection_failed();
}
/**
* Constructor
*
* \noapi
* \deprecated Use the constructor with 'Env &' as first
* argument instead
*
* This version is deliberately used by functions that are marked as
* deprecated. If such a function called directly the
* __attribute__((deprecate)) version, we would always get a warning,
* even if the outer deprecated function is not called.
*
* It will be removed as soon as they are gone.
*/
Rom_connection(bool, const char *label)
try :
Connection<Rom_session>(_session(*env_deprecated()->parent(), label)),
Rom_session_client(cap()) Rom_session_client(cap())
{ } { }
catch (...) { catch (...) {

View File

@ -59,7 +59,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*env()->parent(), ram_quota, Genode::Connection<Session>(_session(*env()->parent(), ram_quota,
arg_buffer_size, parent_levels)), arg_buffer_size, parent_levels)),

View File

@ -193,7 +193,7 @@ _ZN6Genode3Log8_releaseEv T
_ZN6Genode3Raw7_outputEv T _ZN6Genode3Raw7_outputEv T
_ZN6Genode3Raw8_acquireEv T _ZN6Genode3Raw8_acquireEv T
_ZN6Genode3Raw8_releaseEv T _ZN6Genode3Raw8_releaseEv T
_ZN6Genode3envEv T _ZN6Genode14env_deprecatedEv T
_ZN6Genode4Heap11quota_limitEm T _ZN6Genode4Heap11quota_limitEm T
_ZN6Genode4Heap4freeEPvm T _ZN6Genode4Heap4freeEPvm T
_ZN6Genode4Heap5allocEmPPv T _ZN6Genode4Heap5allocEmPPv T

View File

@ -36,13 +36,13 @@ class Genode::Trace::Control_area
static Ram_dataspace_capability _try_alloc(size_t size) static Ram_dataspace_capability _try_alloc(size_t size)
{ {
try { return env()->ram_session()->alloc(size); } try { return env_deprecated()->ram_session()->alloc(size); }
catch (...) { return Ram_dataspace_capability(); } catch (...) { return Ram_dataspace_capability(); }
} }
static Trace::Control *_try_attach(Dataspace_capability ds) static Trace::Control *_try_attach(Dataspace_capability ds)
{ {
try { return env()->rm_session()->attach(ds); } try { return env_deprecated()->rm_session()->attach(ds); }
catch (...) { return 0; } catch (...) { return 0; }
} }
@ -61,8 +61,8 @@ class Genode::Trace::Control_area
~Control_area() ~Control_area()
{ {
if (_local_base) env()->rm_session()->detach(_local_base); if (_local_base) env_deprecated()->rm_session()->detach(_local_base);
if (_ds.valid()) env()->ram_session()->free(_ds); if (_ds.valid()) env_deprecated()->ram_session()->free(_ds);
} }
Dataspace_capability dataspace() const { return _ds; } Dataspace_capability dataspace() const { return _ds; }

View File

@ -57,13 +57,13 @@ class Genode::Trace::Session_component
: :
ram(ram), ram(ram),
ds(ram.alloc(size)), ds(ram.alloc(size)),
base(env()->rm_session()->attach(ds)), base(env_deprecated()->rm_session()->attach(ds)),
size(ds.call<Dataspace::Rpc_size>()) size(ds.call<Dataspace::Rpc_size>())
{ } { }
~Argument_buffer() ~Argument_buffer()
{ {
env()->rm_session()->detach(base); env_deprecated()->rm_session()->detach(base);
ram.free(ds); ram.free(ds);
} }
} _argument_buffer; } _argument_buffer;

View File

@ -102,13 +102,13 @@ class Genode::Trace::Subject
_ds = ram.alloc(_size); _ds = ram.alloc(_size);
/* copy content */ /* copy content */
void *src = env()->rm_session()->attach(from_ds), void *src = env_deprecated()->rm_session()->attach(from_ds),
*dst = env()->rm_session()->attach(_ds); *dst = env_deprecated()->rm_session()->attach(_ds);
memcpy(dst, src, _size); memcpy(dst, src, _size);
env()->rm_session()->detach(src); env_deprecated()->rm_session()->detach(src);
env()->rm_session()->detach(dst); env_deprecated()->rm_session()->detach(dst);
return true; return true;
} }

View File

@ -63,7 +63,7 @@ Core_env * Genode::core_env()
} }
Env_deprecated * Genode::env() { Env_deprecated * Genode::env_deprecated() {
return core_env(); } return core_env(); }
@ -148,7 +148,7 @@ class Core_child : public Child_policy
_core_ram_cap(core_ram_cap), _core_ram(core_ram), _core_ram_cap(core_ram_cap), _core_ram(core_ram),
_core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu), _core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu),
_ram_quota(Child::effective_ram_quota(ram_quota)), _ram_quota(Child::effective_ram_quota(ram_quota)),
_child(*env()->rm_session(), _entrypoint, *this) _child(*env_deprecated()->rm_session(), _entrypoint, *this)
{ {
_entrypoint.activate(); _entrypoint.activate();
} }
@ -250,7 +250,7 @@ int main()
* Allocate session meta data on distinct dataspaces to enable independent * Allocate session meta data on distinct dataspaces to enable independent
* destruction (to enable quota trading) of session component objects. * destruction (to enable quota trading) of session component objects.
*/ */
static Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session()); static Sliced_heap sliced_heap(env_deprecated()->ram_session(), env_deprecated()->rm_session());
/* /*
* Factory for creating RPC capabilities within core * Factory for creating RPC capabilities within core
@ -303,7 +303,7 @@ int main()
log("", ram_quota / (1024*1024), " MiB RAM assigned to init"); log("", ram_quota / (1024*1024), " MiB RAM assigned to init");
static Reconstructible<Core_child> static Reconstructible<Core_child>
init(services, *env()->ram_session(), env()->ram_session_cap(), init(services, *env_deprecated()->ram_session(), env_deprecated()->ram_session_cap(),
ram_quota, core_cpu, core_cpu_cap); ram_quota, core_cpu, core_cpu_cap);
platform()->wait_for_exit(); platform()->wait_for_exit();

View File

@ -151,7 +151,7 @@ Session_component::Session_component(Allocator &md_alloc, size_t ram_quota,
char const *label, Source_registry &sources, char const *label, Source_registry &sources,
Policy_registry &policies) Policy_registry &policies)
: :
_ram(*env()->ram_session()), _ram(*env_deprecated()->ram_session()),
_md_alloc(&md_alloc, ram_quota), _md_alloc(&md_alloc, ram_quota),
_subjects_slab(&_md_alloc), _subjects_slab(&_md_alloc),
_policies_slab(&_md_alloc), _policies_slab(&_md_alloc),

View File

@ -62,7 +62,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
enum { ALLOC_OVERHEAD = 4096U }; enum { ALLOC_OVERHEAD = 4096U };
Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu", Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu",
size + ALLOC_OVERHEAD); size + ALLOC_OVERHEAD);
env()->parent()->resource_request(buf); env_deprecated()->parent()->resource_request(buf);
}, },
NUM_ATTEMPTS); NUM_ATTEMPTS);
} }
@ -84,7 +84,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client<Genode::Ram_ses
*/ */
char buf[128]; char buf[128];
Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu", amount); Genode::snprintf(buf, sizeof(buf), "ram_quota=%lu", amount);
env()->parent()->resource_request(buf); env_deprecated()->parent()->resource_request(buf);
} }
return ret; return ret;
} }

View File

@ -38,7 +38,7 @@ struct Genode::Upgradeable_client : CLIENT
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), "ram_quota=%lu", quota); snprintf(buf, sizeof(buf), "ram_quota=%lu", quota);
env()->parent()->upgrade(_id, buf); env_deprecated()->parent()->upgrade(_id, buf);
} }
}; };

View File

@ -34,7 +34,7 @@ namespace {
{ {
Genode::Entrypoint &_ep; Genode::Entrypoint &_ep;
Genode::Parent &_parent = *env()->parent(); Genode::Parent &_parent = *env_deprecated()->parent();
/** /**
* Lock for serializing 'session' and 'close' * Lock for serializing 'session' and 'close'
@ -63,25 +63,25 @@ namespace {
Env(Genode::Entrypoint &ep) : _ep(ep) { env_ptr = this; } Env(Genode::Entrypoint &ep) : _ep(ep) { env_ptr = this; }
Genode::Parent &parent() override { return _parent; } Genode::Parent &parent() override { return _parent; }
Genode::Ram_session &ram() override { return *Genode::env()->ram_session(); } Genode::Ram_session &ram() override { return *Genode::env_deprecated()->ram_session(); }
Genode::Cpu_session &cpu() override { return *Genode::env()->cpu_session(); } Genode::Cpu_session &cpu() override { return *Genode::env_deprecated()->cpu_session(); }
Genode::Region_map &rm() override { return *Genode::env()->rm_session(); } Genode::Region_map &rm() override { return *Genode::env_deprecated()->rm_session(); }
Genode::Pd_session &pd() override { return *Genode::env()->pd_session(); } Genode::Pd_session &pd() override { return *Genode::env_deprecated()->pd_session(); }
Genode::Entrypoint &ep() override { return _ep; } Genode::Entrypoint &ep() override { return _ep; }
Genode::Ram_session_capability ram_session_cap() override Genode::Ram_session_capability ram_session_cap() override
{ {
return Genode::env()->ram_session_cap(); return Genode::env_deprecated()->ram_session_cap();
} }
Genode::Cpu_session_capability cpu_session_cap() override Genode::Cpu_session_capability cpu_session_cap() override
{ {
return Genode::env()->cpu_session_cap(); return Genode::env_deprecated()->cpu_session_cap();
} }
Genode::Pd_session_capability pd_session_cap() override Genode::Pd_session_capability pd_session_cap() override
{ {
return Genode::env()->pd_session_cap(); return Genode::env_deprecated()->pd_session_cap();
} }
Genode::Id_space<Parent::Client> &id_space() override Genode::Id_space<Parent::Client> &id_space() override

View File

@ -15,7 +15,11 @@
/* Genode includes */ /* Genode includes */
#include <base/entrypoint.h> #include <base/entrypoint.h>
#include <base/component.h> #include <base/component.h>
#define INCLUDED_BY_ENTRYPOINT_CC /* prevent "deprecated" warning */
#include <cap_session/connection.h> #include <cap_session/connection.h>
#undef INCLUDED_BY_ENTRYPOINT_CC
#include <util/retry.h> #include <util/retry.h>
/* base-internal includes */ /* base-internal includes */

View File

@ -22,7 +22,7 @@ namespace Genode {
/* /*
* Request pointer to static environment of the Genode application * Request pointer to static environment of the Genode application
*/ */
Env_deprecated *env() Env_deprecated *env_deprecated()
{ {
/* /*
* By placing the environment as static object here, we ensure that its * By placing the environment as static object here, we ensure that its

View File

@ -30,7 +30,7 @@ class Log_console : public Console
struct Log : Log_session_client struct Log : Log_session_client
{ {
Session_capability _cap() { Session_capability _cap() {
return env()->parent()->session_cap(Parent::Env::log()); } return env_deprecated()->parent()->session_cap(Parent::Env::log()); }
Log() : Log_session_client(reinterpret_cap_cast<Log_session>(_cap())) Log() : Log_session_client(reinterpret_cap_cast<Log_session>(_cap()))
{ } { }

View File

@ -26,7 +26,7 @@ Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &pd,
Untyped_capability new_obj_cap = Untyped_capability new_obj_cap =
retry<Genode::Pd_session::Out_of_metadata>( retry<Genode::Pd_session::Out_of_metadata>(
[&] () { return pd.alloc_rpc_cap(_cap); }, [&] () { return pd.alloc_rpc_cap(_cap); },
[&] () { env()->parent()->upgrade(Parent::Env::pd(), [&] () { env_deprecated()->parent()->upgrade(Parent::Env::pd(),
"ram_quota=16K"); }); "ram_quota=16K"); });
return new_obj_cap; return new_obj_cap;

View File

@ -41,7 +41,7 @@ class Signal_handler_thread : Thread, Lock
void entry() void entry()
{ {
_signal_source.construct(env()->pd_session()->alloc_signal_source()); _signal_source.construct(env_deprecated()->pd_session()->alloc_signal_source());
unlock(); unlock();
Signal_receiver::dispatch_signals(&(*_signal_source)); Signal_receiver::dispatch_signals(&(*_signal_source));
} }
@ -68,7 +68,7 @@ class Signal_handler_thread : Thread, Lock
~Signal_handler_thread() ~Signal_handler_thread()
{ {
env()->pd_session()->free_signal_source(*_signal_source); env_deprecated()->pd_session()->free_signal_source(*_signal_source);
} }
}; };
@ -232,7 +232,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
retry<Pd_session::Out_of_metadata>( retry<Pd_session::Out_of_metadata>(
[&] () { [&] () {
/* use signal context as imprint */ /* use signal context as imprint */
context->_cap = env()->pd_session()->alloc_context(_cap, (long)context); context->_cap = env_deprecated()->pd_session()->alloc_context(_cap, (long)context);
}, },
[&] () { [&] () {
size_t const quota = 1024*sizeof(long); size_t const quota = 1024*sizeof(long);
@ -241,7 +241,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
log("upgrading quota donation for PD session (", quota, " bytes)"); log("upgrading quota donation for PD session (", quota, " bytes)");
env()->parent()->upgrade(Parent::Env::pd(), buf); env_deprecated()->parent()->upgrade(Parent::Env::pd(), buf);
} }
); );

View File

@ -190,7 +190,7 @@ void Signal_receiver::_unsynchronized_dissolve(Signal_context * const context)
_platform_begin_dissolve(context); _platform_begin_dissolve(context);
/* tell core to stop sending signals referring to the context */ /* tell core to stop sending signals referring to the context */
env()->pd_session()->free_context(context->_cap); env_deprecated()->pd_session()->free_context(context->_cap);
/* restore default initialization of signal context */ /* restore default initialization of signal context */
context->_receiver = 0; context->_receiver = 0;

View File

@ -27,5 +27,5 @@ void Signal_transmitter::submit(unsigned cnt)
{ {
Trace::Signal_submit trace_event(cnt); Trace::Signal_submit trace_event(cnt);
} }
env()->pd_session()->submit(_context, cnt); env_deprecated()->pd_session()->submit(_context, cnt);
} }

View File

@ -223,7 +223,7 @@ Thread::Thread(size_t weight, const char *name, size_t stack_size,
if (_cpu_session) { if (_cpu_session) {
Dataspace_capability ds = _cpu_session->trace_control(); Dataspace_capability ds = _cpu_session->trace_control();
if (ds.valid()) if (ds.valid())
_trace_control = env()->rm_session()->attach(ds); _trace_control = env_deprecated()->rm_session()->attach(ds);
} }
} }
@ -262,5 +262,5 @@ Thread::~Thread()
* detached trace control dataspace. * detached trace control dataspace.
*/ */
if (_trace_control) if (_trace_control)
env()->rm_session()->detach(_trace_control); env_deprecated()->rm_session()->detach(_trace_control);
} }

View File

@ -59,7 +59,7 @@ void Thread::_thread_start()
void Thread::_deinit_platform_thread() void Thread::_deinit_platform_thread()
{ {
if (!_cpu_session) if (!_cpu_session)
_cpu_session = env()->cpu_session(); _cpu_session = env_deprecated()->cpu_session();
_cpu_session->kill_thread(_thread_cap); _cpu_session->kill_thread(_thread_cap);
} }
@ -69,11 +69,11 @@ void Thread::start()
{ {
/* if no CPU session is given, use it from the environment */ /* if no CPU session is given, use it from the environment */
if (!_cpu_session) if (!_cpu_session)
_cpu_session = env()->cpu_session(); _cpu_session = env_deprecated()->cpu_session();
/* create thread at core */ /* create thread at core */
addr_t const utcb = (addr_t)&_stack->utcb(); addr_t const utcb = (addr_t)&_stack->utcb();
_thread_cap = _cpu_session->create_thread(env()->pd_session_cap(), name(), _thread_cap = _cpu_session->create_thread(env_deprecated()->pd_session_cap(), name(),
_affinity, Weight(), utcb); _affinity, Weight(), utcb);
if (!_thread_cap.valid()) if (!_thread_cap.valid())
throw Cpu_session::Thread_creation_failed(); throw Cpu_session::Thread_creation_failed();

View File

@ -47,13 +47,13 @@ bool Trace::Logger::_evaluate_control()
/* unload policy */ /* unload policy */
if (policy_module) { if (policy_module) {
env()->rm_session()->detach(policy_module); env_deprecated()->rm_session()->detach(policy_module);
policy_module = 0; policy_module = 0;
} }
/* unmap trace buffer */ /* unmap trace buffer */
if (buffer) { if (buffer) {
env()->rm_session()->detach(buffer); env_deprecated()->rm_session()->detach(buffer);
buffer = 0; buffer = 0;
} }
@ -88,7 +88,7 @@ bool Trace::Logger::_evaluate_control()
max_event_size = 0; max_event_size = 0;
policy_module = 0; policy_module = 0;
policy_module = env()->rm_session()->attach(policy_ds); policy_module = env_deprecated()->rm_session()->attach(policy_ds);
/* relocate function pointers of policy callback table */ /* relocate function pointers of policy callback table */
for (unsigned i = 0; i < sizeof(Trace::Policy_module)/sizeof(void *); i++) { for (unsigned i = 0; i < sizeof(Trace::Policy_module)/sizeof(void *); i++) {
@ -111,7 +111,7 @@ bool Trace::Logger::_evaluate_control()
} }
try { try {
buffer = env()->rm_session()->attach(buffer_ds); buffer = env_deprecated()->rm_session()->attach(buffer_ds);
buffer->init(Dataspace_client(buffer_ds).size()); buffer->init(Dataspace_client(buffer_ds).size());
} catch (...) { } } catch (...) { }
@ -200,17 +200,17 @@ Trace::Logger *Thread::_logger()
logger->init_pending(true); logger->init_pending(true);
Thread_capability thread_cap = myself ? myself->_thread_cap Thread_capability thread_cap = myself ? myself->_thread_cap
: env()->parent()->main_thread_cap(); : env_deprecated()->parent()->main_thread_cap();
Genode::Cpu_session *cpu = myself ? myself->_cpu_session Genode::Cpu_session *cpu = myself ? myself->_cpu_session
: env()->cpu_session(); : env_deprecated()->cpu_session();
if (!cpu) cpu = env()->cpu_session(); if (!cpu) cpu = env_deprecated()->cpu_session();
if (!myself) if (!myself)
if (!main_trace_control) { if (!main_trace_control) {
Dataspace_capability ds = env()->cpu_session()->trace_control(); Dataspace_capability ds = env_deprecated()->cpu_session()->trace_control();
if (ds.valid()) if (ds.valid())
main_trace_control = env()->rm_session()->attach(ds); main_trace_control = env_deprecated()->rm_session()->attach(ds);
} }
logger->init(thread_cap, cpu, logger->init(thread_cap, cpu,

View File

@ -113,7 +113,7 @@ extern "C" void *abort(void)
/* Notify the parent of failure */ /* Notify the parent of failure */
if (name != "main") if (name != "main")
env()->parent()->exit(1); env_deprecated()->parent()->exit(1);
sleep_forever(); sleep_forever();
return 0; return 0;

View File

@ -186,7 +186,7 @@ void genode_exit(int status)
for (func = &_dtors_start; func != &_dtors_end; (*func++)()); for (func = &_dtors_start; func != &_dtors_end; (*func++)());
/* inform parent about the exit status */ /* inform parent about the exit status */
Genode::env()->parent()->exit(status); Genode::env_deprecated()->parent()->exit(status);
/* wait for destruction by the parent */ /* wait for destruction by the parent */
Genode::sleep_forever(); Genode::sleep_forever();

View File

@ -97,7 +97,7 @@ extern "C" void init_main_thread()
* Explicitly setup program environment at this point to ensure that its * Explicitly setup program environment at this point to ensure that its
* destructor won't be registered for the atexit routine. * destructor won't be registered for the atexit routine.
*/ */
(void*)env(); (void*)env_deprecated();
init_log(); init_log();
/* create a thread object for the main thread */ /* create a thread object for the main thread */

View File

@ -53,9 +53,25 @@ class Chunky_texture : Genode::Attached_ram_dataspace, public Genode::Texture<PT
public: public:
Chunky_texture(Genode::Ram_session &ram, Genode::Surface_base::Area size) Chunky_texture(Genode::Ram_session &ram, Genode::Region_map &rm,
Genode::Surface_base::Area size)
: :
Genode::Attached_ram_dataspace(&ram, _num_bytes(size)), Genode::Attached_ram_dataspace(ram, rm, _num_bytes(size)),
Genode::Texture<PT>(_pixel(), _alpha(size), size)
{ }
/**
* Constructor
*
* \deprecated
* \noapi
*
* This variant is solely meant to be used by deprecated functions.
* It will be removed if those functions are gone.
*/
Chunky_texture(Genode::Ram_session &ram, Genode::Surface_base::Area size) __attribute__((deprecated))
:
Genode::Attached_ram_dataspace(ram, *Genode::env_deprecated()->rm_session(), _num_bytes(size)),
Genode::Texture<PT>(_pixel(), _alpha(size), size) Genode::Texture<PT>(_pixel(), _alpha(size), size)
{ } { }
}; };

View File

@ -62,10 +62,10 @@ struct Audio_out::Connection : Genode::Connection<Session>, Audio_out::Session_c
*/ */
Connection(const char *channel, Connection(const char *channel,
bool alloc_signal = true, bool alloc_signal = true,
bool progress_signal = false) bool progress_signal = false) __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), channel)), Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), channel)),
Session_client(*Genode::env()->rm_session(), cap(), alloc_signal, progress_signal) Session_client(*Genode::env_deprecated()->rm_session(), cap(), alloc_signal, progress_signal)
{ } { }
}; };

View File

@ -54,13 +54,25 @@ class Block::Driver_session : public Driver_session_base,
/** /**
* Constructor * Constructor
* *
* \param rm region map of local address space, used to attach
* the packet-stream buffer to the local address space
* \param tx_ds dataspace used as communication buffer * \param tx_ds dataspace used as communication buffer
* for the tx packet stream * for the tx packet stream
* \param ep entry point used for packet-stream channel * \param ep entry point used for packet-stream channel
*/ */
Driver_session(Genode::Dataspace_capability tx_ds, Driver_session(Genode::Region_map &rm,
Genode::Dataspace_capability tx_ds,
Genode::Rpc_entrypoint &ep) Genode::Rpc_entrypoint &ep)
: Session_rpc_object(tx_ds, ep) { } : Session_rpc_object(rm, tx_ds, ep) { }
/**
* Constructor
*
* \deprecated
*/
Driver_session(Genode::Dataspace_capability tx_ds,
Genode::Rpc_entrypoint &ep) __attribute__((deprecated))
: Session_rpc_object(*Genode::env_deprecated()->rm_session(), tx_ds, ep) { }
}; };

View File

@ -59,10 +59,10 @@ struct Block::Connection : Genode::Connection<Session>, Session_client
*/ */
Connection(Genode::Range_allocator *tx_block_alloc, Connection(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 = "") const char *label = "") __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, tx_buf_size)), Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label, tx_buf_size)),
Session_client(cap(), *tx_block_alloc, *Genode::env()->rm_session()) Session_client(cap(), *tx_block_alloc, *Genode::env_deprecated()->rm_session())
{ } { }
}; };

View File

@ -36,9 +36,20 @@ class Block::Session_rpc_object : public Genode::Rpc_object<Session, Session_rpc
* for the tx packet stream * for the tx packet stream
* \param ep entry point used for packet-stream channel * \param ep entry point used for packet-stream channel
*/ */
Session_rpc_object(Genode::Dataspace_capability tx_ds, Session_rpc_object(Genode::Region_map &local_rm,
Genode::Dataspace_capability tx_ds,
Genode::Rpc_entrypoint &ep) Genode::Rpc_entrypoint &ep)
: _tx(tx_ds, *Genode::env()->rm_session(), ep) { } : _tx(tx_ds, local_rm, ep) { }
/**
* Constructor
*
* \deprecated
* \noapi
*/
Session_rpc_object(Genode::Dataspace_capability tx_ds,
Genode::Rpc_entrypoint &ep) __attribute__((deprecated))
: _tx(tx_ds, *Genode::env_deprecated()->rm_session(), ep) { }
/** /**
* Return capability to packet-stream channel * Return capability to packet-stream channel

View File

@ -90,11 +90,11 @@ struct File_system::Connection_base : Genode::Connection<Session>, Session_clien
size_t tx_buf_size = DEFAULT_TX_BUF_SIZE, size_t tx_buf_size = DEFAULT_TX_BUF_SIZE,
char const *label = "", char const *label = "",
char const *root = "/", char const *root = "/",
bool writeable = true) bool writeable = true) __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label,
root, writeable, tx_buf_size)), root, writeable, tx_buf_size)),
Session_client(cap(), tx_block_alloc, *Genode::env()->rm_session()) Session_client(cap(), tx_block_alloc, *Genode::env_deprecated()->rm_session())
{ } { }
}; };

View File

@ -85,9 +85,9 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
*/ */
Connection(unsigned width = 0, Connection(unsigned width = 0,
unsigned height = 0, unsigned height = 0,
Mode::Format format = Mode::INVALID) Mode::Format format = Mode::INVALID) __attribute__((deprecated))
: :
Genode::Connection<Session>(_connect(*Genode::env()->parent(), Genode::Connection<Session>(_connect(*Genode::env_deprecated()->parent(),
width, height, format)), width, height, format)),
Session_client(cap()) Session_client(cap())
{ } { }

View File

@ -40,7 +40,7 @@ struct Gpio::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(unsigned long gpio_pin) Connection(unsigned long gpio_pin) __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=8K, gpio=%zd", gpio_pin)), Genode::Connection<Session>(session("ram_quota=8K, gpio=%zd", gpio_pin)),
Session_client(cap()) Session_client(cap())

View File

@ -51,9 +51,9 @@ class Input::Session_component : public Genode::Rpc_object<Input::Session>
* \noapi * \noapi
* \deprecated * \deprecated
*/ */
Session_component() Session_component() __attribute__((deprecated))
: _ds(*Genode::env()->ram_session(), : _ds(*Genode::env_deprecated()->ram_session(),
*Genode::env()->rm_session(), *Genode::env_deprecated()->rm_session(),
Event_queue::QUEUE_SIZE*sizeof(Input::Event)) Event_queue::QUEUE_SIZE*sizeof(Input::Event))
{ } { }

View File

@ -33,17 +33,22 @@ class Input::Session_client : public Genode::Rpc_client<Session>
public: public:
explicit Session_client(Genode::Env &env, Session_client(Genode::Region_map &local_rm, Session_capability session)
Session_capability session)
: :
Genode::Rpc_client<Session>(session), Genode::Rpc_client<Session>(session),
_event_ds(env.rm(), call<Rpc_dataspace>()) _event_ds(local_rm, call<Rpc_dataspace>())
{ } { }
explicit Session_client(Session_capability session) /**
* Constructor
*
* \deprecated
* \noapi
*/
explicit Session_client(Session_capability session) __attribute__((deprecated))
: :
Genode::Rpc_client<Session>(session), Genode::Rpc_client<Session>(session),
_event_ds(*Genode::env()->rm_session(), call<Rpc_dataspace>()) _event_ds(*Genode::env_deprecated()->rm_session(), call<Rpc_dataspace>())
{ } { }
Genode::Dataspace_capability dataspace() override { Genode::Dataspace_capability dataspace() override {

View File

@ -35,7 +35,7 @@ struct Input::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env, char const *label = "") Connection(Genode::Env &env, char const *label = "")
: :
Genode::Connection<Input::Session>(env, _session(env.parent(), label)), Genode::Connection<Input::Session>(env, _session(env.parent(), label)),
Session_client(env, cap()) Session_client(env.rm(), cap())
{ } { }
/** /**
@ -45,11 +45,11 @@ struct Input::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: :
Genode::Connection<Input::Session>( Genode::Connection<Input::Session>(
session(*Genode::env()->parent(), "ram_quota=16K")), session(*Genode::env_deprecated()->parent(), "ram_quota=16K")),
Session_client(cap()) Session_client(*Genode::env_deprecated()->rm_session(), cap())
{ } { }
}; };

View File

@ -40,7 +40,7 @@ struct Loader::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(size_t ram_quota) Connection(size_t ram_quota) __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=%ld", ram_quota)), Genode::Connection<Session>(session("ram_quota=%ld", ram_quota)),
Session_client(cap()) Session_client(cap())

View File

@ -68,11 +68,11 @@ struct Nic::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Range_allocator *tx_block_alloc, Connection(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 = "") char const *label = "") __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label,
tx_buf_size, rx_buf_size)), tx_buf_size, rx_buf_size)),
Session_client(cap(), *tx_block_alloc, *Genode::env()->rm_session()) Session_client(cap(), *tx_block_alloc, *Genode::env_deprecated()->rm_session())
{ } { }
}; };

View File

@ -41,13 +41,28 @@ class Nic::Session_rpc_object : public Genode::Rpc_object<Session, Session_rpc_o
* buffer of the rx packet stream * buffer of the rx packet stream
* \param ep entry point used for packet-stream channels * \param ep entry point used for packet-stream channels
*/ */
Session_rpc_object(Genode::Dataspace_capability tx_ds, Session_rpc_object(Genode::Region_map &rm,
Genode::Dataspace_capability tx_ds,
Genode::Dataspace_capability rx_ds, Genode::Dataspace_capability rx_ds,
Genode::Range_allocator *rx_buffer_alloc, Genode::Range_allocator *rx_buffer_alloc,
Genode::Rpc_entrypoint &ep) Genode::Rpc_entrypoint &ep)
: :
_tx(tx_ds, *Genode::env()->rm_session(), ep), _tx(tx_ds, rm, ep),
_rx(rx_ds, *Genode::env()->rm_session(), *rx_buffer_alloc, ep) { } _rx(rx_ds, rm, *rx_buffer_alloc, ep) { }
/**
* Constructor
*
* \deprecated
* \noapi
*/
Session_rpc_object(Genode::Dataspace_capability tx_ds,
Genode::Dataspace_capability rx_ds,
Genode::Range_allocator *rx_buffer_alloc,
Genode::Rpc_entrypoint &ep) __attribute__((deprecated))
:
_tx(tx_ds, *Genode::env_deprecated()->rm_session(), ep),
_rx(rx_ds, *Genode::env_deprecated()->rm_session(), *rx_buffer_alloc, ep) { }
Genode::Capability<Tx> _tx_cap() { return _tx.cap(); } Genode::Capability<Tx> _tx_cap() { return _tx.cap(); }
Genode::Capability<Rx> _rx_cap() { return _rx.cap(); } Genode::Capability<Rx> _rx_cap() { return _rx.cap(); }

View File

@ -31,10 +31,26 @@ class Nitpicker::Session_client : public Genode::Rpc_client<Session>
public: public:
explicit Session_client(Session_capability session) /**
* Constructor
*/
Session_client(Genode::Region_map &rm, Session_capability session)
: :
Rpc_client<Session>(session), Rpc_client<Session>(session),
_command_ds(command_dataspace()), _command_ds(rm, command_dataspace()),
_command_buffer(*_command_ds.local_addr<Command_buffer>())
{ }
/**
* Constructor
*
* \deprecated
* \noapi
*/
explicit Session_client(Session_capability session) __attribute__((deprecated))
:
Rpc_client<Session>(session),
_command_ds(*Genode::env_deprecated()->rm_session(), command_dataspace()),
_command_buffer(*_command_ds.local_addr<Command_buffer>()) _command_buffer(*_command_ds.local_addr<Command_buffer>())
{ } { }

View File

@ -66,11 +66,11 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
: :
/* establish nitpicker session */ /* establish nitpicker session */
Genode::Connection<Session>(env, _connect(env.parent(), label)), Genode::Connection<Session>(env, _connect(env.parent(), label)),
Session_client(cap()), Session_client(env.rm(), cap()),
/* request frame-buffer and input sub sessions */ /* request frame-buffer and input sub sessions */
_framebuffer(framebuffer_session()), _framebuffer(framebuffer_session()),
_input(env, input_session()) _input(env.rm(), input_session())
{ } { }
/** /**
@ -80,15 +80,15 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(char const *label = "") Connection(char const *label = "") __attribute__((deprecated))
: :
/* establish nitpicker session */ /* establish nitpicker session */
Genode::Connection<Session>(_connect(*Genode::env()->parent(), label)), Genode::Connection<Session>(_connect(*Genode::env_deprecated()->parent(), label)),
Session_client(cap()), Session_client(*Genode::env_deprecated()->rm_session(), cap()),
/* request frame-buffer and input sub sessions */ /* request frame-buffer and input sub sessions */
_framebuffer(framebuffer_session()), _framebuffer(framebuffer_session()),
_input(input_session()) _input(*Genode::env_deprecated()->rm_session(), input_session())
{ } { }
void buffer(Framebuffer::Mode mode, bool use_alpha) void buffer(Framebuffer::Mode mode, bool use_alpha)

View File

@ -41,10 +41,10 @@ class Genode::Reporter : Noncopyable
struct Connection struct Connection
{ {
Report::Connection report; Report::Connection report;
Attached_dataspace ds = { report.dataspace() }; Attached_dataspace ds = { *env_deprecated()->rm_session(), report.dataspace() };
Connection(char const *name, size_t buffer_size) Connection(char const *name, size_t buffer_size)
: report(name, buffer_size) { } : report(false, name, buffer_size) { }
}; };
Constructible<Connection> _conn; Constructible<Connection> _conn;
@ -61,13 +61,26 @@ class Genode::Reporter : Noncopyable
public: public:
Reporter(char const *xml_name, char const *label = nullptr, Reporter(Env &env, char const *xml_name, char const *label = nullptr,
size_t buffer_size = 4096) size_t buffer_size = 4096)
: :
_xml_name(xml_name), _label(label ? label : xml_name), _xml_name(xml_name), _label(label ? label : xml_name),
_buffer_size(buffer_size) _buffer_size(buffer_size)
{ } { }
/**
* Constructor
*
* \deprecated
* \noapi
*/
Reporter(char const *xml_name, char const *label = nullptr,
size_t buffer_size = 4096) __attribute__((deprecated))
:
_xml_name(xml_name), _label(label ? label : xml_name),
_buffer_size(buffer_size)
{ }
/** /**
* Enable or disable reporting * Enable or disable reporting
*/ */

View File

@ -37,7 +37,7 @@ struct Platform::Connection : Genode::Connection<Session>, Client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: Genode::Connection<Session>(session("ram_quota=4K")), : Genode::Connection<Session>(session("ram_quota=4K")),
Client(cap()) { } Client(cap()) { }
}; };

View File

@ -54,9 +54,9 @@ struct Regulator::Connection : Genode::Connection<Session>, Session_client
* \param regulator identifier for the specific regulator * \param regulator identifier for the specific regulator
* \param label string identifier of the client * \param label string identifier of the client
*/ */
Connection(Regulator_id regulator, const char * label = "") Connection(Regulator_id regulator, const char * label = "") __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, regulator)), Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label, regulator)),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -52,9 +52,24 @@ struct Report::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(char const *label, size_t buffer_size = 4096) Connection(char const *label, size_t buffer_size = 4096) __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, buffer_size)), Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label, buffer_size)),
Session_client(cap())
{ }
/**
* Constructor
*
* \deprecated
* \noapi
*
* This variant solely exists to be called by deprecated functions. It
* will be removed as soon as those functions are gone.
*/
Connection(bool, char const *label, size_t buffer_size = 4096)
:
Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label, buffer_size)),
Session_client(cap()) Session_client(cap())
{ } { }
}; };

View File

@ -39,7 +39,7 @@ struct Rtc::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: :
Genode::Connection<Rtc::Session>(session("ram_quota=4K")), Genode::Connection<Rtc::Session>(session("ram_quota=4K")),
Session_client(cap()) Session_client(cap())

View File

@ -80,8 +80,8 @@ class Framebuffer::Imx_connection : public Genode::Connection<Imx_session>,
*/ */
Imx_connection(unsigned width = 0, Imx_connection(unsigned width = 0,
unsigned height = 0, unsigned height = 0,
Mode::Format format = Mode::INVALID) Mode::Format format = Mode::INVALID) __attribute__((deprecated))
: Genode::Connection<Imx_session>(_connect(*Genode::env()->parent(), : Genode::Connection<Imx_session>(_connect(*Genode::env_deprecated()->parent(),
width, height, format)), width, height, format)),
Imx_client(cap()) { } Imx_client(cap()) { }
}; };

View File

@ -37,7 +37,7 @@ struct Platform::Connection : Genode::Connection<Session>, Client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=16K")), Genode::Connection<Session>(session("ram_quota=16K")),
Client(cap()) Client(cap())

View File

@ -40,10 +40,16 @@ class Terminal::Session_client : public Genode::Rpc_client<Session>
public: public:
Session_client(Genode::Capability<Session> cap) Session_client(Genode::Region_map &local_rm, Genode::Capability<Session> cap)
: :
Genode::Rpc_client<Session>(cap), Genode::Rpc_client<Session>(cap),
_io_buffer(call<Rpc_dataspace>()) _io_buffer(local_rm, call<Rpc_dataspace>())
{ }
Session_client(Genode::Capability<Session> cap) __attribute__((deprecated))
:
Genode::Rpc_client<Session>(cap),
_io_buffer(*Genode::env_deprecated()->rm_session(), call<Rpc_dataspace>())
{ } { }
Size size() { return call<Rpc_size>(); } Size size() { return call<Rpc_size>(); }

View File

@ -52,7 +52,7 @@ struct Terminal::Connection : Genode::Connection<Session>, Session_client
Genode::Connection<Session>(env, session(env.parent(), Genode::Connection<Session>(env, session(env.parent(),
"ram_quota=%ld, label=\"%s\"", "ram_quota=%ld, label=\"%s\"",
2*4096, label)), 2*4096, label)),
Session_client(cap()) Session_client(env.rm(), cap())
{ {
wait_for_connection(cap()); wait_for_connection(cap());
} }
@ -64,11 +64,11 @@ struct Terminal::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection(char const *label = "") Connection(char const *label = "") __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=%zd, label=\"%s\"", Genode::Connection<Session>(session("ram_quota=%zd, label=\"%s\"",
2*4096, label)), 2*4096, label)),
Session_client(cap()) Session_client(*Genode::env_deprecated()->rm_session(), cap())
{ {
wait_for_connection(cap()); wait_for_connection(cap());
} }

View File

@ -54,7 +54,7 @@ class Timer::Connection : public Genode::Connection<Session>, public Session_cli
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=8K")), Genode::Connection<Session>(session("ram_quota=8K")),
Session_client(cap()) Session_client(cap())

View File

@ -29,9 +29,14 @@ class Uart::Session_client : public Genode::Rpc_client<Session>
public: public:
Session_client(Genode::Capability<Session> cap) Session_client(Genode::Region_map &local_rm, Genode::Capability<Session> cap)
: :
Genode::Rpc_client<Session>(cap), _terminal(cap) Genode::Rpc_client<Session>(cap), _terminal(local_rm, cap)
{ }
Session_client(Genode::Capability<Session> cap) __attribute__((deprecated))
:
Genode::Rpc_client<Session>(cap), _terminal(*Genode::env_deprecated()->rm_session(), cap)
{ } { }

View File

@ -28,7 +28,7 @@ struct Uart::Connection : Genode::Connection<Session>, Session_client
Connection(Genode::Env &env) Connection(Genode::Env &env)
: :
Genode::Connection<Session>(env, session(env.parent(), "ram_quota=%ld", 2*4096)), Genode::Connection<Session>(env, session(env.parent(), "ram_quota=%ld", 2*4096)),
Session_client(cap()) Session_client(env.rm(), cap())
{ {
Terminal::Connection::wait_for_connection(cap()); Terminal::Connection::wait_for_connection(cap());
} }
@ -40,10 +40,10 @@ struct Uart::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: :
Genode::Connection<Session>(session("ram_quota=%ld", 2*4096)), Genode::Connection<Session>(session("ram_quota=%ld", 2*4096)),
Session_client(cap()) Session_client(*Genode::env_deprecated()->rm_session(), cap())
{ {
Terminal::Connection::wait_for_connection(cap()); Terminal::Connection::wait_for_connection(cap());
} }

View File

@ -60,10 +60,10 @@ struct Usb::Connection : Genode::Connection<Session>, Session_client
char const *label = "", char const *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()) __attribute__((deprecated))
: :
Genode::Connection<Session>(_session(*Genode::env()->parent(), label, tx_buf_size)), Genode::Connection<Session>(_session(*Genode::env_deprecated()->parent(), label, tx_buf_size)),
Session_client(cap(), *tx_block_alloc, *Genode::env()->rm_session(), sigh_state_changed) Session_client(cap(), *tx_block_alloc, *Genode::env_deprecated()->rm_session(), sigh_state_changed)
{ } { }
}; };

View File

@ -2,6 +2,8 @@
* \brief Access to process configuration * \brief Access to process configuration
* \author Norman Feske * \author Norman Feske
* \date 2010-05-04 * \date 2010-05-04
*
* \deprecated
*/ */
/* /*
@ -20,7 +22,7 @@ Xml_node _config_xml_node(Dataspace_capability config_ds)
if (!config_ds.valid()) if (!config_ds.valid())
throw Exception(); throw Exception();
return Xml_node(env()->rm_session()->attach(config_ds), return Xml_node(env_deprecated()->rm_session()->attach(config_ds),
Genode::Dataspace_client(config_ds).size()); Genode::Dataspace_client(config_ds).size());
} }
@ -42,7 +44,7 @@ void Config::reload()
try { try {
/* re-acquire dataspace from ROM session */ /* re-acquire dataspace from ROM session */
if (_config_ds.valid()) if (_config_ds.valid())
env()->rm_session()->detach(_config_xml.addr()); env_deprecated()->rm_session()->detach(_config_xml.addr());
_config_ds = _config_rom.dataspace(); _config_ds = _config_rom.dataspace();
@ -74,7 +76,7 @@ void Config::sigh(Signal_context_capability cap)
Config::Config() Config::Config()
: :
_config_rom("config"), _config_rom(false, "config"),
_config_ds(_config_rom.dataspace()), _config_ds(_config_rom.dataspace()),
_config_xml(_config_xml_node(_config_ds)) _config_xml(_config_xml_node(_config_ds))
{ } { }

View File

@ -38,7 +38,7 @@ struct Noux::Connection : Genode::Connection<Session>, Session_client
* \deprecated Use the constructor with 'Env &' as first * \deprecated Use the constructor with 'Env &' as first
* argument instead * argument instead
*/ */
Connection() Connection() __attribute__((deprecated))
: Genode::Connection<Session>(session("")), Session_client(cap()) { } : Genode::Connection<Session>(session("")), Session_client(cap()) { }
/** /**