genode/repos/base/include/rom_session/connection.h
Norman Feske cfdbccc5c2 Remove blocking calls from root and parent RPCs
This is a redesign of the root and parent interfaces to eliminate
blocking RPC calls.

- New session representation at the parent (base/session_state.h)
- base-internal root proxy mechanism as migration path
- Redesign of base/service.h
- Removes ancient 'Connection::KEEP_OPEN' feature
- Interface change of 'Child', 'Child_policy', 'Slave', 'Slave_policy'
- New 'Slave::Connection'
- Changed child-construction procedure to be compatible with the
  non-blocking parent interface and to be easier to use
- The child's initial LOG session, its binary ROM session, and the
  linker ROM session have become part of the child's envirenment.
- Session upgrading must now be performed via 'env.upgrade' instead
  of performing a sole RPC call the parent. To make RAM upgrades
  easier, the 'Connection' provides a new 'upgrade_ram' method.

Issue #2120
2016-11-25 16:06:42 +01:00

78 lines
1.7 KiB
C++

/*
* \brief Connection to ROM file service
* \author Norman Feske
* \date 2008-08-22
*/
/*
* Copyright (C) 2008-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__ROM_SESSION__CONNECTION_H_
#define _INCLUDE__ROM_SESSION__CONNECTION_H_
#include <rom_session/client.h>
#include <base/connection.h>
#include <base/log.h>
namespace Genode { class Rom_connection; }
class Genode::Rom_connection : public Connection<Rom_session>,
public Rom_session_client
{
public:
class Rom_connection_failed : public Parent::Exception { };
enum { RAM_QUOTA = 4096UL };
private:
Rom_session_capability _session(Parent &parent, char const *label)
{
return session("ram_quota=%ld, label=\"%s\"", RAM_QUOTA, label);
}
public:
/**
* Constructor
*
* \param label request label and name of ROM module
*
* \throw Rom_connection_failed
*/
Rom_connection(Env &env, const char *label)
try :
Connection<Rom_session>(env, _session(env.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
*/
Rom_connection(const char *label)
try :
Connection<Rom_session>(_session(*env()->parent(), label)),
Rom_session_client(cap())
{ }
catch (...) {
error("Could not open ROM session for \"", label, "\"");
throw Rom_connection_failed();
}
};
#endif /* _INCLUDE__ROM_SESSION__CONNECTION_H_ */