mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 15:43:56 +00:00
Adapt high-level components to new parent API
This patch adjusts the various users of the 'Child' API to the changes on the account of the new non-blocking parent interface. It also removes the use of the no-longer-available 'Connection::KEEP_OPEN' feature. With the adjustment, we took the opportunity to redesign several components to fit the non-blocking execution model much better, in particular the demo applications. Issue #2120
This commit is contained in:
committed by
Christian Helmuth
parent
8bafb9d41b
commit
b44f0554bd
@ -260,7 +260,8 @@ class Child_base : public Genode::Child_policy
|
||||
** Child_policy interface **
|
||||
****************************/
|
||||
|
||||
Name name() const override { return _label.string(); }
|
||||
Name name() const override { return _label; }
|
||||
Binary_name binary_name() const override { return _binary_name; }
|
||||
|
||||
Genode::Ram_session_capability ref_ram_cap() const override { return _ref_ram_cap; }
|
||||
Genode::Ram_session &ref_ram() override { return _ref_ram; }
|
||||
|
@ -24,6 +24,10 @@ namespace Framebuffer { class Connection; }
|
||||
class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
public Session_client
|
||||
{
|
||||
public:
|
||||
|
||||
enum { RAM_QUOTA = 8*1024UL };
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@ -39,7 +43,7 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
char argbuf[ARGBUF_SIZE];
|
||||
|
||||
/* donate ram quota for storing server-side meta data */
|
||||
Genode::strncpy(argbuf, "ram_quota=8K", sizeof(argbuf));
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "ram_quota", RAM_QUOTA);
|
||||
|
||||
/* set optional session-constructor arguments */
|
||||
if (width)
|
||||
|
@ -23,6 +23,7 @@ namespace Framebuffer {
|
||||
|
||||
struct Mode;
|
||||
struct Session;
|
||||
struct Session_client;
|
||||
}
|
||||
|
||||
|
||||
@ -81,6 +82,8 @@ struct Framebuffer::Session : Genode::Session
|
||||
{
|
||||
static const char *service_name() { return "Framebuffer"; }
|
||||
|
||||
typedef Session_client Client;
|
||||
|
||||
virtual ~Session() { }
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ class Nitpicker::Connection : public Genode::Connection<Session>,
|
||||
{
|
||||
public:
|
||||
|
||||
enum { RAM_QUOTA = 36*1024UL };
|
||||
enum { RAM_QUOTA = 36*1024UL };
|
||||
|
||||
private:
|
||||
|
||||
|
61
repos/os/include/os/single_session_service.h
Normal file
61
repos/os/include/os/single_session_service.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* \brief Utility for implementing a local service with a single session
|
||||
* \author Norman Feske
|
||||
* \date 2014-02-14
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 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__OS__SINGLE_SESSION_SERVICE_H_
|
||||
#define _INCLUDE__OS__SINGLE_SESSION_SERVICE_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/service.h>
|
||||
|
||||
|
||||
namespace Genode { template <typename> class Single_session_service; }
|
||||
|
||||
|
||||
template <typename SESSION>
|
||||
class Genode::Single_session_service
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Capability<SESSION> Session_capability;
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
* Wrap client object to be compabile with 'Rpc_object::cap' calls
|
||||
*
|
||||
* We hand out the capability via 'cap' method to be compatible with
|
||||
* the interface normally provided by server-side component objects.
|
||||
* The 'Single_session_factory' requests the capability via this
|
||||
* method.
|
||||
*/
|
||||
struct Client : SESSION::Client
|
||||
{
|
||||
Client(Session_capability cap) : SESSION::Client(cap) { }
|
||||
Session_capability cap() const { return *this; }
|
||||
};
|
||||
|
||||
typedef Local_service<Client> Service;
|
||||
typedef typename Service::Single_session_factory Factory;
|
||||
|
||||
Client _client;
|
||||
Factory _factory { _client };
|
||||
Service _service { _factory };
|
||||
|
||||
public:
|
||||
|
||||
Single_session_service(Session_capability cap) : _client(cap) { }
|
||||
|
||||
Service &service() { return _service; }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__OS__SINGLE_SESSION_SERVICE_H_ */
|
Reference in New Issue
Block a user