mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 00:23:16 +00:00
committed by
Norman Feske
parent
5cc036e6ca
commit
ec5dbe66db
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013 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.
|
||||||
@ -31,18 +31,20 @@ struct Genode::Trace::Session_client : Genode::Rpc_client<Genode::Trace::Session
|
|||||||
*/
|
*/
|
||||||
struct Argument_buffer
|
struct Argument_buffer
|
||||||
{
|
{
|
||||||
char *base;
|
Region_map &rm;
|
||||||
size_t size;
|
char *base;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
Argument_buffer(Dataspace_capability ds)
|
Argument_buffer(Region_map &rm, Dataspace_capability ds)
|
||||||
:
|
:
|
||||||
base(env()->rm_session()->attach(ds)),
|
rm(rm),
|
||||||
|
base(rm.attach(ds)),
|
||||||
size(ds.call<Dataspace::Rpc_size>())
|
size(ds.call<Dataspace::Rpc_size>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~Argument_buffer()
|
~Argument_buffer()
|
||||||
{
|
{
|
||||||
env()->rm_session()->detach(base);
|
rm.detach(base);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,10 +55,10 @@ struct Genode::Trace::Session_client : Genode::Rpc_client<Genode::Trace::Session
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
explicit Session_client(Capability<Trace::Session> session)
|
explicit Session_client(Region_map &rm, Capability<Trace::Session> session)
|
||||||
:
|
:
|
||||||
Rpc_client<Trace::Session>(session),
|
Rpc_client<Trace::Session>(session),
|
||||||
_argument_buffer(call<Rpc_dataspace>())
|
_argument_buffer(rm, call<Rpc_dataspace>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013 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.
|
||||||
@ -49,7 +49,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
|||||||
:
|
:
|
||||||
Genode::Connection<Session>(env, _session(env.parent(), ram_quota,
|
Genode::Connection<Session>(env, _session(env.parent(), ram_quota,
|
||||||
arg_buffer_size, parent_levels)),
|
arg_buffer_size, parent_levels)),
|
||||||
Session_client(cap())
|
Session_client(env.rm(), cap())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +63,7 @@ struct Genode::Trace::Connection : Genode::Connection<Genode::Trace::Session>,
|
|||||||
:
|
:
|
||||||
Genode::Connection<Session>(_session(*env()->parent(), ram_quota,
|
Genode::Connection<Session>(_session(*env()->parent(), ram_quota,
|
||||||
arg_buffer_size, parent_levels)),
|
arg_buffer_size, parent_levels)),
|
||||||
Session_client(cap())
|
Session_client(*env()->rm_session(), cap())
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2014 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.
|
||||||
@ -52,9 +52,10 @@ namespace Trace_fs {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Trace_buffer_manager(Genode::Dataspace_capability ds_cap)
|
Trace_buffer_manager(Genode::Region_map &rm,
|
||||||
|
Genode::Dataspace_capability ds_cap)
|
||||||
:
|
:
|
||||||
buffer(Genode::env()->rm_session()->attach(ds_cap)),
|
buffer(rm.attach(ds_cap)),
|
||||||
current_entry(buffer->first())
|
current_entry(buffer->first())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -79,6 +80,8 @@ namespace Trace_fs {
|
|||||||
|
|
||||||
Genode::Allocator &_md_alloc;
|
Genode::Allocator &_md_alloc;
|
||||||
|
|
||||||
|
Genode::Region_map &_rm;
|
||||||
|
|
||||||
int _handle;
|
int _handle;
|
||||||
|
|
||||||
Genode::Trace::Subject_id _id;
|
Genode::Trace::Subject_id _id;
|
||||||
@ -98,10 +101,12 @@ namespace Trace_fs {
|
|||||||
File_system::Policy_file policy_file;
|
File_system::Policy_file policy_file;
|
||||||
|
|
||||||
Followed_subject(Genode::Allocator &md_alloc, char const *name,
|
Followed_subject(Genode::Allocator &md_alloc, char const *name,
|
||||||
Genode::Trace::Subject_id &id, int handle)
|
Genode::Region_map &rm,
|
||||||
|
Genode::Trace::Subject_id &id, int handle)
|
||||||
:
|
:
|
||||||
Directory(name),
|
Directory(name),
|
||||||
_md_alloc(md_alloc),
|
_md_alloc(md_alloc),
|
||||||
|
_rm(rm),
|
||||||
_handle(handle),
|
_handle(handle),
|
||||||
_id(id),
|
_id(id),
|
||||||
_was_traced(false),
|
_was_traced(false),
|
||||||
@ -141,7 +146,7 @@ namespace Trace_fs {
|
|||||||
if (_buffer_manager != 0)
|
if (_buffer_manager != 0)
|
||||||
throw Trace_buffer_manager::Already_managed();
|
throw Trace_buffer_manager::Already_managed();
|
||||||
|
|
||||||
_buffer_manager = new (&_md_alloc) Trace_buffer_manager(ds_cap);
|
_buffer_manager = new (&_md_alloc) Trace_buffer_manager(_rm, ds_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmanage_trace_buffer()
|
void unmanage_trace_buffer()
|
||||||
@ -227,11 +232,12 @@ namespace Trace_fs {
|
|||||||
* \param name name of subject
|
* \param name name of subject
|
||||||
* \param id subject id of tracre subject
|
* \param id subject id of tracre subject
|
||||||
*/
|
*/
|
||||||
Followed_subject *alloc(char const *name, Genode::Trace::Subject_id &id)
|
Followed_subject *alloc(char const *name, Genode::Trace::Subject_id &id,
|
||||||
|
Genode::Region_map &rm)
|
||||||
{
|
{
|
||||||
int handle = _find_free_handle();
|
int handle = _find_free_handle();
|
||||||
|
|
||||||
_subjects[handle] = new (&_md_alloc) Followed_subject(_md_alloc, name, id, handle);
|
_subjects[handle] = new (&_md_alloc) Followed_subject(_md_alloc, name, rm, id, handle);
|
||||||
|
|
||||||
return _subjects[handle];
|
return _subjects[handle];
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/component.h>
|
#include <base/component.h>
|
||||||
#include <file_system/node_handle_registry.h>
|
#include <file_system/node_handle_registry.h>
|
||||||
#include <cap_session/connection.h>
|
|
||||||
#include <file_system_session/rpc_object.h>
|
#include <file_system_session/rpc_object.h>
|
||||||
#include <os/attached_rom_dataspace.h>
|
#include <os/attached_rom_dataspace.h>
|
||||||
#include <os/config.h>
|
#include <os/config.h>
|
||||||
@ -229,6 +228,7 @@ class Trace_file_system
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Genode::Region_map &_rm;
|
||||||
Genode::Allocator &_alloc;
|
Genode::Allocator &_alloc;
|
||||||
Genode::Trace::Connection &_trace;
|
Genode::Trace::Connection &_trace;
|
||||||
Directory &_root_dir;
|
Directory &_root_dir;
|
||||||
@ -385,13 +385,14 @@ class Trace_file_system
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
Trace_file_system(Genode::Allocator &alloc,
|
Trace_file_system(Genode::Region_map &rm,
|
||||||
Trace &trace,
|
Genode::Allocator &alloc,
|
||||||
Directory &root_dir,
|
Trace &trace,
|
||||||
size_t buffer_size,
|
Directory &root_dir,
|
||||||
size_t buffer_size_max)
|
size_t buffer_size,
|
||||||
|
size_t buffer_size_max)
|
||||||
:
|
:
|
||||||
_alloc(alloc), _trace(trace), _root_dir(root_dir),
|
_rm(rm), _alloc(alloc), _trace(trace), _root_dir(root_dir),
|
||||||
_buffer_size(buffer_size), _buffer_size_max(buffer_size_max),
|
_buffer_size(buffer_size), _buffer_size_max(buffer_size_max),
|
||||||
_followed_subject_registry(_alloc)
|
_followed_subject_registry(_alloc)
|
||||||
{ }
|
{ }
|
||||||
@ -441,14 +442,14 @@ class Trace_file_system
|
|||||||
|
|
||||||
Genode::Dataspace_capability ds_cap = _trace.policy(id);
|
Genode::Dataspace_capability ds_cap = _trace.policy(id);
|
||||||
if (ds_cap.valid()) {
|
if (ds_cap.valid()) {
|
||||||
void *ram = Genode::env()->rm_session()->attach(ds_cap);
|
void *ram = _rm.attach(ds_cap);
|
||||||
size_t n = policy_file->read((char *)ram, policy_length, 0UL);
|
size_t n = policy_file->read((char *)ram, policy_length, 0UL);
|
||||||
|
|
||||||
if (n != policy_length) {
|
if (n != policy_length) {
|
||||||
Genode::error("error while copying policy content");
|
Genode::error("error while copying policy content");
|
||||||
} else { subject->policy_id(id); }
|
} else { subject->policy_id(id); }
|
||||||
|
|
||||||
Genode::env()->rm_session()->detach(ram);
|
_rm.detach(ram);
|
||||||
}
|
}
|
||||||
} catch (...) { Genode::error("could not allocate policy"); }
|
} catch (...) { Genode::error("could not allocate policy"); }
|
||||||
}
|
}
|
||||||
@ -574,7 +575,7 @@ class Trace_file_system
|
|||||||
subject_dir_name.replace('/', '_');
|
subject_dir_name.replace('/', '_');
|
||||||
|
|
||||||
followed_subject = _followed_subject_registry.alloc(subject_dir_name.data(),
|
followed_subject = _followed_subject_registry.alloc(subject_dir_name.data(),
|
||||||
subjects[i]);
|
subjects[i], _rm);
|
||||||
|
|
||||||
/* set trace buffer size */
|
/* set trace buffer size */
|
||||||
followed_subject->buffer_size_file.size_limit(_buffer_size_max);
|
followed_subject->buffer_size_file.size_limit(_buffer_size_max);
|
||||||
@ -607,7 +608,7 @@ class File_system::Session_component : public Session_rpc_object
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
Server::Entrypoint &_ep;
|
Server::Entrypoint &_ep;
|
||||||
Genode::Region_map &_rm;
|
Ram_session &_ram;
|
||||||
Allocator &_md_alloc;
|
Allocator &_md_alloc;
|
||||||
Directory &_root_dir;
|
Directory &_root_dir;
|
||||||
Node_handle_registry _handle_registry;
|
Node_handle_registry _handle_registry;
|
||||||
@ -740,7 +741,9 @@ 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::Ram_session &ram,
|
||||||
Genode::Region_map &rm,
|
Genode::Region_map &rm,
|
||||||
|
Genode::Env &env,
|
||||||
File_system::Directory &root_dir,
|
File_system::Directory &root_dir,
|
||||||
Allocator &md_alloc,
|
Allocator &md_alloc,
|
||||||
unsigned subject_limit,
|
unsigned subject_limit,
|
||||||
@ -751,15 +754,16 @@ 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), _rm, ep.rpc_ep()),
|
Session_rpc_object(ram.alloc(tx_buf_size), rm, ep.rpc_ep()),
|
||||||
_ep(ep),
|
_ep(ep),
|
||||||
_rm(rm),
|
_ram(ram),
|
||||||
_md_alloc(md_alloc),
|
_md_alloc(md_alloc),
|
||||||
_root_dir(root_dir),
|
_root_dir(root_dir),
|
||||||
_subject_limit(subject_limit),
|
_subject_limit(subject_limit),
|
||||||
_poll_interval(poll_interval),
|
_poll_interval(poll_interval),
|
||||||
_trace(new (&_md_alloc) Genode::Trace::Connection(trace_quota, trace_meta_quota, trace_parent_levels)),
|
_fs_update_timer(env),
|
||||||
_trace_fs(new (&_md_alloc) Trace_file_system(_md_alloc, *_trace, _root_dir, buffer_size, buffer_size_max)),
|
_trace(new (&_md_alloc) Genode::Trace::Connection(env, trace_quota, trace_meta_quota, trace_parent_levels)),
|
||||||
|
_trace_fs(new (&_md_alloc) Trace_file_system(rm, _md_alloc, *_trace, _root_dir, buffer_size, buffer_size_max)),
|
||||||
_process_packet_dispatcher(_ep, *this, &Session_component::_process_packets),
|
_process_packet_dispatcher(_ep, *this, &Session_component::_process_packets),
|
||||||
_fs_update_dispatcher(_ep, *this, &Session_component::_fs_update)
|
_fs_update_dispatcher(_ep, *this, &Session_component::_fs_update)
|
||||||
{
|
{
|
||||||
@ -788,7 +792,7 @@ class File_system::Session_component : public Session_rpc_object
|
|||||||
destroy(&_md_alloc, _trace);
|
destroy(&_md_alloc, _trace);
|
||||||
|
|
||||||
Dataspace_capability ds = tx_sink()->dataspace();
|
Dataspace_capability ds = tx_sink()->dataspace();
|
||||||
env()->ram_session()->free(static_cap_cast<Ram_dataspace>(ds));
|
_ram.free(static_cap_cast<Ram_dataspace>(ds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -908,10 +912,12 @@ class File_system::Root : public Root_component<Session_component>
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Server::Entrypoint &_ep;
|
Server::Entrypoint &_ep;
|
||||||
Genode::Region_map &_rm;
|
Genode::Ram_session &_ram;
|
||||||
|
Genode::Region_map &_rm;
|
||||||
|
Genode::Env &_env;
|
||||||
|
|
||||||
Directory &_root_dir;
|
Directory &_root_dir;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -1008,10 +1014,11 @@ 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, _rm, _root_dir, *md_alloc(),
|
Session_component(tx_buf_size, _ep, _ram, _rm, _env, _root_dir,
|
||||||
subject_limit, interval, trace_quota,
|
*md_alloc(), subject_limit, interval,
|
||||||
trace_meta_quota, trace_parent_levels,
|
trace_quota, trace_meta_quota,
|
||||||
buffer_size, buffer_size_max);
|
trace_parent_levels, buffer_size,
|
||||||
|
buffer_size_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1024,12 +1031,14 @@ 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, Region_map &rm,
|
Root(Server::Entrypoint &ep, Allocator &md_alloc, Ram_session &ram,
|
||||||
Directory &root_dir)
|
Region_map &rm, Env &env, 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),
|
||||||
|
_ram(ram),
|
||||||
_rm(rm),
|
_rm(rm),
|
||||||
|
_env(env),
|
||||||
_root_dir(root_dir)
|
_root_dir(root_dir)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -1046,7 +1055,7 @@ struct File_system::Main
|
|||||||
*/
|
*/
|
||||||
Sliced_heap sliced_heap = { _env.ram(), _env.rm() };
|
Sliced_heap sliced_heap = { _env.ram(), _env.rm() };
|
||||||
|
|
||||||
Root fs_root = { _env.ep(), sliced_heap, _env.rm(), root_dir };
|
Root fs_root = { _env.ep(), sliced_heap, _env.ram(), _env.rm(), _env, root_dir };
|
||||||
|
|
||||||
Main(Env &env) : _env(env)
|
Main(Env &env) : _env(env)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user