mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 17:17:38 +00:00
rump_fs: Transition to new API
The rump libraries and the rump_fs component are now conform to the new base API. Also the I/O back end should be running stable now. issue #2224
This commit is contained in:
committed by
Norman Feske
parent
a7f40b24ca
commit
6fa6d72c0b
@ -22,6 +22,8 @@ extern "C" {
|
||||
|
||||
#include <base/thread.h>
|
||||
#include <base/log.h>
|
||||
#include <rump/env.h>
|
||||
#include <util/avl_tree.h>
|
||||
|
||||
|
||||
/*************
|
||||
@ -35,12 +37,17 @@ namespace Timer {
|
||||
};
|
||||
|
||||
|
||||
class Hard_context
|
||||
class Hard_context : public Genode::Avl_node<Hard_context>
|
||||
{
|
||||
private:
|
||||
|
||||
int _cookie;
|
||||
lwp *_lwp = 0;
|
||||
lwp *_lwp = nullptr;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Genode::Thread *_myself = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
@ -50,12 +57,65 @@ class Hard_context
|
||||
void set_lwp(lwp *l) { _lwp = l; }
|
||||
lwp *get_lwp() { return _lwp; }
|
||||
|
||||
static Timer::Connection *timer();
|
||||
static Timer::Connection &timer();
|
||||
|
||||
bool higher(Hard_context *h) { return _myself > h->_myself; }
|
||||
|
||||
Hard_context *find(Genode::Thread const *t)
|
||||
{
|
||||
if (_myself == t)
|
||||
return this;
|
||||
|
||||
Hard_context *h = child(_myself > t);
|
||||
if (!h)
|
||||
return nullptr;
|
||||
|
||||
return h->find(t);
|
||||
}
|
||||
|
||||
void thread(Genode::Thread *t) { _myself = t; }
|
||||
};
|
||||
|
||||
|
||||
class Hard_context_registry : public Genode::Avl_tree<Hard_context>
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Lock lock;
|
||||
|
||||
public:
|
||||
|
||||
Hard_context *find(Genode::Thread const *t)
|
||||
{
|
||||
Genode::Lock::Guard g(lock);
|
||||
if (!first())
|
||||
return nullptr;
|
||||
|
||||
return first()->find(t);
|
||||
}
|
||||
|
||||
void insert(Hard_context *h)
|
||||
{
|
||||
Genode::Lock::Guard g(lock);
|
||||
Avl_tree::insert(h);
|
||||
}
|
||||
|
||||
void remove(Hard_context *h)
|
||||
{
|
||||
Genode::Lock::Guard g(lock);
|
||||
Avl_tree::remove(h);
|
||||
}
|
||||
|
||||
static Hard_context_registry &r()
|
||||
{
|
||||
static Hard_context_registry _r;
|
||||
return _r;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Hard_context_thread : public Hard_context,
|
||||
public Genode::Thread_deprecated<sizeof(Genode::addr_t) * 2048>
|
||||
public Genode::Thread
|
||||
{
|
||||
private:
|
||||
|
||||
@ -66,14 +126,17 @@ class Hard_context_thread : public Hard_context,
|
||||
|
||||
void entry()
|
||||
{
|
||||
Hard_context::thread(Genode::Thread::myself());
|
||||
Hard_context_registry::r().insert(this);
|
||||
_func(_arg);
|
||||
Hard_context_registry::r().remove(this);
|
||||
Genode::log(__func__, " returned from func");
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Hard_context_thread(char const *name, func f, void *arg, int cookie, bool run = true)
|
||||
: Hard_context(cookie), Thread_deprecated(name),
|
||||
: Hard_context(cookie), Thread(Rump::env().env(), name, sizeof(long) * 2048),
|
||||
_func(f), _arg(arg) { if (run) start(); }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user