mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-16 07:27:35 +00:00
parent
7aefaff646
commit
97ea0d15ec
@ -27,7 +27,7 @@ void Sandbox::Child::destroy_services()
|
||||
|
||||
|
||||
Sandbox::Child::Apply_config_result
|
||||
Sandbox::Child::apply_config(Xml_node start_node)
|
||||
Sandbox::Child::apply_config(Xml_node const &start_node)
|
||||
{
|
||||
if (abandoned() || stuck() || restart_scheduled() || _exited)
|
||||
return NO_SIDE_EFFECTS;
|
||||
@ -112,10 +112,10 @@ Sandbox::Child::apply_config(Xml_node start_node)
|
||||
Name const name = service.name();
|
||||
|
||||
bool still_provided = false;
|
||||
_provides_sub_node(start_node)
|
||||
.for_each_sub_node("service", [&] (Xml_node node) {
|
||||
_with_provides_sub_node(start_node, [&] (Xml_node const &provides) {
|
||||
provides.for_each_sub_node("service", [&] (Xml_node const &node) {
|
||||
if (name == node.attribute_value("name", Name()))
|
||||
still_provided = true; });
|
||||
still_provided = true; }); });
|
||||
|
||||
if (!still_provided) {
|
||||
service.abandon();
|
||||
@ -123,13 +123,14 @@ Sandbox::Child::apply_config(Xml_node start_node)
|
||||
}
|
||||
});
|
||||
|
||||
_provides_sub_node(start_node).for_each_sub_node("service",
|
||||
[&] (Xml_node node) {
|
||||
if (_service_exists(node))
|
||||
return;
|
||||
_with_provides_sub_node(start_node, [&] (Xml_node const &provides) {
|
||||
provides.for_each_sub_node("service", [&] (Xml_node const &node) {
|
||||
if (_service_exists(node))
|
||||
return;
|
||||
|
||||
_add_service(node);
|
||||
provided_services_changed = true;
|
||||
_add_service(node);
|
||||
provided_services_changed = true;
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
@ -762,7 +763,7 @@ Sandbox::Child::Child(Env &env,
|
||||
Verbose const &verbose,
|
||||
Id id,
|
||||
Report_update_trigger &report_update_trigger,
|
||||
Xml_node start_node,
|
||||
Xml_node const &start_node,
|
||||
Default_route_accessor &default_route_accessor,
|
||||
Default_quota_accessor &default_quota_accessor,
|
||||
Name_registry &name_registry,
|
||||
@ -811,9 +812,9 @@ Sandbox::Child::Child(Env &env,
|
||||
/*
|
||||
* Determine services provided by the child
|
||||
*/
|
||||
_provides_sub_node(start_node)
|
||||
.for_each_sub_node("service",
|
||||
[&] (Xml_node node) { _add_service(node); });
|
||||
_with_provides_sub_node(start_node, [&] (Xml_node const &provides) {
|
||||
provides.for_each_sub_node("service", [&] (Xml_node const &node) {
|
||||
_add_service(node); }); });
|
||||
|
||||
/*
|
||||
* Construct inline config ROM service if "config" node is present.
|
||||
|
@ -187,7 +187,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
*
|
||||
* \throw Missing_name_attribute
|
||||
*/
|
||||
static Name _name_from_xml(Xml_node start_node)
|
||||
static Name _name_from_xml(Xml_node const &start_node)
|
||||
{
|
||||
Name const name = start_node.attribute_value("name", Name());
|
||||
if (name.valid())
|
||||
@ -200,7 +200,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
using Name = String<64>;
|
||||
Name const _unique_name { _name_from_xml(_start_node->xml) };
|
||||
|
||||
static Binary_name _binary_from_xml(Xml_node start_node,
|
||||
static Binary_name _binary_from_xml(Xml_node const &start_node,
|
||||
Name const &unique_name)
|
||||
{
|
||||
if (!start_node.has_sub_node("binary"))
|
||||
@ -270,7 +270,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
};
|
||||
|
||||
static
|
||||
Resources _resources_from_start_node(Xml_node start_node, Prio_levels prio_levels,
|
||||
Resources _resources_from_start_node(Xml_node const &start_node, Prio_levels prio_levels,
|
||||
Affinity::Space const &affinity_space,
|
||||
Cap_quota default_cap_quota,
|
||||
Ram_quota default_ram_quota)
|
||||
@ -283,7 +283,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
|
||||
unsigned cpu_percent = 0;
|
||||
|
||||
start_node.for_each_sub_node("resource", [&] (Xml_node rsc) {
|
||||
start_node.for_each_sub_node("resource", [&] (Xml_node const &rsc) {
|
||||
|
||||
using Name = String<8>;
|
||||
Name const name = rsc.attribute_value("name", Name());
|
||||
@ -466,10 +466,10 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
catch (Service_denied) { return Route_state::UNAVAILABLE; }
|
||||
}
|
||||
|
||||
static Xml_node _provides_sub_node(Xml_node start_node)
|
||||
static void _with_provides_sub_node(Xml_node const &start_node, auto const &fn)
|
||||
{
|
||||
return start_node.has_sub_node("provides")
|
||||
? start_node.sub_node("provides") : Xml_node("<provides/>");
|
||||
start_node.with_sub_node("provides", [&] (Xml_node const &node) { fn(node); },
|
||||
[&] { fn(Xml_node("<provides/>")); });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -483,7 +483,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
/**
|
||||
* Return true if service of specified <provides> sub node is known
|
||||
*/
|
||||
bool _service_exists(Xml_node node) const
|
||||
bool _service_exists(Xml_node const &node) const
|
||||
{
|
||||
bool exists = false;
|
||||
_child_services.for_each([&] (Routed_service const &service) {
|
||||
@ -494,7 +494,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
return exists && !abandoned() && !restart_scheduled();
|
||||
}
|
||||
|
||||
void _add_service(Xml_node service)
|
||||
void _add_service(Xml_node const &service)
|
||||
{
|
||||
Service::Name const name =
|
||||
service.attribute_value("name", Service::Name());
|
||||
@ -581,7 +581,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
Verbose const &verbose,
|
||||
Id id,
|
||||
Report_update_trigger &report_update_trigger,
|
||||
Xml_node start_node,
|
||||
Xml_node const &start_node,
|
||||
Default_route_accessor &default_route_accessor,
|
||||
Default_quota_accessor &default_quota_accessor,
|
||||
Name_registry &name_registry,
|
||||
@ -665,7 +665,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
* \throw Allocator::Out_of_memory unable to allocate buffer for new
|
||||
* config
|
||||
*/
|
||||
Apply_config_result apply_config(Xml_node start_node);
|
||||
Apply_config_result apply_config(Xml_node const &start_node);
|
||||
|
||||
bool uncertain_dependencies() const { return _uncertain_dependencies; }
|
||||
|
||||
|
@ -217,7 +217,7 @@ struct Config_model::Resource_node : Node
|
||||
/*
|
||||
* \throw Unknown_resource_name
|
||||
*/
|
||||
Resource_node(Preservation &keep, Xml_node xml)
|
||||
Resource_node(Preservation &keep, Xml_node const &xml)
|
||||
:
|
||||
_category(_category_from_xml(xml)), _keep(keep)
|
||||
{ }
|
||||
|
@ -70,7 +70,7 @@ class Sandbox::Heartbeat : Noncopyable
|
||||
_rate_ms = 0;
|
||||
}
|
||||
|
||||
void apply_config(Xml_node heartbeat)
|
||||
void apply_config(Xml_node const &heartbeat)
|
||||
{
|
||||
if (!_timer.constructed()) {
|
||||
_timer.construct(_env);
|
||||
|
@ -45,7 +45,7 @@ class Sandbox::Report_detail : Genode::Noncopyable
|
||||
|
||||
Report_detail() { }
|
||||
|
||||
Report_detail(Genode::Xml_node report)
|
||||
Report_detail(Genode::Xml_node const &report)
|
||||
{
|
||||
_children = true;
|
||||
_ids = report.attribute_value("ids", false);
|
||||
|
@ -91,7 +91,7 @@ class Sandbox::Route_model : Noncopyable
|
||||
|
||||
Allocator &_alloc;
|
||||
|
||||
Xml_node const _node; /* points to 'Route_model::_route_node' */
|
||||
Buffered_xml const _node;
|
||||
|
||||
struct Selector
|
||||
{
|
||||
@ -135,16 +135,16 @@ class Sandbox::Route_model : Noncopyable
|
||||
|
||||
Selector const _selector;
|
||||
Checksum const _service_checksum;
|
||||
bool const _specific_service { _node.has_type("service") };
|
||||
bool const _specific_service { _node.xml.has_type("service") };
|
||||
|
||||
struct Target : Noncopyable, private List<Target>::Element
|
||||
{
|
||||
friend class List<Target>;
|
||||
friend class Rule;
|
||||
|
||||
Xml_node const node; /* points to 'Route_model::_route_node' */
|
||||
Buffered_xml const node;
|
||||
|
||||
Target(Xml_node const &node) : node(node) { }
|
||||
Target(Allocator &alloc, Xml_node const &node) : node(alloc, node) { }
|
||||
};
|
||||
|
||||
List<Target> _targets { };
|
||||
@ -154,12 +154,12 @@ class Sandbox::Route_model : Noncopyable
|
||||
*/
|
||||
Rule(Allocator &alloc, Xml_node const &node)
|
||||
:
|
||||
_alloc(alloc), _node(node), _selector(node),
|
||||
_alloc(alloc), _node(alloc, node), _selector(node),
|
||||
_service_checksum(node.attribute_value("name", Service::Name()))
|
||||
{
|
||||
Target const *at_ptr = nullptr;
|
||||
node.for_each_sub_node([&] (Xml_node sub_node) {
|
||||
Target &target = *new (_alloc) Target(sub_node);
|
||||
Target &target = *new (_alloc) Target(alloc, sub_node);
|
||||
_targets.insert(&target, at_ptr);
|
||||
at_ptr = ⌖
|
||||
});
|
||||
@ -200,7 +200,7 @@ class Sandbox::Route_model : Noncopyable
|
||||
if (_mismatches(query))
|
||||
return false;
|
||||
|
||||
return service_node_matches(_node,
|
||||
return service_node_matches(_node.xml,
|
||||
query.label,
|
||||
query.child,
|
||||
query.service);
|
||||
@ -210,7 +210,7 @@ class Sandbox::Route_model : Noncopyable
|
||||
Child_policy::Route resolve(FN const &fn) const
|
||||
{
|
||||
for (Target const *t = _targets.first(); t; t = t->next()) {
|
||||
try { return fn(t->node); }
|
||||
try { return fn(t->node.xml); }
|
||||
catch (Service_denied) { /* try next target */ }
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ struct Sandbox::Server::Service : Service_model
|
||||
*/
|
||||
Service(Registry<Service> &services,
|
||||
Allocator &alloc,
|
||||
Xml_node service_node,
|
||||
Xml_node const &service_node,
|
||||
Registry<Routed_service> &child_services)
|
||||
:
|
||||
_name(service_node.attribute_value("name", Name())),
|
||||
@ -204,7 +204,7 @@ void Sandbox::Server::session_closed(Session_state &session)
|
||||
}
|
||||
|
||||
|
||||
void Sandbox::Server::_handle_create_session_request(Xml_node request,
|
||||
void Sandbox::Server::_handle_create_session_request(Xml_node const &request,
|
||||
Parent::Client::Id id)
|
||||
{
|
||||
/*
|
||||
@ -311,7 +311,7 @@ void Sandbox::Server::_handle_create_session_request(Xml_node request,
|
||||
}
|
||||
|
||||
|
||||
void Sandbox::Server::_handle_upgrade_session_request(Xml_node request,
|
||||
void Sandbox::Server::_handle_upgrade_session_request(Xml_node const &request,
|
||||
Parent::Client::Id id)
|
||||
{
|
||||
_client_id_space.apply<Session_state>(id, [&] (Session_state &session) {
|
||||
@ -347,14 +347,14 @@ void Sandbox::Server::_handle_upgrade_session_request(Xml_node request,
|
||||
}
|
||||
|
||||
|
||||
void Sandbox::Server::_handle_close_session_request(Xml_node, Parent::Client::Id id)
|
||||
void Sandbox::Server::_handle_close_session_request(Xml_node const &, Parent::Client::Id id)
|
||||
{
|
||||
_client_id_space.apply<Session_state>(id, [&] (Session_state &session) {
|
||||
close_session(session); });
|
||||
}
|
||||
|
||||
|
||||
void Sandbox::Server::_handle_session_request(Xml_node request)
|
||||
void Sandbox::Server::_handle_session_request(Xml_node const &request)
|
||||
{
|
||||
if (!request.has_attribute("id"))
|
||||
return;
|
||||
@ -382,7 +382,7 @@ void Sandbox::Server::_handle_session_requests()
|
||||
|
||||
Xml_node const requests = _session_requests->xml();
|
||||
|
||||
requests.for_each_sub_node([&] (Xml_node request) {
|
||||
requests.for_each_sub_node([&] (Xml_node const &request) {
|
||||
_handle_session_request(request); });
|
||||
|
||||
_report_update_trigger.trigger_report_update();
|
||||
|
@ -81,11 +81,11 @@ class Sandbox::Server : Session_state::Ready_callback,
|
||||
Route _resolve_session_request(Genode::Service::Name const &,
|
||||
Session_label const &);
|
||||
|
||||
void _handle_create_session_request (Xml_node, Parent::Client::Id);
|
||||
void _handle_upgrade_session_request(Xml_node, Parent::Client::Id);
|
||||
void _handle_close_session_request (Xml_node, Parent::Client::Id);
|
||||
void _handle_create_session_request (Xml_node const &, Parent::Client::Id);
|
||||
void _handle_upgrade_session_request(Xml_node const &, Parent::Client::Id);
|
||||
void _handle_close_session_request (Xml_node const &, Parent::Client::Id);
|
||||
|
||||
void _handle_session_request(Xml_node);
|
||||
void _handle_session_request(Xml_node const &);
|
||||
void _handle_session_requests();
|
||||
|
||||
void _close_session(Session_state &, Parent::Session_response response);
|
||||
|
@ -56,7 +56,7 @@ namespace Sandbox {
|
||||
* \param child_name name of the originator of the session request
|
||||
* \param service_name name of the requested service
|
||||
*/
|
||||
inline bool service_node_matches(Xml_node const service_node,
|
||||
inline bool service_node_matches(Xml_node const &service_node,
|
||||
Session_label const &label,
|
||||
Child_policy::Name const &child_name,
|
||||
Service::Name const &service_name)
|
||||
@ -178,7 +178,7 @@ namespace Sandbox {
|
||||
}
|
||||
|
||||
|
||||
inline long priority_from_xml(Xml_node start_node, Prio_levels prio_levels)
|
||||
inline long priority_from_xml(Xml_node const &start_node, Prio_levels prio_levels)
|
||||
{
|
||||
long const default_priority = Cpu_session::DEFAULT_PRIORITY;
|
||||
|
||||
@ -207,7 +207,7 @@ namespace Sandbox {
|
||||
|
||||
|
||||
inline Affinity::Location
|
||||
affinity_location_from_xml(Affinity::Space const &space, Xml_node start_node)
|
||||
affinity_location_from_xml(Affinity::Space const &space, Xml_node const &start_node)
|
||||
{
|
||||
using Location = Affinity::Location;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user