os/include/file_system_session: API transition (fix 'deprecated' warnings)

...and adaptation of the users of 'File_system::Session_rpc_object' to the
modified interface.

Issue #1987
This commit is contained in:
Christian Prochaska 2017-01-16 17:04:28 +01:00 committed by Norman Feske
parent 344f6f9e53
commit 201bfabdac
9 changed files with 55 additions and 45 deletions

View File

@ -6,7 +6,7 @@
*/ */
/* /*
* Copyright (C) 2014-2016 Genode Labs GmbH * Copyright (C) 2014-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -154,7 +154,7 @@ class File_system::Session_component : public Session_rpc_object
bool writeable, bool writeable,
Allocator &md_alloc) Allocator &md_alloc)
: :
Session_rpc_object(env.ram().alloc(tx_buf_size), env.ep().rpc_ep()), Session_rpc_object(env.ram().alloc(tx_buf_size), env.rm(), env.ep().rpc_ep()),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)), _root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)),
_writable(writeable), _writable(writeable),

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2012-2016 Genode Labs GmbH * Copyright (C) 2012-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -168,10 +168,11 @@ namespace File_system {
* Constructor * Constructor
*/ */
Session_component(size_t tx_buf_size, Rpc_entrypoint &ep, Session_component(size_t tx_buf_size, Rpc_entrypoint &ep,
Region_map &rm,
Signal_receiver &sig_rec, Signal_receiver &sig_rec,
Directory &root, bool writable) Directory &root, bool writable)
: :
Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), ep), Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), rm, ep),
_root(root), _root(root),
_writable(writable), _writable(writable),
_process_packet_dispatcher(sig_rec, *this, _process_packet_dispatcher(sig_rec, *this,
@ -821,6 +822,7 @@ namespace File_system {
private: private:
Rpc_entrypoint &_channel_ep; Rpc_entrypoint &_channel_ep;
Region_map &_rm;
Signal_receiver &_sig_rec; Signal_receiver &_sig_rec;
Directory &_root_dir; Directory &_root_dir;
@ -936,7 +938,7 @@ namespace File_system {
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }
return new (md_alloc()) return new (md_alloc())
Session_component(tx_buf_size, _channel_ep, _sig_rec, Session_component(tx_buf_size, _channel_ep, _rm, _sig_rec,
*session_root_dir, writeable); *session_root_dir, writeable);
} }
@ -951,10 +953,12 @@ namespace File_system {
* \param md_alloc meta-data allocator * \param md_alloc meta-data allocator
*/ */
Root(Rpc_entrypoint &session_ep, Allocator &md_alloc, Root(Rpc_entrypoint &session_ep, Allocator &md_alloc,
Region_map &rm,
Signal_receiver &sig_rec, Directory &root_dir) Signal_receiver &sig_rec, Directory &root_dir)
: :
Root_component<Session_component>(&session_ep, &md_alloc), Root_component<Session_component>(&session_ep, &md_alloc),
_channel_ep(session_ep), _sig_rec(sig_rec), _root_dir(root_dir) _channel_ep(session_ep), _rm(rm), _sig_rec(sig_rec),
_root_dir(root_dir)
{ } { }
}; };
}; };
@ -981,7 +985,7 @@ int main(int, char **)
static Directory root_dir("/"); static Directory root_dir("/");
static File_system::Root root(ep, sliced_heap, sig_rec, root_dir); static File_system::Root root(ep, sliced_heap, *env()->rm_session(), sig_rec, root_dir);
env()->parent()->announce(ep.manage(&root)); env()->parent()->announce(ep.manage(&root));

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2013-2016 Genode Labs GmbH * Copyright (C) 2013-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -159,11 +159,12 @@ class File_system::Session_component : public Session_rpc_object
*/ */
Session_component(size_t tx_buf_size, Session_component(size_t tx_buf_size,
Genode::Entrypoint &ep, Genode::Entrypoint &ep,
Genode::Region_map &rm,
char const *root_dir, char const *root_dir,
bool writeable, bool writeable,
Allocator &md_alloc) Allocator &md_alloc)
: :
Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), ep.rpc_ep()), Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), rm, ep.rpc_ep()),
_ep(ep), _ep(ep),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)), _root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)),
@ -409,6 +410,7 @@ class File_system::Root : public Root_component<Session_component>
private: private:
Genode::Entrypoint &_ep; Genode::Entrypoint &_ep;
Genode::Region_map &_rm;
protected: protected:
@ -488,7 +490,7 @@ class File_system::Root : public Root_component<Session_component>
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }
return new (md_alloc()) return new (md_alloc())
Session_component(tx_buf_size, _ep, root_dir, writeable, *md_alloc()); Session_component(tx_buf_size, _ep, _rm, root_dir, writeable, *md_alloc());
} }
public: public:
@ -501,10 +503,10 @@ class File_system::Root : public Root_component<Session_component>
* data-flow signals of packet streams * data-flow signals of packet streams
* \param md_alloc meta-data allocator * \param md_alloc meta-data allocator
*/ */
Root(Genode::Entrypoint &ep, Allocator &md_alloc) Root(Genode::Entrypoint &ep, Allocator &md_alloc, Genode::Region_map &rm)
: :
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc), Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
_ep(ep) _ep(ep), _rm(rm)
{ } { }
}; };
@ -512,15 +514,16 @@ class File_system::Root : public Root_component<Session_component>
struct File_system::Main struct File_system::Main
{ {
Genode::Entrypoint &ep; Genode::Entrypoint &ep;
Genode::Region_map &rm;
/* /*
* Initialize root interface * Initialize root interface
*/ */
Sliced_heap sliced_heap = { env()->ram_session(), env()->rm_session() }; Sliced_heap sliced_heap = { env()->ram_session(), env()->rm_session() };
Root fs_root = { ep, sliced_heap }; Root fs_root = { ep, sliced_heap, rm };
Main(Genode::Entrypoint &ep) : ep(ep) Main(Genode::Entrypoint &ep, Genode::Region_map &rm) : ep(ep), rm(rm)
{ {
if (!Fuse::init_fs()) { if (!Fuse::init_fs()) {
Genode::error("FUSE fs initialization failed"); Genode::error("FUSE fs initialization failed");
@ -545,6 +548,6 @@ struct File_system::Main
void Libc::Component::construct(Libc::Env &env) void Libc::Component::construct(Libc::Env &env)
{ {
static File_system::Main inst(env.ep()); static File_system::Main inst(env.ep(), env.rm());
} }

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2012-2013 Genode Labs GmbH * Copyright (C) 2012-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -36,8 +36,9 @@ class File_system::Session_rpc_object : public Genode::Rpc_object<Session, Sessi
* \param ep entry point used for packet-stream channel * \param ep entry point used for packet-stream channel
*/ */
Session_rpc_object(Genode::Dataspace_capability tx_ds, Session_rpc_object(Genode::Dataspace_capability tx_ds,
Genode::Region_map &rm,
Genode::Rpc_entrypoint &ep) Genode::Rpc_entrypoint &ep)
: _tx(tx_ds, *Genode::env()->rm_session(), ep) { } : _tx(tx_ds, rm, ep) { }
/** /**
* Return capability to packet-stream channel * Return capability to packet-stream channel

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2012-2016 Genode Labs GmbH * Copyright (C) 2012-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -154,7 +154,7 @@ class File_system::Session_component : public Session_rpc_object
bool writable, bool writable,
Allocator &md_alloc) Allocator &md_alloc)
: :
Session_rpc_object(env.ram().alloc(tx_buf_size), env.ep().rpc_ep()), Session_rpc_object(env.ram().alloc(tx_buf_size), env.rm(), env.ep().rpc_ep()),
_env(env), _env(env),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)), _root(*new (&_md_alloc) Directory(_md_alloc, root_dir, false)),

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2012-2016 Genode Labs GmbH * Copyright (C) 2012-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -149,9 +149,10 @@ class File_system::Session_component : public Session_rpc_object
* Constructor * Constructor
*/ */
Session_component(size_t tx_buf_size, Genode::Entrypoint &ep, Session_component(size_t tx_buf_size, Genode::Entrypoint &ep,
Genode::Region_map &rm,
Directory &root, bool writable) Directory &root, bool writable)
: :
Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), ep.rpc_ep()), Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), rm, ep.rpc_ep()),
_ep(ep), _ep(ep),
_root(root), _root(root),
_writable(writable), _writable(writable),
@ -417,6 +418,7 @@ class File_system::Root : public Root_component<Session_component>
private: private:
Genode::Entrypoint &_ep; Genode::Entrypoint &_ep;
Genode::Region_map &_rm;
Genode::Xml_node const _config; Genode::Xml_node const _config;
Directory &_root_dir; Directory &_root_dir;
@ -501,7 +503,7 @@ class File_system::Root : public Root_component<Session_component>
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }
return new (md_alloc()) return new (md_alloc())
Session_component(tx_buf_size, _ep, *session_root_dir, writeable); Session_component(tx_buf_size, _ep, _rm, *session_root_dir, writeable);
} }
public: public:
@ -513,11 +515,11 @@ class File_system::Root : public Root_component<Session_component>
* \param md_alloc meta-data allocator * \param md_alloc meta-data allocator
* \param root_dir root-directory handle (anchor for fs) * \param root_dir root-directory handle (anchor for fs)
*/ */
Root(Genode::Entrypoint &ep, Genode::Xml_node config, Root(Genode::Entrypoint &ep, Genode::Region_map &rm,
Allocator &md_alloc, Directory &root_dir) Genode::Xml_node config, Allocator &md_alloc, Directory &root_dir)
: :
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc), Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
_ep(ep), _config(config), _root_dir(root_dir) _ep(ep), _rm(rm), _config(config), _root_dir(root_dir)
{ } { }
}; };
@ -637,7 +639,7 @@ struct File_system::Main
*/ */
Genode::Sliced_heap _sliced_heap { _env.ram(), _env.rm() }; Genode::Sliced_heap _sliced_heap { _env.ram(), _env.rm() };
Root _fs_root { _env.ep(), _config.xml(), _sliced_heap, _root_dir }; Root _fs_root { _env.ep(), _env.rm(), _config.xml(), _sliced_heap, _root_dir };
Genode::Heap _heap { _env.ram(), _env.rm() }; Genode::Heap _heap { _env.ram(), _env.rm() };

View File

@ -5,13 +5,14 @@
*/ */
/* /*
* Copyright (C) 2014-2016 Genode Labs GmbH * Copyright (C) 2014-2017 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
*/ */
/* Genode includes */ /* Genode includes */
#include <base/component.h>
#include <file_system/node_handle_registry.h> #include <file_system/node_handle_registry.h>
#include <cap_session/connection.h> #include <cap_session/connection.h>
#include <file_system_session/rpc_object.h> #include <file_system_session/rpc_object.h>
@ -606,6 +607,7 @@ class File_system::Session_component : public Session_rpc_object
private: private:
Server::Entrypoint &_ep; Server::Entrypoint &_ep;
Genode::Region_map &_rm;
Allocator &_md_alloc; Allocator &_md_alloc;
Directory &_root_dir; Directory &_root_dir;
Node_handle_registry _handle_registry; Node_handle_registry _handle_registry;
@ -738,6 +740,7 @@ class File_system::Session_component : public Session_rpc_object
*/ */
Session_component(size_t tx_buf_size, Session_component(size_t tx_buf_size,
Server::Entrypoint &ep, Server::Entrypoint &ep,
Genode::Region_map &rm,
File_system::Directory &root_dir, File_system::Directory &root_dir,
Allocator &md_alloc, Allocator &md_alloc,
unsigned subject_limit, unsigned subject_limit,
@ -748,8 +751,9 @@ class File_system::Session_component : public Session_rpc_object
size_t buffer_size, size_t buffer_size,
size_t buffer_size_max) size_t buffer_size_max)
: :
Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), ep.rpc_ep()), Session_rpc_object(env()->ram_session()->alloc(tx_buf_size), _rm, ep.rpc_ep()),
_ep(ep), _ep(ep),
_rm(rm),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_root_dir(root_dir), _root_dir(root_dir),
_subject_limit(subject_limit), _subject_limit(subject_limit),
@ -905,6 +909,7 @@ class File_system::Root : public Root_component<Session_component>
private: private:
Server::Entrypoint &_ep; Server::Entrypoint &_ep;
Genode::Region_map &_rm;
Directory &_root_dir; Directory &_root_dir;
@ -1003,7 +1008,7 @@ class File_system::Root : public Root_component<Session_component>
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }
return new (md_alloc()) return new (md_alloc())
Session_component(tx_buf_size, _ep, _root_dir, *md_alloc(), Session_component(tx_buf_size, _ep, _rm, _root_dir, *md_alloc(),
subject_limit, interval, trace_quota, subject_limit, interval, trace_quota,
trace_meta_quota, trace_parent_levels, trace_meta_quota, trace_parent_levels,
buffer_size, buffer_size_max); buffer_size, buffer_size_max);
@ -1019,10 +1024,12 @@ class File_system::Root : public Root_component<Session_component>
* data-flow signals of packet streams * data-flow signals of packet streams
* \param md_alloc meta-data allocator * \param md_alloc meta-data allocator
*/ */
Root(Server::Entrypoint &ep, Allocator &md_alloc, Directory &root_dir) Root(Server::Entrypoint &ep, Allocator &md_alloc, Region_map &rm,
Directory &root_dir)
: :
Root_component<Session_component>(&ep.rpc_ep(), &md_alloc), Root_component<Session_component>(&ep.rpc_ep(), &md_alloc),
_ep(ep), _ep(ep),
_rm(rm),
_root_dir(root_dir) _root_dir(root_dir)
{ } { }
}; };
@ -1030,28 +1037,21 @@ class File_system::Root : public Root_component<Session_component>
struct File_system::Main struct File_system::Main
{ {
Server::Entrypoint &ep; Env &_env;
Directory root_dir = { "/" }; Directory root_dir = { "/" };
/* /*
* Initialize root interface * Initialize root interface
*/ */
Sliced_heap sliced_heap = { env()->ram_session(), env()->rm_session() }; Sliced_heap sliced_heap = { _env.ram(), _env.rm() };
Root fs_root = { ep, sliced_heap, root_dir }; Root fs_root = { _env.ep(), sliced_heap, _env.rm(), root_dir };
Main(Server::Entrypoint &ep) : ep(ep) Main(Env &env) : _env(env)
{ {
env()->parent()->announce(ep.manage(fs_root)); env.parent().announce(env.ep().manage(fs_root));
} }
}; };
void Component::construct(Genode::Env &env) { static File_system::Main main(env); }
/**********************
** Server framework **
**********************/
char const * Server::name() { return "trace_fs_ep"; }
Genode::size_t Server::stack_size() { return 64*1024*sizeof(long); }
void Server::construct(Server::Entrypoint &ep) { static File_system::Main inst(ep); }

View File

@ -1,4 +1,4 @@
TARGET = trace_fs TARGET = trace_fs
SRC_CC = main.cc SRC_CC = main.cc
LIBS = base config server LIBS = base config
INC_DIR += $(PRG_DIR) INC_DIR += $(PRG_DIR)

View File

@ -251,7 +251,7 @@ class Vfs_server::Session_component :
char const *root_path, char const *root_path,
bool writable) bool writable)
: :
Session_rpc_object(env.ram().alloc(tx_buf_size), env.ep().rpc_ep()), Session_rpc_object(env.ram().alloc(tx_buf_size), env.rm(), env.ep().rpc_ep()),
_label(label), _label(label),
_process_packet_dispatcher(env.ep(), *this, &Session_component::_process_packets), _process_packet_dispatcher(env.ep(), *this, &Session_component::_process_packets),
_vfs(vfs), _vfs(vfs),