mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
parent
726327d95c
commit
a2dc07056e
@ -6,6 +6,7 @@ _/src/report_rom
|
||||
_/src/init
|
||||
_/src/ram_fs
|
||||
_/src/fs_rom
|
||||
_/src/cached_fs_rom
|
||||
_/src/fs_report
|
||||
_/src/nitpicker
|
||||
_/src/global_keys_handler
|
||||
|
@ -83,7 +83,9 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
&& (_config_pkg_path() == _blueprint_pkg_path);
|
||||
}
|
||||
|
||||
inline void _gen_routes(Xml_generator &, Xml_node, Depot_rom_server const &) const;
|
||||
inline void _gen_routes(Xml_generator &, Xml_node,
|
||||
Depot_rom_server const &,
|
||||
Depot_rom_server const &) const;
|
||||
|
||||
static void _gen_provides_sub_node(Xml_generator &xml, Xml_node service,
|
||||
Xml_node::Type const &node_type,
|
||||
@ -224,14 +226,19 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
/**
|
||||
* Generate start node of init configuration
|
||||
*
|
||||
* \param common session routes to be added in addition to the ones
|
||||
* found in the pkg blueprint
|
||||
* \param depot_rom name of the server that provides the depot content
|
||||
* as ROM modules. If the string is invalid, ROM
|
||||
* requests are routed to the parent.
|
||||
* \param common session routes to be added in addition to
|
||||
* the ones found in the pkg blueprint
|
||||
* \param cached_depot_rom name of the server that provides the depot
|
||||
* content as ROM modules. If the string is
|
||||
* invalid, ROM requests are routed to the
|
||||
* parent.
|
||||
* \param uncached_depot_rom name of the depot-ROM server used to obtain
|
||||
* the content of the depot user "local", which
|
||||
* is assumed to be mutable
|
||||
*/
|
||||
inline void gen_start_node(Xml_generator &, Xml_node common,
|
||||
Depot_rom_server const &depot_rom) const;
|
||||
Depot_rom_server const &cached_depot_rom,
|
||||
Depot_rom_server const &uncached_depot_rom) const;
|
||||
|
||||
/**
|
||||
* Generate installation entry needed for the completion of the child
|
||||
@ -251,7 +258,8 @@ class Depot_deploy::Child : public List_model<Child>::Element
|
||||
|
||||
|
||||
void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common,
|
||||
Depot_rom_server const &depot_rom) const
|
||||
Depot_rom_server const &cached_depot_rom,
|
||||
Depot_rom_server const &uncached_depot_rom) const
|
||||
{
|
||||
if (!_configured() || _condition == UNSATISFIED)
|
||||
return;
|
||||
@ -313,13 +321,15 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml, Xml_node common,
|
||||
});
|
||||
}
|
||||
|
||||
xml.node("route", [&] () { _gen_routes(xml, common, depot_rom); });
|
||||
xml.node("route", [&] () {
|
||||
_gen_routes(xml, common, cached_depot_rom, uncached_depot_rom); });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void Depot_deploy::Child::_gen_routes(Xml_generator &xml, Xml_node common,
|
||||
Depot_rom_server const &depot_rom) const
|
||||
Depot_rom_server const &cached_depot_rom,
|
||||
Depot_rom_server const &uncached_depot_rom) const
|
||||
{
|
||||
if (!_pkg_xml.constructed())
|
||||
return;
|
||||
@ -334,6 +344,18 @@ void Depot_deploy::Child::_gen_routes(Xml_generator &xml, Xml_node common,
|
||||
xml.append(route.content_base(), route.content_size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return name of depot-ROM server used for obtaining the 'path'
|
||||
*
|
||||
* If the depot path refers to the depot-user "local", route the
|
||||
* session request to the non-cached ROM service.
|
||||
*/
|
||||
auto rom_server = [&] (Path const &path) {
|
||||
|
||||
return (String<7>(path) == "local/") ? uncached_depot_rom
|
||||
: cached_depot_rom;
|
||||
};
|
||||
|
||||
/*
|
||||
* Redirect config ROM request to label as given in the 'config' attribute,
|
||||
* if present. We need to search the blueprint's <rom> nodes for the
|
||||
@ -356,9 +378,9 @@ void Depot_deploy::Child::_gen_routes(Xml_generator &xml, Xml_node common,
|
||||
typedef String<160> Path;
|
||||
Path const path = rom.attribute_value("path", Path());
|
||||
|
||||
if (depot_rom.valid())
|
||||
if (cached_depot_rom.valid())
|
||||
xml.node("child", [&] () {
|
||||
xml.attribute("name", depot_rom);
|
||||
xml.attribute("name", rom_server(path));
|
||||
xml.attribute("label", path); });
|
||||
else
|
||||
xml.node("parent", [&] () {
|
||||
@ -389,9 +411,9 @@ void Depot_deploy::Child::_gen_routes(Xml_generator &xml, Xml_node common,
|
||||
xml.attribute("name", "ROM");
|
||||
xml.attribute("label_last", label);
|
||||
|
||||
if (depot_rom.valid()) {
|
||||
if (cached_depot_rom.valid()) {
|
||||
xml.node("child", [&] () {
|
||||
xml.attribute("name", depot_rom);
|
||||
xml.attribute("name", rom_server(path));
|
||||
xml.attribute("label", path);
|
||||
});
|
||||
} else {
|
||||
|
@ -103,10 +103,11 @@ class Depot_deploy::Children
|
||||
}
|
||||
|
||||
void gen_start_nodes(Xml_generator &xml, Xml_node common,
|
||||
Child::Depot_rom_server const &depot_rom) const
|
||||
Child::Depot_rom_server const &cached_depot_rom,
|
||||
Child::Depot_rom_server const &uncached_depot_rom) const
|
||||
{
|
||||
_children.for_each([&] (Child const &child) {
|
||||
child.gen_start_node(xml, common, depot_rom); });
|
||||
child.gen_start_node(xml, common, cached_depot_rom, uncached_depot_rom); });
|
||||
}
|
||||
|
||||
void gen_queries(Xml_generator &xml) const
|
||||
|
@ -64,7 +64,8 @@ struct Depot_deploy::Main
|
||||
Xml_node static_config = config.sub_node("static");
|
||||
xml.append(static_config.content_base(), static_config.content_size());
|
||||
Child::Depot_rom_server const parent { };
|
||||
_children.gen_start_nodes(xml, config.sub_node("common_routes"), parent);
|
||||
_children.gen_start_nodes(xml, config.sub_node("common_routes"),
|
||||
parent, parent);
|
||||
});
|
||||
|
||||
/* update query for blueprints of all unconfigured start nodes */
|
||||
|
@ -132,9 +132,17 @@ void Sculpt::Deploy::handle_deploy()
|
||||
|
||||
void Sculpt::Deploy::gen_runtime_start_nodes(Xml_generator &xml) const
|
||||
{
|
||||
/* depot-ROM instance for regular (immutable) depot content */
|
||||
xml.node("start", [&] () {
|
||||
gen_fs_rom_start_content(xml, "depot_rom", "depot",
|
||||
depot_rom_state.ram_quota); });
|
||||
gen_fs_rom_start_content(xml, "depot_rom", "cached_fs_rom", "depot",
|
||||
cached_depot_rom_state.ram_quota,
|
||||
cached_depot_rom_state.cap_quota); });
|
||||
|
||||
/* depot-ROM instance for mutable content (/depot/local/) */
|
||||
xml.node("start", [&] () {
|
||||
gen_fs_rom_start_content(xml, "dynamic_depot_rom", "fs_rom", "depot",
|
||||
uncached_depot_rom_state.ram_quota,
|
||||
uncached_depot_rom_state.cap_quota); });
|
||||
|
||||
xml.node("start", [&] () {
|
||||
gen_depot_query_start_content(xml); });
|
||||
@ -150,5 +158,5 @@ void Sculpt::Deploy::gen_runtime_start_nodes(Xml_generator &xml) const
|
||||
/* generate start nodes for deployed packages */
|
||||
if (manual_deploy.has_sub_node("common_routes"))
|
||||
_children.gen_start_nodes(xml, manual_deploy.sub_node("common_routes"),
|
||||
"depot_rom");
|
||||
"depot_rom", "dynamic_depot_rom");
|
||||
}
|
||||
|
@ -47,9 +47,10 @@ struct Sculpt::Deploy
|
||||
|
||||
struct Query_version { unsigned value; } _query_version { 0 };
|
||||
|
||||
struct Depot_rom_state { Ram_quota ram_quota; };
|
||||
struct Depot_rom_state { Ram_quota ram_quota; Cap_quota cap_quota; };
|
||||
|
||||
Depot_rom_state depot_rom_state { 32*1024*1024 };
|
||||
Depot_rom_state cached_depot_rom_state { 24*1024*1024, 200 };
|
||||
Depot_rom_state uncached_depot_rom_state { 8*1024*1024, 200 };
|
||||
|
||||
Attached_rom_dataspace _manual_deploy_rom { _env, "config -> deploy" };
|
||||
|
||||
|
@ -739,36 +739,43 @@ void Sculpt::Main::_handle_runtime_state()
|
||||
/* upgrade ram_fs quota on demand */
|
||||
state.for_each_sub_node("child", [&] (Xml_node child) {
|
||||
|
||||
if (child.attribute_value("name", String<16>()) == "ram_fs") {
|
||||
if (child.attribute_value("name", String<16>()) != "ram_fs")
|
||||
return;
|
||||
|
||||
if (child.has_sub_node("ram")
|
||||
&& child.sub_node("ram").has_attribute("requested")) {
|
||||
if (child.has_sub_node("ram") && child.sub_node("ram").has_attribute("requested")) {
|
||||
_storage._ram_fs_state.ram_quota.value *= 2;
|
||||
reconfigure_runtime = true;
|
||||
generate_dialog();
|
||||
}
|
||||
|
||||
_storage._ram_fs_state.ram_quota.value *= 2;
|
||||
reconfigure_runtime = true;
|
||||
generate_dialog();
|
||||
}
|
||||
|
||||
if (child.has_sub_node("caps")
|
||||
&& child.sub_node("caps").has_attribute("requested")) {
|
||||
|
||||
_storage._ram_fs_state.cap_quota.value += 100;
|
||||
reconfigure_runtime = true;
|
||||
generate_dialog();
|
||||
}
|
||||
if (child.has_sub_node("caps") && child.sub_node("caps").has_attribute("requested")) {
|
||||
_storage._ram_fs_state.cap_quota.value += 100;
|
||||
reconfigure_runtime = true;
|
||||
generate_dialog();
|
||||
}
|
||||
});
|
||||
|
||||
/* upgrade depot_rom quota on demand */
|
||||
state.for_each_sub_node("child", [&] (Xml_node child) {
|
||||
|
||||
if (child.attribute_value("name", String<16>()) == "depot_rom"
|
||||
&& child.has_sub_node("ram")
|
||||
&& child.sub_node("ram").has_attribute("requested")) {
|
||||
auto upgrade_depot_rom = [&] (Deploy::Depot_rom_state &state, Start_name const &name)
|
||||
{
|
||||
if (child.attribute_value("name", Start_name()) != name)
|
||||
return;
|
||||
|
||||
_deploy.depot_rom_state.ram_quota.value *= 2;
|
||||
reconfigure_runtime = true;
|
||||
}
|
||||
if (child.has_sub_node("ram") && child.sub_node("ram").has_attribute("requested")) {
|
||||
state.ram_quota.value *= 2;
|
||||
reconfigure_runtime = true;
|
||||
}
|
||||
|
||||
if (child.has_sub_node("caps") && child.sub_node("caps").has_attribute("requested")) {
|
||||
state.cap_quota.value += 100;
|
||||
reconfigure_runtime = true;
|
||||
}
|
||||
};
|
||||
|
||||
upgrade_depot_rom(_deploy.cached_depot_rom_state, "depot_rom");
|
||||
upgrade_depot_rom(_deploy.uncached_depot_rom_state, "dynamic_depot_rom");
|
||||
});
|
||||
|
||||
/*
|
||||
|
@ -47,7 +47,9 @@ namespace Sculpt {
|
||||
void gen_fs_start_content(Xml_generator &, Storage_target const &,
|
||||
File_system::Type);
|
||||
|
||||
void gen_fs_rom_start_content(Xml_generator &, Start_name const &, Start_name const &, Ram_quota);
|
||||
void gen_fs_rom_start_content(Xml_generator &, Start_name const &,
|
||||
Start_name const &, Start_name const &,
|
||||
Ram_quota, Cap_quota);
|
||||
|
||||
void gen_gpt_relabel_start_content(Xml_generator &, Storage_device const &);
|
||||
void gen_gpt_expand_start_content (Xml_generator &, Storage_device const &);
|
||||
|
@ -15,13 +15,14 @@
|
||||
|
||||
void Sculpt::gen_fs_rom_start_content(Xml_generator &xml,
|
||||
Start_name const &name,
|
||||
Start_name const &binary,
|
||||
Start_name const &server,
|
||||
Ram_quota ram_quota)
|
||||
Ram_quota ram_quota,
|
||||
Cap_quota cap_quota)
|
||||
{
|
||||
gen_common_start_content(xml, name,
|
||||
Cap_quota{200}, ram_quota);
|
||||
gen_common_start_content(xml, name, cap_quota, ram_quota);
|
||||
|
||||
gen_named_node(xml, "binary", "fs_rom");
|
||||
gen_named_node(xml, "binary", binary);
|
||||
|
||||
xml.node("config", [&] () { });
|
||||
|
||||
@ -32,10 +33,11 @@ void Sculpt::gen_fs_rom_start_content(Xml_generator &xml,
|
||||
gen_service_node<::File_system::Session>(xml, [&] () {
|
||||
gen_named_node(xml, "child", server); });
|
||||
|
||||
gen_parent_rom_route(xml, "fs_rom");
|
||||
gen_parent_rom_route(xml, binary);
|
||||
gen_parent_rom_route(xml, "ld.lib.so");
|
||||
gen_parent_route<Cpu_session>(xml);
|
||||
gen_parent_route<Pd_session> (xml);
|
||||
gen_parent_route<Log_session>(xml);
|
||||
gen_parent_route<Rm_session> (xml);
|
||||
});
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <nitpicker_session/nitpicker_session.h>
|
||||
#include <usb_session/usb_session.h>
|
||||
#include <log_session/log_session.h>
|
||||
#include <rm_session/rm_session.h>
|
||||
#include <timer_session/timer_session.h>
|
||||
#include <file_system_session/file_system_session.h>
|
||||
#include <report_session/report_session.h>
|
||||
|
Loading…
Reference in New Issue
Block a user