block: use new server framework in block drivers

As a side effect, the entrypoints in the USB driver are merged into one thread.

Fixes #1027
This commit is contained in:
Stefan Kalkowski
2014-01-13 13:44:33 +01:00
committed by Christian Helmuth
parent 2e99c19601
commit 6a076ff621
34 changed files with 415 additions and 461 deletions

View File

@ -89,22 +89,24 @@ class Factory : public Block::Driver_factory
};
int main()
struct Main
{
enum { STACK_SIZE = 4*1024 };
static Cap_connection cap;
static Rpc_entrypoint ep(&cap, STACK_SIZE, "http_block_ep");
Server::Entrypoint &ep;
struct Factory factory;
Block::Root root;
static Signal_receiver receiver;
static Factory driver_factory;
static Block::Root block_root(&ep, env()->heap(), driver_factory, receiver);
Main(Server::Entrypoint &ep)
: ep(ep), root(ep, Genode::env()->heap(), factory) {
Genode::env()->parent()->announce(ep.manage(root)); }
};
env()->parent()->announce(ep.manage(&block_root));
while (true) {
Signal s = receiver.wait_for_signal();
static_cast<Signal_dispatcher_base *>(s.context())->dispatch(s.num());
}
/************
** Server **
************/
return 0;
namespace Server {
char const *name() { return "http_blk_ep"; }
size_t stack_size() { return 2*1024*sizeof(long); }
void construct(Entrypoint &ep) { static Main server(ep); }
}

View File

@ -1,4 +1,4 @@
TARGET = http_blk
SRC_CC = main.cc http.cc
LIBS = libc libc_lwip_nic_dhcp
LIBS = libc libc_lwip_nic_dhcp server