Introduce server-role member to 'Child' class

This patch is needed to use children as services in a dynamic
way (closing and reopening sessions).
This commit is contained in:
Christian Prochaska 2012-04-11 18:24:37 +02:00 committed by Christian Helmuth
parent 4ba1669b39
commit c2f23de2e7
7 changed files with 26 additions and 12 deletions

View File

@ -69,7 +69,8 @@ namespace Genode {
*/
virtual bool announce_service(const char *name,
Root_capability root,
Allocator *alloc)
Allocator *alloc,
Server *server)
{ return false; }
/**
@ -296,6 +297,9 @@ namespace Genode {
/* child policy */
Child_policy *_policy;
/* server role */
Server _server;
/**
* Session-argument buffer
*/
@ -376,7 +380,8 @@ namespace Genode {
_entrypoint(entrypoint),
_parent_cap(_entrypoint->manage(this)),
_process(elf_ds, ram, cpu, rm, _parent_cap, policy->name(), 0),
_policy(policy)
_policy(policy),
_server(ram)
{ }
/**
@ -437,7 +442,7 @@ namespace Genode {
{
if (!name.is_valid_string()) return;
_policy->announce_service(name.string(), root, heap());
_policy->announce_service(name.string(), root, heap(), &_server);
}
Session_capability session(Service_name const &name, Session_args const &args)

View File

@ -92,7 +92,8 @@ class Iso9660_boot_probe
bool announce_service(char const *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (Genode::strcmp(service_name, "ROM") != 0)
return false;

View File

@ -61,7 +61,8 @@ class Ipxe_policy : public Genode::Slave_policy, public Nic::Provider
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (Genode::strcmp(service_name, "Nic"))
return false;
@ -105,7 +106,8 @@ struct Ps2_policy : public Genode::Slave_policy
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (Genode::strcmp(service_name, "Input"))
return false;
@ -155,7 +157,8 @@ struct Usb_policy : public Genode::Slave_policy
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (Genode::strcmp(service_name, "Input") == 0) {
_input_source_registry_entry.connect(root);
@ -202,7 +205,8 @@ class Atapi_policy : public Genode::Slave_policy
bool announce_service(char const *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (Genode::strcmp(service_name, "Block"))
return false;

View File

@ -552,7 +552,8 @@ namespace Init {
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (config_verbose)
Genode::printf("child \"%s\" announces service \"%s\"\n",

View File

@ -309,7 +309,8 @@ namespace Init {
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
if (_child_services->find(service_name)) {
PWRN("%s: service %s is already registered",

View File

@ -168,7 +168,8 @@ class Pci_policy : public Genode::Slave_policy, public Pci::Provider
bool announce_service(const char *service_name,
Genode::Root_capability root,
Genode::Allocator *alloc)
Genode::Allocator *alloc,
Genode::Server *server)
{
/* wait for 'pci_drv' to announce the PCI service */
if (Genode::strcmp(service_name, "PCI"))

View File

@ -307,7 +307,8 @@ namespace Gdb_monitor {
bool announce_service(const char *name,
Root_capability root,
Allocator *alloc)
Allocator *alloc,
Server *server)
{
/* create and announce proxy for the child's root interface */
Child_service_root *r = new (alloc)