mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-15 23:17:14 +00:00
os: don't copy Xml_node
As this patch changes 'Vfs::File_system_factory::create', the VFS plugins must be adapted, now taking 'Xml_node const &' as argument. Issue #5411
This commit is contained in:
parent
f3e4e04de7
commit
636eb7b53f
@ -884,7 +884,7 @@ class Rump_factory : public Vfs::File_system_factory
|
||||
public:
|
||||
|
||||
Rump_factory(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Vfs::Env::User &vfs_user, Genode::Xml_node config)
|
||||
Vfs::Env::User &vfs_user, Genode::Xml_node const &config)
|
||||
:
|
||||
_rump_fs_user(vfs_user)
|
||||
{
|
||||
@ -922,7 +922,7 @@ class Rump_factory : public Vfs::File_system_factory
|
||||
}
|
||||
}
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return new (env.alloc()) Vfs::Rump_file_system(env, config);
|
||||
}
|
||||
@ -933,7 +933,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Extern_factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &node) override
|
||||
{
|
||||
static Rump_factory factory(env.env(), env.alloc(), env.user(), node);
|
||||
return factory.create(env, node);
|
||||
|
@ -103,7 +103,7 @@ class Vfs_audit::File_system : public Vfs::File_system
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
File_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
_audit_log(env.env(), config.attribute_value("label", Genode::String<64>("audit")).string()),
|
||||
_root_dir(env.root_dir()),
|
||||
@ -320,7 +320,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return new (env.alloc())
|
||||
Vfs_audit::File_system(env, config);
|
||||
|
@ -92,7 +92,7 @@ struct Vfs_gpu::File_system : Single_file_system
|
||||
Id_space<Gpu_vfs_handle> _handle_space { };
|
||||
Id_space<Gpu_vfs_handle>::Id _last_id { .value = ~0ul };
|
||||
|
||||
File_system(Vfs::Env &env, Xml_node config)
|
||||
File_system(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE,
|
||||
type_name(),
|
||||
@ -179,7 +179,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node node) override
|
||||
Genode::Xml_node const &node) override
|
||||
{
|
||||
_env = &vfs_env;
|
||||
try {
|
||||
|
@ -231,7 +231,7 @@ class Vfs_import::File_system : public Vfs::File_system
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
File_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
: _heap(env.env().pd(), env.env().rm())
|
||||
{
|
||||
bool overwrite = config.attribute_value("overwrite", false);
|
||||
@ -308,7 +308,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return new (env.alloc())
|
||||
Vfs_import::File_system(env, config);
|
||||
|
@ -742,7 +742,7 @@ struct Vfs::Oss_file_system::Audio
|
||||
Audio(Vfs::Env &env,
|
||||
Info &info,
|
||||
Readonly_value_file_system<Info, 512> &info_fs,
|
||||
Xml_node config)
|
||||
Xml_node const &config)
|
||||
:
|
||||
_vfs_env { env },
|
||||
_info { info },
|
||||
@ -1423,14 +1423,14 @@ struct Vfs::Oss_file_system::Local_factory : File_system_factory
|
||||
log("Sample rate changed to ", _info.sample_rate);
|
||||
}
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("oss"));
|
||||
}
|
||||
|
||||
Data_file_system _data_fs;
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_label { config.attribute_value("label", Label("")) },
|
||||
_name { name(config) },
|
||||
@ -1439,7 +1439,7 @@ struct Vfs::Oss_file_system::Local_factory : File_system_factory
|
||||
_data_fs { _env.env().ep(), env.user(), _audio, name(config) }
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) return &_data_fs;
|
||||
if (node.has_type("info")) return &_info_fs;
|
||||
@ -1580,7 +1580,7 @@ class Vfs::Oss_file_system::Compound_file_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory { vfs_env, node },
|
||||
Vfs::Dir_file_system { vfs_env,
|
||||
@ -1598,7 +1598,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return new (env.alloc())
|
||||
Vfs::Oss_file_system::Compound_file_system(env, config);
|
||||
|
@ -841,7 +841,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &node) override
|
||||
{
|
||||
if (node.has_sub_node("fifo")) {
|
||||
return new (env.alloc()) Vfs_pipe::Fifo_file_system(env, node);
|
||||
|
@ -270,7 +270,7 @@ struct Vfs_trace::Subject_factory : File_system_factory
|
||||
Trace::Subject_id id)
|
||||
: _env(env), _trace_fs(env, trace, policy, id) { }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Value_file_system<unsigned>::type_name())) {
|
||||
if (_enabled_fs.matches(node)) return &_enabled_fs;
|
||||
@ -303,7 +303,7 @@ class Vfs_trace::Subject : private Subject_factory,
|
||||
*this, &Subject::_buffer_size };
|
||||
|
||||
|
||||
static Config _config(Xml_node node)
|
||||
static Config _config(Xml_node const &node)
|
||||
{
|
||||
char buf[Config::capacity()] { };
|
||||
|
||||
@ -344,7 +344,7 @@ class Vfs_trace::Subject : private Subject_factory,
|
||||
public:
|
||||
|
||||
Subject(Vfs::Env &env, Trace::Connection &trace,
|
||||
Trace::Policy_id policy, Xml_node node)
|
||||
Trace::Policy_id policy, Xml_node const &node)
|
||||
: Subject_factory(env, trace, policy, { node.attribute_value("id", 0u) }),
|
||||
Dir_file_system(env, Xml_node(_config(node).string()), *this)
|
||||
{ }
|
||||
@ -394,7 +394,7 @@ struct Vfs_trace::Local_factory : File_system_factory
|
||||
);
|
||||
}
|
||||
|
||||
size_t _config_session_ram(Xml_node config)
|
||||
size_t _config_session_ram(Xml_node const &config)
|
||||
{
|
||||
if (!config.has_attribute("ram")) {
|
||||
Genode::error("mandatory 'ram' attribute missing");
|
||||
@ -403,7 +403,7 @@ struct Vfs_trace::Local_factory : File_system_factory
|
||||
return config.attribute_value("ram", Number_of_bytes(0));
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
: _env(env), _trace(env.env(), _config_session_ram(config), 512*1024)
|
||||
{
|
||||
_trace.for_each_subject_info([&] (Trace::Subject_id const id,
|
||||
@ -418,7 +418,7 @@ struct Vfs_trace::Local_factory : File_system_factory
|
||||
_install_null_policy();
|
||||
}
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
Vfs::File_system *result = nullptr;
|
||||
|
||||
@ -452,7 +452,7 @@ class Vfs_trace::File_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
: Local_factory(vfs_env, node),
|
||||
Vfs::Dir_file_system(vfs_env, Xml_node(_config(vfs_env, _directory)), *this)
|
||||
{ }
|
||||
@ -470,7 +470,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node node) override
|
||||
Genode::Xml_node const &node) override
|
||||
{
|
||||
try { return new (vfs_env.alloc())
|
||||
Vfs_trace::File_system(vfs_env, node); }
|
||||
|
@ -1504,7 +1504,7 @@ class Vfs_tresor::Current_local_factory : private Noncopyable, public File_syste
|
||||
** File_system_factory **
|
||||
*************************/
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Data_file_system::type_name()))
|
||||
return &_data_fs;
|
||||
@ -1567,7 +1567,7 @@ class Vfs_tresor::Control_local_factory : private Noncopyable, public File_syste
|
||||
|
||||
public:
|
||||
|
||||
Control_local_factory(Vfs::Env &, Xml_node, Plugin &plugin)
|
||||
Control_local_factory(Vfs::Env &, Xml_node const &, Plugin &plugin)
|
||||
:
|
||||
_plugin(plugin), _rekey_fs(plugin), _deinitialize_fs(plugin), _extend_fs(plugin)
|
||||
{ }
|
||||
@ -1583,7 +1583,7 @@ class Vfs_tresor::Control_local_factory : private Noncopyable, public File_syste
|
||||
** File_system_factory **
|
||||
*************************/
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Rekey_file_system::type_name()))
|
||||
return &_rekey_fs;
|
||||
@ -1619,7 +1619,7 @@ class Vfs_tresor::Control_file_system : private Control_local_factory, public Di
|
||||
|
||||
public:
|
||||
|
||||
Control_file_system(Vfs::Env &vfs_env, Xml_node node, Plugin &plugin)
|
||||
Control_file_system(Vfs::Env &vfs_env, Xml_node const &node, Plugin &plugin)
|
||||
:
|
||||
Control_local_factory(vfs_env, node, plugin),
|
||||
Dir_file_system(vfs_env, Xml_node(_config().string()), *this)
|
||||
@ -1645,7 +1645,7 @@ class Vfs_tresor::Local_factory : private Noncopyable, public File_system_factor
|
||||
|
||||
public:
|
||||
|
||||
Local_factory(Vfs::Env &vfs_env, Xml_node config, Plugin &plugin)
|
||||
Local_factory(Vfs::Env &vfs_env, Xml_node const &config, Plugin &plugin)
|
||||
:
|
||||
_plugin(plugin), _current_fs(vfs_env, plugin), _control_fs(vfs_env, config, plugin)
|
||||
{ }
|
||||
@ -1654,7 +1654,7 @@ class Vfs_tresor::Local_factory : private Noncopyable, public File_system_factor
|
||||
** File_system_factory **
|
||||
*************************/
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Current_file_system::type_name()))
|
||||
return &_current_fs;
|
||||
@ -1675,7 +1675,7 @@ class Vfs_tresor::File_system : private Local_factory, public Dir_file_system
|
||||
|
||||
Plugin &_plugin;
|
||||
|
||||
static Config _config(Xml_node node)
|
||||
static Config _config(Xml_node const &node)
|
||||
{
|
||||
char buf[Config::capacity()] { };
|
||||
Xml_generator xml(buf, sizeof(buf), "dir", [&] ()
|
||||
@ -1689,7 +1689,7 @@ class Vfs_tresor::File_system : private Local_factory, public Dir_file_system
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Xml_node node, Plugin &plugin)
|
||||
File_system(Vfs::Env &vfs_env, Xml_node const &node, Plugin &plugin)
|
||||
:
|
||||
Local_factory(vfs_env, node, plugin),
|
||||
Dir_file_system(vfs_env, Xml_node(_config(node).string()), *this),
|
||||
@ -1917,7 +1917,7 @@ extern "C" File_system_factory *vfs_file_system_factory(void)
|
||||
** File_system_factory **
|
||||
*************************/
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Xml_node const &node) override
|
||||
{
|
||||
try {
|
||||
if (!_plugin_ptr) {
|
||||
|
@ -310,7 +310,7 @@ struct Vfs_tresor_crypto::Key_local_factory : File_system_factory
|
||||
_encrypt_fs(crypto, key_id), _decrypt_fs(crypto, key_id)
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Encrypt_file_system::type_name()))
|
||||
return &_encrypt_fs;
|
||||
@ -1072,7 +1072,7 @@ struct Vfs_tresor_crypto::Local_factory : File_system_factory
|
||||
_keys_fs(env, crypto), _add_key_fs(crypto), _remove_key_fs(crypto)
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Add_key_file_system::type_name())) {
|
||||
return &_add_key_fs;
|
||||
@ -1098,7 +1098,7 @@ class Vfs_tresor_crypto::File_system : private Local_factory,
|
||||
|
||||
using Config = String<128>;
|
||||
|
||||
static Config _config(Xml_node node)
|
||||
static Config _config(Xml_node const &node)
|
||||
{
|
||||
(void)node;
|
||||
char buf[Config::capacity()] { };
|
||||
@ -1117,7 +1117,7 @@ class Vfs_tresor_crypto::File_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory(vfs_env, Tresor_crypto::get_interface()),
|
||||
Vfs::Dir_file_system(vfs_env, Xml_node(_config(node).string()), *this)
|
||||
@ -1136,7 +1136,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node node) override
|
||||
Genode::Xml_node const &node) override
|
||||
{
|
||||
try {
|
||||
return new (vfs_env.alloc())
|
||||
|
@ -1921,14 +1921,14 @@ struct Vfs_tresor_trust_anchor::Local_factory : File_system_factory
|
||||
return node.attribute_value("storage_dir", Storage_path());
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &vfs_env, Xml_node config)
|
||||
Local_factory(Vfs::Env &vfs_env, Xml_node const &config)
|
||||
:
|
||||
_trust_anchor(vfs_env, _storage_path(config).string()),
|
||||
_decrypt_fs(_trust_anchor), _encrypt_fs(_trust_anchor),
|
||||
_gen_key_fs(_trust_anchor), _hash_fs(_trust_anchor), _init_fs(_trust_anchor)
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Decrypt_file_system::type_name())) {
|
||||
return &_decrypt_fs;
|
||||
@ -1981,7 +1981,7 @@ class Vfs_tresor_trust_anchor::File_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory(vfs_env, node), Vfs::Dir_file_system(vfs_env, Xml_node(_config(node).string()), *this)
|
||||
{ }
|
||||
@ -1999,7 +1999,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node node) override
|
||||
Genode::Xml_node const &node) override
|
||||
{
|
||||
try {
|
||||
return new (vfs_env.alloc())
|
||||
|
@ -117,7 +117,7 @@ struct Vfs_ttf::Local_factory : File_system_factory, Watch_response_handler
|
||||
_max_height_fs.value(_font->font.font().bounding_box().h);
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_env(env),
|
||||
_font_config(config),
|
||||
@ -127,7 +127,7 @@ struct Vfs_ttf::Local_factory : File_system_factory, Watch_response_handler
|
||||
_update_attributes();
|
||||
}
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type(Glyphs_file_system::type_name()))
|
||||
return &_glyphs_fs;
|
||||
@ -165,7 +165,7 @@ class Vfs_ttf::File_system : private Local_factory,
|
||||
private:
|
||||
|
||||
using Config = String<200>;
|
||||
static Config _config(Xml_node node)
|
||||
static Config _config(Xml_node const &node)
|
||||
{
|
||||
char buf[Config::capacity()] { };
|
||||
|
||||
@ -183,7 +183,7 @@ class Vfs_ttf::File_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory(vfs_env, node),
|
||||
Vfs::Dir_file_system(vfs_env,
|
||||
@ -209,7 +209,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env,
|
||||
Genode::Xml_node node) override
|
||||
Genode::Xml_node const &node) override
|
||||
{
|
||||
try { return new (vfs_env.alloc())
|
||||
Vfs_ttf::File_system(vfs_env, node); }
|
||||
|
@ -306,7 +306,7 @@ class Fatfs::File_system : public Vfs::File_system
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
File_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
: _vfs_env(env)
|
||||
{
|
||||
{
|
||||
@ -806,7 +806,7 @@ class Fatfs::File_system : public Vfs::File_system
|
||||
|
||||
struct Fatfs_factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Genode::Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Genode::Xml_node const &node) override
|
||||
{
|
||||
Fatfs::block_init(vfs_env.env(), vfs_env.alloc());
|
||||
return new (vfs_env.alloc()) Fatfs::File_system(vfs_env, node);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
struct Jitterentropy_factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &node) override
|
||||
{
|
||||
return new (env.alloc()) Jitterentropy_file_system(env.alloc(), node);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class Jitterentropy_file_system : public Vfs::Single_file_system
|
||||
public:
|
||||
|
||||
Jitterentropy_file_system(Genode::Allocator &alloc,
|
||||
Genode::Xml_node config)
|
||||
Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Vfs::Node_type::CONTINUOUS_FILE, name(),
|
||||
Vfs::Node_rwx::ro(), config),
|
||||
|
@ -273,7 +273,7 @@ class Lwip::Nic_netif
|
||||
|
||||
Nic_netif(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Genode::Xml_node const &config,
|
||||
Wakeup_scheduler &wakeup_scheduler)
|
||||
:
|
||||
_ep(env.ep()),
|
||||
|
@ -1769,7 +1769,7 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory,
|
||||
using Handle_element = Genode::Fifo_element<Vfs_handle>;
|
||||
using Handle_queue = Genode::Fifo<Vfs_netif::Handle_element>;
|
||||
|
||||
Vfs_netif(Vfs::Env &vfs_env, Genode::Xml_node config,
|
||||
Vfs_netif(Vfs::Env &vfs_env, Genode::Xml_node const &config,
|
||||
Lwip::Nic_netif::Wakeup_scheduler &wakeup_scheduler)
|
||||
:
|
||||
Lwip::Nic_netif(vfs_env.env(), vfs_env.alloc(), config,
|
||||
@ -1829,7 +1829,7 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node config)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &config)
|
||||
:
|
||||
_ep(vfs_env.env().ep()),
|
||||
_wakeup_scheduler(vfs_env, *this),
|
||||
@ -2139,7 +2139,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
Genode::Constructible<Timer::Connection> timer { };
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &vfs_env, Genode::Xml_node const &config) override
|
||||
{
|
||||
if (!timer.constructed()) {
|
||||
timer.construct(vfs_env.env(), "vfs_lwip");
|
||||
|
@ -989,14 +989,14 @@ struct Vfs::Oss_file_system::Local_factory : File_system_factory
|
||||
_info_fs.value(_info);
|
||||
}
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("lagacy_oss"));
|
||||
}
|
||||
|
||||
Data_file_system _data_fs;
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_label { config.attribute_value("label", Label("")) },
|
||||
_name { name(config) },
|
||||
@ -1004,7 +1004,7 @@ struct Vfs::Oss_file_system::Local_factory : File_system_factory
|
||||
_data_fs { _env.env().ep(), env.user(), _audio, name(config) }
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) {
|
||||
return &_data_fs;
|
||||
@ -1202,7 +1202,7 @@ class Vfs::Oss_file_system::Compound_file_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory { vfs_env, node },
|
||||
Vfs::Dir_file_system { vfs_env,
|
||||
@ -1220,7 +1220,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return new (env.alloc())
|
||||
Vfs::Oss_file_system::Compound_file_system(env, config);
|
||||
|
@ -81,7 +81,7 @@ class Libusb_file_system : public Vfs::Single_file_system
|
||||
|
||||
public:
|
||||
|
||||
Libusb_file_system(Vfs::Env &env, Xml_node config)
|
||||
Libusb_file_system(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Vfs::Node_type::CONTINUOUS_FILE, name(),
|
||||
Vfs::Node_rwx::ro(), config),
|
||||
@ -113,7 +113,7 @@ class Libusb_file_system : public Vfs::Single_file_system
|
||||
|
||||
struct Libusb_factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Xml_node const &node) override
|
||||
{
|
||||
return new (env.alloc()) Libusb_file_system(env, node);
|
||||
}
|
||||
|
@ -438,12 +438,12 @@ struct Genode::Directory : Noncopyable, Interface
|
||||
struct Genode::Root_directory : public Vfs::Simple_env,
|
||||
public Directory
|
||||
{
|
||||
Root_directory(Genode::Env &env, Allocator &alloc, Xml_node config)
|
||||
Root_directory(Genode::Env &env, Allocator &alloc, Xml_node const &config)
|
||||
:
|
||||
Vfs::Simple_env(env, alloc, config), Directory((Vfs::Simple_env&)*this)
|
||||
{ }
|
||||
|
||||
void apply_config(Xml_node config) { root_dir().apply_config(config); }
|
||||
void apply_config(Xml_node const &config) { root_dir().apply_config(config); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -136,8 +136,8 @@ class Platform::Connection : public Genode::Connection<Session>,
|
||||
Capability<Device_interface> cap;
|
||||
|
||||
update();
|
||||
with_xml([&] (Xml_node & xml) {
|
||||
xml.for_each_sub_node("device", [&] (Xml_node node) {
|
||||
with_xml([&] (Xml_node const &xml) {
|
||||
xml.for_each_sub_node("device", [&] (Xml_node const &node) {
|
||||
|
||||
/* already found a device? */
|
||||
if (cap.valid())
|
||||
|
@ -365,8 +365,7 @@ class Vfs::Dir_file_system : public File_system
|
||||
|
||||
public:
|
||||
|
||||
Dir_file_system(Vfs::Env &env,
|
||||
Genode::Xml_node node,
|
||||
Dir_file_system(Vfs::Env &env, Genode::Xml_node const &node,
|
||||
File_system_factory &fs_factory)
|
||||
:
|
||||
_env(env),
|
||||
@ -375,27 +374,23 @@ class Vfs::Dir_file_system : public File_system
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
for (unsigned i = 0; i < node.num_sub_nodes(); i++) {
|
||||
|
||||
Xml_node sub_node = node.sub_node(i);
|
||||
node.for_each_sub_node([&] (Xml_node const &sub_node) {
|
||||
|
||||
/* traverse into <dir> nodes */
|
||||
if (sub_node.has_type("dir")) {
|
||||
_append_file_system(new (_env.alloc())
|
||||
Dir_file_system(_env, sub_node, fs_factory));
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
File_system * const fs =
|
||||
fs_factory.create(_env, sub_node);
|
||||
|
||||
File_system * const fs = fs_factory.create(_env, sub_node);
|
||||
if (fs) {
|
||||
_append_file_system(fs);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
Genode::error("failed to create VFS node: ", sub_node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************
|
||||
|
@ -32,7 +32,7 @@ struct Vfs::File_system_factory : Interface
|
||||
* \param env Env of VFS root
|
||||
* \param config file-system configuration
|
||||
*/
|
||||
virtual File_system *create(Vfs::Env &env, Xml_node config) = 0;
|
||||
virtual File_system *create(Vfs::Env &env, Xml_node const &config) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -60,8 +60,7 @@ class Vfs::Global_file_system_factory : public Vfs::File_system_factory
|
||||
template <typename FILE_SYSTEM>
|
||||
void _add_builtin_fs();
|
||||
|
||||
Vfs::File_system *_try_create(Vfs::Env &env,
|
||||
Genode::Xml_node config);
|
||||
Vfs::File_system *_try_create(Vfs::Env &env, Genode::Xml_node const &config);
|
||||
|
||||
/**
|
||||
* Return name of factory provided by the shared library
|
||||
@ -81,14 +80,13 @@ class Vfs::Global_file_system_factory : public Vfs::File_system_factory
|
||||
/**
|
||||
* \throw Factory_not_available
|
||||
*/
|
||||
Vfs::File_system_factory &_load_factory(Vfs::Env &env,
|
||||
Vfs::File_system_factory &_load_factory(Vfs::Env &env,
|
||||
Library_name const &lib_name);
|
||||
|
||||
/**
|
||||
* Try to load external File_system_factory provider
|
||||
*/
|
||||
bool _probe_external_factory(Vfs::Env &env,
|
||||
Genode::Xml_node node);
|
||||
bool _probe_external_factory(Vfs::Env &env, Genode::Xml_node const &node);
|
||||
|
||||
public:
|
||||
|
||||
@ -102,7 +100,7 @@ class Vfs::Global_file_system_factory : public Vfs::File_system_factory
|
||||
/**
|
||||
* File_system_factory interface
|
||||
*/
|
||||
File_system *create(Vfs::Env&, Genode::Xml_node) override;
|
||||
File_system *create(Vfs::Env&, Genode::Xml_node const &) override;
|
||||
|
||||
/**
|
||||
* Register an additional factory for new file-system type
|
||||
|
@ -112,7 +112,7 @@ class Vfs::Readonly_value_file_system : public Vfs::Single_file_system
|
||||
handle.watch_response(); });
|
||||
}
|
||||
|
||||
bool matches(Xml_node node) const
|
||||
bool matches(Xml_node const &node) const
|
||||
{
|
||||
return node.has_type(type_name()) &&
|
||||
node.attribute_value("name", Name()) == _file_name;
|
||||
|
@ -40,15 +40,16 @@ class Vfs::Simple_env : public Vfs::Env, private Vfs::Env::Io, private Vfs::Env:
|
||||
|
||||
public:
|
||||
|
||||
Simple_env(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Vfs::Env::User &user)
|
||||
Simple_env(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Xml_node const &config,
|
||||
Vfs::Env::User &user)
|
||||
:
|
||||
_env(env), _alloc(alloc), _user(user), _root_dir(*this, config, _fs_factory)
|
||||
{ }
|
||||
|
||||
Simple_env(Genode::Env &env, Genode::Allocator &alloc, Genode::Xml_node config)
|
||||
Simple_env(Genode::Env &env, Genode::Allocator &alloc,
|
||||
Genode::Xml_node const &config)
|
||||
:
|
||||
Simple_env(env, alloc, config, *this)
|
||||
{ }
|
||||
|
@ -149,7 +149,7 @@ class Vfs::Single_file_system : public File_system
|
||||
Single_file_system(Node_type node_type,
|
||||
char const *type_name,
|
||||
Node_rwx rwx,
|
||||
Xml_node config)
|
||||
Xml_node const &config)
|
||||
:
|
||||
_type(node_type), _rwx(rwx),
|
||||
_filename(config.attribute_value("name", Filename(type_name)))
|
||||
|
@ -156,7 +156,7 @@ class Vfs::Value_file_system : public Vfs::Single_file_system
|
||||
|
||||
Buffer buffer() const { return _buffer; }
|
||||
|
||||
bool matches(Xml_node node) const
|
||||
bool matches(Xml_node const &node) const
|
||||
{
|
||||
return node.has_type(type_name()) &&
|
||||
node.attribute_value("name", Name()) == _file_name;
|
||||
|
@ -107,12 +107,12 @@ class Virtio::Device
|
||||
void with_virtio_range(String<16> type, auto const &fn)
|
||||
{
|
||||
_plat.update();
|
||||
_plat.with_xml([&] (Xml_node xml) {
|
||||
xml.with_optional_sub_node("device", [&] (Xml_node xml) {
|
||||
_plat.with_xml([&] (Xml_node const &xml) {
|
||||
xml.with_optional_sub_node("device", [&] (Xml_node const &xml) {
|
||||
xml.with_optional_sub_node("pci-config",
|
||||
[&] (Xml_node xml) {
|
||||
[&] (Xml_node const &xml) {
|
||||
xml.for_each_sub_node("virtio_range",
|
||||
[&] (Xml_node xml) {
|
||||
[&] (Xml_node const &xml) {
|
||||
if (xml.attribute_value("type", String<16>()) ==
|
||||
type)
|
||||
fn(xml);
|
||||
@ -126,7 +126,7 @@ class Virtio::Device
|
||||
{
|
||||
unsigned idx = MMIO_MAX;
|
||||
addr_t off = ~0UL;
|
||||
with_virtio_range(type, [&] (Xml_node xml) {
|
||||
with_virtio_range(type, [&] (Xml_node const &xml) {
|
||||
idx = xml.attribute_value<unsigned>("index", MMIO_MAX);
|
||||
off = xml.attribute_value("offset", ~0UL);
|
||||
});
|
||||
@ -146,7 +146,7 @@ class Virtio::Device
|
||||
Platform::Connection & plat)
|
||||
: _env(env), _plat(plat)
|
||||
{
|
||||
with_virtio_range("notify", [&] (Xml_node xml) {
|
||||
with_virtio_range("notify", [&] (Xml_node const &xml) {
|
||||
_notify_offset_multiplier = xml.attribute_value("factor", 0UL);
|
||||
});
|
||||
|
||||
|
@ -148,7 +148,7 @@ struct Dummy::Log_connections
|
||||
|
||||
Registry<Connection> _connections { };
|
||||
|
||||
Log_connections(Env &env, Xml_node node) : _env(env)
|
||||
Log_connections(Env &env, Xml_node const &node) : _env(env)
|
||||
{
|
||||
unsigned const count = node.attribute_value("count", 0U);
|
||||
|
||||
|
@ -71,7 +71,7 @@ struct Global_keys_handler::Main
|
||||
|
||||
bool _state = false;
|
||||
|
||||
Bool_state(Registry<Bool_state> ®istry, Xml_node node)
|
||||
Bool_state(Registry<Bool_state> ®istry, Xml_node const &node)
|
||||
:
|
||||
_element(registry, *this),
|
||||
_name(node.attribute_value("name", Name())),
|
||||
@ -80,7 +80,7 @@ struct Global_keys_handler::Main
|
||||
|
||||
bool enabled() const { return _state; }
|
||||
|
||||
void apply_change(Xml_node event)
|
||||
void apply_change(Xml_node const &event)
|
||||
{
|
||||
/* modify state of matching name only */
|
||||
if (event.attribute_value("bool", Bool_state::Name()) != _name)
|
||||
@ -116,7 +116,7 @@ struct Global_keys_handler::Main
|
||||
|
||||
Bool_state::Name const _name;
|
||||
|
||||
Bool_condition(Registry<Bool_condition> ®istry, Xml_node node)
|
||||
Bool_condition(Registry<Bool_condition> ®istry, Xml_node const &node)
|
||||
:
|
||||
_element(registry, *this),
|
||||
_name(node.attribute_value("name", Bool_state::Name()))
|
||||
@ -143,7 +143,7 @@ struct Global_keys_handler::Main
|
||||
|
||||
Domain const _domain;
|
||||
|
||||
Hover_condition(Registry<Hover_condition> ®istry, Xml_node node)
|
||||
Hover_condition(Registry<Hover_condition> ®istry, Xml_node const &node)
|
||||
:
|
||||
_element(registry, *this),
|
||||
_domain(node.attribute_value("domain", Domain()))
|
||||
@ -182,7 +182,7 @@ struct Global_keys_handler::Main
|
||||
Report(Env &env, Allocator &alloc,
|
||||
Registry<Report> &reports,
|
||||
Registry<Bool_state> const &bool_states,
|
||||
Xml_node node)
|
||||
Xml_node const &node)
|
||||
:
|
||||
_alloc(alloc),
|
||||
_name(node.attribute_value("name", Name())),
|
||||
@ -194,10 +194,10 @@ struct Global_keys_handler::Main
|
||||
{
|
||||
_reporter.enabled(true);
|
||||
|
||||
node.for_each_sub_node("bool", [&] (Xml_node bool_node) {
|
||||
node.for_each_sub_node("bool", [&] (Xml_node const &bool_node) {
|
||||
new (alloc) Bool_condition(_bool_conditions, bool_node); });
|
||||
|
||||
node.for_each_sub_node("hovered", [&] (Xml_node hovered) {
|
||||
node.for_each_sub_node("hovered", [&] (Xml_node const &hovered) {
|
||||
new (alloc) Hover_condition(_hover_conditions, hovered); });
|
||||
|
||||
if (_delay_ms) {
|
||||
@ -301,9 +301,7 @@ void Global_keys_handler::Main::_apply_input_events(unsigned num_ev,
|
||||
/* ignore key combinations */
|
||||
if (_key_cnt > 1) continue;
|
||||
|
||||
using Xml_node = Xml_node;
|
||||
|
||||
auto lambda = [&] (Xml_node node) {
|
||||
auto lambda = [&] (Xml_node const &node) {
|
||||
|
||||
if (!node.has_type("press") && !node.has_type("release"))
|
||||
return;
|
||||
@ -344,7 +342,7 @@ void Global_keys_handler::Main::_handle_config()
|
||||
{
|
||||
_config_ds.update();
|
||||
|
||||
Xml_node const config = _config_ds.xml();
|
||||
Xml_node const &config = _config_ds.xml();
|
||||
|
||||
/*
|
||||
* Import bool states
|
||||
@ -352,7 +350,7 @@ void Global_keys_handler::Main::_handle_config()
|
||||
_bool_states.for_each([&] (Bool_state &state)
|
||||
{
|
||||
bool keep_existing_state = false;
|
||||
config.for_each_sub_node("bool", [&] (Xml_node node) {
|
||||
config.for_each_sub_node("bool", [&] (Xml_node const &node) {
|
||||
if (state.has_name(node.attribute_value("name", Bool_state::Name())))
|
||||
keep_existing_state = true; });
|
||||
|
||||
@ -360,7 +358,7 @@ void Global_keys_handler::Main::_handle_config()
|
||||
destroy(_heap, &state);
|
||||
});
|
||||
|
||||
config.for_each_sub_node("bool", [&] (Xml_node node)
|
||||
config.for_each_sub_node("bool", [&] (Xml_node const &node)
|
||||
{
|
||||
Bool_state::Name const name = node.attribute_value("name", Bool_state::Name());
|
||||
|
||||
@ -378,7 +376,7 @@ void Global_keys_handler::Main::_handle_config()
|
||||
*/
|
||||
_reports.for_each([&] (Report &report) { destroy(_heap, &report); });
|
||||
|
||||
config.for_each_sub_node("report", [&] (Xml_node report) {
|
||||
config.for_each_sub_node("report", [&] (Xml_node const &report) {
|
||||
new (_heap) Report(_env, _heap, _reports, _bool_states, report); });
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@ using namespace Net;
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
Microseconds read_sec_attr(Xml_node const &node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <init/child_policy.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/child_policy_dynamic_rom.h>
|
||||
#include <os/buffered_xml.h>
|
||||
#include <base/sleep.h>
|
||||
#include <base/child.h>
|
||||
#include <base/component.h>
|
||||
@ -32,21 +33,17 @@ struct Sequence::Child : Genode::Child_policy
|
||||
|
||||
Heap _services_heap { _env.pd(), _env.rm() };
|
||||
|
||||
Xml_node const _start_node;
|
||||
|
||||
Name const _name = _start_node.attribute_value("name", Name());
|
||||
|
||||
bool const _have_config = _start_node.has_sub_node("config");
|
||||
|
||||
Binary_name _start_binary()
|
||||
static Binary_name _start_binary(Name const &name, Xml_node const &start_node)
|
||||
{
|
||||
Binary_name name = _name;
|
||||
_start_node.with_optional_sub_node("binary", [&] (Xml_node const &binary) {
|
||||
name = binary.attribute_value("name", _name); });
|
||||
return name;
|
||||
Binary_name binary_name = name;
|
||||
start_node.with_optional_sub_node("binary", [&] (Xml_node const &binary) {
|
||||
binary_name = binary.attribute_value("name", name); });
|
||||
return binary_name;
|
||||
}
|
||||
|
||||
Binary_name const _binary_name = _start_binary();
|
||||
Name const _name;
|
||||
bool const _have_config;
|
||||
Binary_name const _binary_name;
|
||||
|
||||
Child_policy_dynamic_rom_file _config_policy {
|
||||
_env.rm(), "config", _env.ep().rpc_ep(), &_env.pd() };
|
||||
@ -82,14 +79,15 @@ struct Sequence::Child : Genode::Child_policy
|
||||
Signal_context_capability exit_handler)
|
||||
:
|
||||
_env(env),
|
||||
_start_node(start_node),
|
||||
_name(start_node.attribute_value("name", Name())),
|
||||
_have_config(start_node.has_sub_node("config")),
|
||||
_binary_name(_start_binary(_name, start_node)),
|
||||
_exit_transmitter(exit_handler)
|
||||
{
|
||||
if (_have_config) {
|
||||
Xml_node config_node = start_node.sub_node("config");
|
||||
config_node.with_raw_node([&] (char const *start, size_t length) {
|
||||
_config_policy.load(start, length); });
|
||||
}
|
||||
start_node.with_optional_sub_node("config",
|
||||
[&] (Xml_node const &config_node) {
|
||||
config_node.with_raw_node([&] (char const *start, size_t length) {
|
||||
_config_policy.load(start, length); }); });
|
||||
}
|
||||
|
||||
~Child()
|
||||
|
@ -175,7 +175,7 @@ struct Igd::Device
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
supported.for_each_sub_node("device", [&] (Xml_node node) {
|
||||
supported.for_each_sub_node("device", [&] (Xml_node const &node) {
|
||||
if (found)
|
||||
return;
|
||||
|
||||
@ -2543,9 +2543,9 @@ struct Main : Irq_ack_handler, Gpu_reset_handler
|
||||
|
||||
plat_con.update();
|
||||
|
||||
plat_con.with_xml([&] (Xml_node node) {
|
||||
node.with_optional_sub_node("device", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node node) {
|
||||
plat_con.with_xml([&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("device", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("pci-config", [&] (Xml_node const &node) {
|
||||
device_id = node.attribute_value("device_id", 0U);
|
||||
revision = node.attribute_value("revision", 0U);
|
||||
gmch_ctl = node.attribute_value("intel_gmch_control", 0U);
|
||||
|
@ -35,7 +35,7 @@ struct Ps2::Led_state
|
||||
|
||||
Led_state(Genode::Env &env, Name const &name) : _env(env), _name(name) { }
|
||||
|
||||
void update(Genode::Xml_node config, Genode::Signal_context_capability sigh)
|
||||
void update(Genode::Xml_node const &config, Genode::Signal_context_capability sigh)
|
||||
{
|
||||
using Attr = Genode::String<32>;
|
||||
using Value = Genode::String<16>;
|
||||
|
@ -25,7 +25,7 @@ struct Ps2::Verbose
|
||||
bool const scancodes;
|
||||
bool const mouse;
|
||||
|
||||
Verbose(Genode::Xml_node config)
|
||||
Verbose(Genode::Xml_node const &config)
|
||||
:
|
||||
keyboard (config.attribute_value("verbose_keyboard", false)),
|
||||
scancodes(config.attribute_value("verbose_scancodes", false)),
|
||||
|
@ -70,7 +70,7 @@ struct Ps2::Main
|
||||
{
|
||||
_config.update();
|
||||
|
||||
Xml_node config = _config.xml();
|
||||
Xml_node const &config = _config.xml();
|
||||
|
||||
bool const system_was_constructed = _system.constructed();
|
||||
|
||||
|
@ -113,7 +113,7 @@ struct Rtc::Main
|
||||
|
||||
struct Invalid_timestamp_xml : Exception {};
|
||||
|
||||
Timestamp _parse_xml(Xml_node);
|
||||
Timestamp _parse_xml(Xml_node const &);
|
||||
void _handle_update();
|
||||
|
||||
Signal_handler<Main> _update_sigh {
|
||||
@ -140,7 +140,7 @@ struct Rtc::Main
|
||||
};
|
||||
|
||||
|
||||
Rtc::Timestamp Rtc::Main::_parse_xml(Xml_node node)
|
||||
Rtc::Timestamp Rtc::Main::_parse_xml(Xml_node const &node)
|
||||
{
|
||||
bool const complete = node.has_attribute("year")
|
||||
&& node.has_attribute("month")
|
||||
@ -194,7 +194,7 @@ void Rtc::Main::_handle_update()
|
||||
|
||||
if (!_update_rom->valid()) { return; }
|
||||
|
||||
Genode::Xml_node node = _update_rom->xml();
|
||||
Genode::Xml_node const &node = _update_rom->xml();
|
||||
|
||||
try {
|
||||
Timestamp ts = _parse_xml(node);
|
||||
|
@ -146,7 +146,7 @@ class Usb::Block_driver
|
||||
} catch (...) { warning("Could not report block device"); }
|
||||
}
|
||||
|
||||
Interface& _construct_interface(Xml_node & cfg)
|
||||
Interface& _construct_interface(Xml_node const &cfg)
|
||||
{
|
||||
using Type = Interface::Type;
|
||||
using Index = Interface::Index;
|
||||
@ -595,7 +595,7 @@ class Usb::Block_driver
|
||||
};
|
||||
}
|
||||
|
||||
void apply_config(Xml_node node)
|
||||
void apply_config(Xml_node const &node)
|
||||
{
|
||||
_writeable = node.attribute_value("writeable", false);
|
||||
_active_lun = node.attribute_value<uint8_t>("lun", 0);
|
||||
@ -632,7 +632,7 @@ class Usb::Block_driver
|
||||
bool device_ready() { return _state == READY; }
|
||||
|
||||
Block_driver(Env &env, Allocator &alloc, Signal_context_capability sigh,
|
||||
Xml_node config)
|
||||
Xml_node const &config)
|
||||
:
|
||||
_env(env), _ep(env.ep()), _alloc(alloc),
|
||||
_interface(_construct_interface(config))
|
||||
|
@ -1107,7 +1107,7 @@ void Session_component::_device_policy(genode_usb_device const &d,
|
||||
try {
|
||||
Session_policy const policy(label(), _config.xml());
|
||||
|
||||
policy.for_each_sub_node("device", [&] (Xml_node & node) {
|
||||
policy.for_each_sub_node("device", [&] (Xml_node const &node) {
|
||||
uint16_t vendor = node.attribute_value<uint16_t>("vendor_id", 0);
|
||||
uint16_t product = node.attribute_value<uint16_t>("product_id", 0);
|
||||
Label label = node.attribute_value("name", Label());
|
||||
@ -1142,7 +1142,7 @@ void Session_component::_device_policy(genode_usb_device const &d,
|
||||
bool Session_component::_matches(genode_usb_device const & d)
|
||||
{
|
||||
bool ret = false;
|
||||
_device_policy(d, [&] (Xml_node) { ret = true; });
|
||||
_device_policy(d, [&] (Xml_node const &) { ret = true; });
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1240,11 +1240,11 @@ bool Session_component::matches(genode_usb_device::Label label, uint8_t iface)
|
||||
[&] (genode_usb_device const & d) {
|
||||
return d.label() == label; },
|
||||
[&] (genode_usb_device const & d) {
|
||||
_device_policy(d, [&] (Xml_node dev_node) {
|
||||
_device_policy(d, [&] (Xml_node const &dev_node) {
|
||||
if (!dev_node.has_sub_node("interface"))
|
||||
ret = true;
|
||||
else
|
||||
dev_node.for_each_sub_node("interface", [&] (Xml_node & node) {
|
||||
dev_node.for_each_sub_node("interface", [&] (Xml_node const &node) {
|
||||
if (node.attribute_value<uint8_t>("number", 255) == iface)
|
||||
ret = true;
|
||||
});
|
||||
@ -1578,7 +1578,7 @@ void ::Root::_config_update()
|
||||
/*
|
||||
* Check for report policy, and resp. con-/destruct device reporter
|
||||
*/
|
||||
_config.xml().with_optional_sub_node("report", [&] (Xml_node node) {
|
||||
_config.xml().with_optional_sub_node("report", [&] (Xml_node const &node) {
|
||||
_device_reporter.conditional(node.attribute_value("devices", false),
|
||||
_env, "devices", "devices" );
|
||||
|
||||
|
@ -351,28 +351,36 @@ class Device : public List_model<Device>::Element
|
||||
|
||||
void update(Allocator &alloc, Xml_node const &node)
|
||||
{
|
||||
Xml_node active_config = node;
|
||||
auto with_active_config = [] (Xml_node const &node, auto const &fn)
|
||||
{
|
||||
bool found = false;
|
||||
node.for_each_sub_node("config", [&] (Xml_node const &config) {
|
||||
if (!found && config.attribute_value("active", false)) {
|
||||
fn(config);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
if (!found)
|
||||
fn(node);
|
||||
};
|
||||
|
||||
node.for_each_sub_node("config", [&] (Xml_node const &node) {
|
||||
if (node.attribute_value("active", false))
|
||||
active_config = node;
|
||||
with_active_config(node, [&] (Xml_node const &active_config) {
|
||||
_ifaces.update_from_xml(active_config,
|
||||
|
||||
/* create */
|
||||
[&] (Xml_node const &node) -> ::Interface & {
|
||||
return *new (alloc) ::Interface(*this, node, alloc); },
|
||||
|
||||
/* destroy */
|
||||
[&] (::Interface &iface) {
|
||||
iface.update(alloc, Xml_node("<empty/>"));
|
||||
destroy(alloc, &iface); },
|
||||
|
||||
/* update */
|
||||
[&] (::Interface &iface, Xml_node const &node) {
|
||||
iface.update(alloc, node); }
|
||||
);
|
||||
});
|
||||
|
||||
_ifaces.update_from_xml(active_config,
|
||||
|
||||
/* create */
|
||||
[&] (Xml_node const &node) -> ::Interface & {
|
||||
return *new (alloc) ::Interface(*this, node, alloc); },
|
||||
|
||||
/* destroy */
|
||||
[&] (::Interface &iface) {
|
||||
iface.update(alloc, Xml_node("<empty/>"));
|
||||
destroy(alloc, &iface); },
|
||||
|
||||
/* update */
|
||||
[&] (::Interface &iface, Xml_node const &node) {
|
||||
iface.update(alloc, node); }
|
||||
);
|
||||
}
|
||||
|
||||
void update(genode_usb_client_produce_out_t out,
|
||||
@ -461,7 +469,7 @@ struct Session
|
||||
void update(genode_usb_client_dev_add_t add,
|
||||
genode_usb_client_dev_del_t del)
|
||||
{
|
||||
_usb.with_xml([&] (Xml_node node) {
|
||||
_usb.with_xml([&] (Xml_node const &node) {
|
||||
_model.update_from_xml(node,
|
||||
|
||||
/* create */
|
||||
|
@ -466,17 +466,17 @@ struct Vfs::Block_file_system::Local_factory : File_system_factory
|
||||
Readonly_value_file_system<Genode::uint64_t> _block_count_fs { "block_count", 0 };
|
||||
Readonly_value_file_system<size_t> _block_size_fs { "block_size", 0 };
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("block"));
|
||||
}
|
||||
|
||||
static unsigned buffer_count(Xml_node config)
|
||||
static unsigned buffer_count(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("block_buffer_count", 1U);
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_label { config.attribute_value("label", Label("")) },
|
||||
_name { name(config) },
|
||||
@ -489,7 +489,7 @@ struct Vfs::Block_file_system::Local_factory : File_system_factory
|
||||
_block_size_fs .value(_info.block_size);
|
||||
}
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) {
|
||||
return &_data_fs;
|
||||
@ -547,7 +547,7 @@ class Vfs::Block_file_system::Compound_file_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory { vfs_env, node },
|
||||
Vfs::Dir_file_system { vfs_env,
|
||||
|
@ -183,23 +183,21 @@ struct Vfs_capture::Local_factory : File_system_factory
|
||||
|
||||
Data_file_system _data_fs { _name, _label, _env };
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("capture"));
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_label(config.attribute_value("label", Label(""))),
|
||||
_name(name(config)),
|
||||
_env(env.env())
|
||||
{ }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) return &_data_fs;
|
||||
|
||||
return nullptr;
|
||||
return node.has_type("data") ? &_data_fs : nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@ -236,7 +234,7 @@ class Vfs_capture::File_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
File_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory(vfs_env, node),
|
||||
Vfs::Dir_file_system(vfs_env,
|
||||
@ -254,7 +252,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &node) override
|
||||
{
|
||||
return new (env.alloc()) Vfs_capture::File_system(env, node);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ struct Vfs::Global_file_system_factory::Entry_base : Vfs::File_system_factory,
|
||||
|
||||
Entry_base(Fs_type_name const &name) : name(name) { }
|
||||
|
||||
bool matches(Genode::Xml_node node) const {
|
||||
bool matches(Genode::Xml_node const &node) const {
|
||||
return node.has_type(name.string()); }
|
||||
};
|
||||
|
||||
@ -66,7 +66,7 @@ struct Vfs::Builtin_entry : Vfs::Global_file_system_factory::Entry_base
|
||||
{
|
||||
Builtin_entry() : Entry_base(FILE_SYSTEM::name()) { }
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node node) override {
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &node) override {
|
||||
return new (env.alloc()) FILE_SYSTEM(env, node); }
|
||||
};
|
||||
|
||||
@ -80,8 +80,7 @@ struct Vfs::External_entry : Vfs::Global_file_system_factory::Entry_base
|
||||
:
|
||||
Entry_base(name), _fs_factory(fs_factory) { }
|
||||
|
||||
File_system *create(Vfs::Env &env,
|
||||
Genode::Xml_node config) override
|
||||
File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
return _fs_factory.create(env, config);
|
||||
}
|
||||
@ -103,7 +102,7 @@ void Vfs::Global_file_system_factory::_add_builtin_fs()
|
||||
*/
|
||||
Vfs::File_system*
|
||||
Vfs::Global_file_system_factory::_try_create(Vfs::Env &env,
|
||||
Genode::Xml_node config)
|
||||
Genode::Xml_node const &config)
|
||||
{
|
||||
for (Entry_base *e = _list.first(); e; e = e->next())
|
||||
if (e->matches(config)) return e->create(env, config);
|
||||
@ -159,7 +158,7 @@ Vfs::File_system_factory &Vfs::Global_file_system_factory::_load_factory(Vfs::En
|
||||
* Try to load external File_system_factory provider
|
||||
*/
|
||||
bool Vfs::Global_file_system_factory::_probe_external_factory(Vfs::Env &env,
|
||||
Genode::Xml_node node)
|
||||
Genode::Xml_node const &node)
|
||||
{
|
||||
Library_name const lib_name = _library_name(node.type());
|
||||
|
||||
@ -175,8 +174,8 @@ bool Vfs::Global_file_system_factory::_probe_external_factory(Vfs::Env &env,
|
||||
/**
|
||||
* Create and return a new file-system
|
||||
*/
|
||||
Vfs::File_system *Vfs::Global_file_system_factory::create(Vfs::Env &env,
|
||||
Genode::Xml_node node)
|
||||
Vfs::File_system *Vfs::Global_file_system_factory::create(Vfs::Env &env,
|
||||
Genode::Xml_node const &node)
|
||||
{
|
||||
try {
|
||||
/* try if type is handled by the currently registered fs types */
|
||||
|
@ -563,7 +563,7 @@ class Vfs::Fs_file_system : public File_system, private Remote_io
|
||||
|
||||
public:
|
||||
|
||||
Fs_file_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
Fs_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
_env(env),
|
||||
_label(config.attribute_value("label", Label_string("/"))),
|
||||
|
@ -67,7 +67,7 @@ class Vfs::Inline_file_system : public Single_file_system
|
||||
* the object after construction time. The underlying backing store
|
||||
* must be kept in tact during the lifefile of the object.
|
||||
*/
|
||||
Inline_file_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
Inline_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::rx(), config),
|
||||
|
@ -1635,7 +1635,7 @@ class Vfs::Ip_file_system : public Vfs::File_system,
|
||||
|
||||
public:
|
||||
|
||||
Ip_file_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
Ip_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Directory(""),
|
||||
_ep(env.env().ep()), _alloc(env.alloc()), _vfs_user(env.user()),
|
||||
@ -1991,7 +1991,7 @@ struct Ip_factory : Vfs::File_system_factory
|
||||
|
||||
struct genode_socket_io_progress io_progress { };
|
||||
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
io_progress.data = &env;
|
||||
io_progress.callback = socket_progress;
|
||||
|
@ -149,8 +149,7 @@ class Vfs::Log_file_system : public Single_file_system
|
||||
|
||||
public:
|
||||
|
||||
Log_file_system(Vfs::Env &env,
|
||||
Genode::Xml_node config)
|
||||
Log_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::wo(), config),
|
||||
|
@ -22,7 +22,7 @@ namespace Vfs { class Null_file_system; }
|
||||
|
||||
struct Vfs::Null_file_system : Single_file_system
|
||||
{
|
||||
Null_file_system(Vfs::Env&, Genode::Xml_node config)
|
||||
Null_file_system(Vfs::Env&, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::rw(), config)
|
||||
|
@ -572,7 +572,7 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
||||
|
||||
public:
|
||||
|
||||
Ram_file_system(Vfs::Env &env, Genode::Xml_node) : _env(env) { }
|
||||
Ram_file_system(Vfs::Env &env, Genode::Xml_node const &) : _env(env) { }
|
||||
|
||||
~Ram_file_system() { _root.empty(_env.alloc()); }
|
||||
|
||||
|
@ -134,8 +134,7 @@ class Vfs::Rom_file_system : public Single_file_system
|
||||
|
||||
public:
|
||||
|
||||
Rom_file_system(Vfs::Env &env,
|
||||
Genode::Xml_node config)
|
||||
Rom_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::ro(), config),
|
||||
|
@ -124,7 +124,7 @@ class Vfs::Rtc_file_system : public Single_file_system
|
||||
|
||||
public:
|
||||
|
||||
Rtc_file_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
Rtc_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::TRANSACTIONAL_FILE, name(),
|
||||
Node_rwx::ro(), config),
|
||||
|
@ -56,7 +56,7 @@ class Vfs::Symlink_file_system : public Single_file_system
|
||||
|
||||
public:
|
||||
|
||||
Symlink_file_system(Vfs::Env&, Genode::Xml_node config)
|
||||
Symlink_file_system(Vfs::Env&, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::SYMLINK, "symlink",
|
||||
Node_rwx::rw(), config),
|
||||
|
@ -282,7 +282,7 @@ struct Vfs::Tap_file_system::Local_factory : File_system_factory,
|
||||
** Factory interface **
|
||||
***********************/
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) return &_data_fs;
|
||||
if (node.has_type("info")) return &_info_fs;
|
||||
@ -296,12 +296,12 @@ struct Vfs::Tap_file_system::Local_factory : File_system_factory,
|
||||
** Constructor, etc. **
|
||||
***********************/
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("tap"));
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_name (name(config)),
|
||||
_label (config.attribute_value("label", Label(""))),
|
||||
@ -348,7 +348,7 @@ class Vfs::Tap_file_system::Compound_file_system : private Local_factory<FS>,
|
||||
|
||||
public:
|
||||
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory<FS>(vfs_env, node),
|
||||
Vfs::Dir_file_system(vfs_env,
|
||||
@ -366,7 +366,7 @@ extern "C" Vfs::File_system_factory *vfs_file_system_factory(void)
|
||||
{
|
||||
struct Factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node config) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Genode::Xml_node const &config) override
|
||||
{
|
||||
if (config.attribute_value("mode", Vfs::Uplink_mode::NIC_CLIENT) == Vfs::Uplink_mode::NIC_CLIENT)
|
||||
return new (env.alloc())
|
||||
|
@ -536,7 +536,7 @@ class Vfs::Tar_file_system : public File_system
|
||||
|
||||
public:
|
||||
|
||||
Tar_file_system(Vfs::Env &env, Genode::Xml_node config)
|
||||
Tar_file_system(Vfs::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
_env(env.env()), _alloc(env.alloc()),
|
||||
_rom_name(config.attribute_value("name", Rom_name())),
|
||||
|
@ -326,12 +326,12 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory,
|
||||
_interrupts_fs.value(_interrupts);
|
||||
}
|
||||
|
||||
static Name name(Xml_node config)
|
||||
static Name name(Xml_node const &config)
|
||||
{
|
||||
return config.attribute_value("name", Name("terminal"));
|
||||
}
|
||||
|
||||
Local_factory(Vfs::Env &env, Xml_node config)
|
||||
Local_factory(Vfs::Env &env, Xml_node const &config)
|
||||
:
|
||||
_label(config.attribute_value("label", Label(""))),
|
||||
_name(name(config)),
|
||||
@ -343,7 +343,7 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory,
|
||||
_handle_size_changed();
|
||||
}
|
||||
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env&, Xml_node const &node) override
|
||||
{
|
||||
if (node.has_type("data")) return &_data_fs;
|
||||
if (node.has_type("info")) return &_info_fs;
|
||||
@ -392,7 +392,7 @@ class Vfs::Terminal_file_system::Compound_file_system : private Local_factory,
|
||||
|
||||
public:
|
||||
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node node)
|
||||
Compound_file_system(Vfs::Env &vfs_env, Genode::Xml_node const &node)
|
||||
:
|
||||
Local_factory(vfs_env, node),
|
||||
Vfs::Dir_file_system(vfs_env,
|
||||
|
@ -141,7 +141,7 @@ struct Vfs::Xoroshiro_file_system : Single_file_system
|
||||
Allocator &_alloc;
|
||||
|
||||
using File_path = String<256>;
|
||||
static File_path _get_seed_file_path(Xml_node const config)
|
||||
static File_path _get_seed_file_path(Xml_node const &config)
|
||||
{
|
||||
if (!config.has_attribute("seed_path"))
|
||||
error("seed_path is unset");
|
||||
@ -210,7 +210,7 @@ struct Vfs::Xoroshiro_file_system : Single_file_system
|
||||
bool write_ready() const override { return false; }
|
||||
};
|
||||
|
||||
Xoroshiro_file_system(Vfs::Env &vfs_env, Xml_node config)
|
||||
Xoroshiro_file_system(Vfs::Env &vfs_env, Xml_node const &config)
|
||||
:
|
||||
Single_file_system { Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::ro(), config },
|
||||
@ -260,7 +260,7 @@ struct Vfs::Xoroshiro_file_system : Single_file_system
|
||||
|
||||
struct Xoroshiro_factory : Vfs::File_system_factory
|
||||
{
|
||||
Vfs::File_system *create(Vfs::Env &env, Xml_node node) override
|
||||
Vfs::File_system *create(Vfs::Env &env, Xml_node const &node) override
|
||||
{
|
||||
return new (env.alloc()) Vfs::Xoroshiro_file_system(env, node);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ struct Vfs::Zero_file_system : Single_file_system
|
||||
{
|
||||
Genode::size_t const _size;
|
||||
|
||||
Zero_file_system(Vfs::Env&, Genode::Xml_node config)
|
||||
Zero_file_system(Vfs::Env&, Genode::Xml_node const &config)
|
||||
:
|
||||
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
|
||||
Node_rwx::rw(), config),
|
||||
|
@ -153,8 +153,8 @@ struct Monitor::Inferior_pd : Monitored_pd_session
|
||||
void apply_monitor_config(Xml_node const &monitor)
|
||||
{
|
||||
with_matching_policy(_name, monitor,
|
||||
[&] (Xml_node const policy) { _policy = Policy::from_xml(policy); },
|
||||
[&] { _policy = Policy::default_policy(); });
|
||||
[&] (Xml_node const &policy) { _policy = Policy::from_xml(policy); },
|
||||
[&] { _policy = Policy::default_policy(); });
|
||||
|
||||
if (_policy.wx) {
|
||||
_address_space.writeable_text_segments(_alloc, _wx_ram, _local_rm);
|
||||
|
@ -72,15 +72,15 @@ struct Chroot::Main
|
||||
|
||||
void handle_config_update() { config_rom.update(); }
|
||||
|
||||
void handle_session_request(Xml_node request);
|
||||
void handle_session_request(Xml_node const &request);
|
||||
|
||||
void handle_session_requests()
|
||||
{
|
||||
session_requests.update();
|
||||
|
||||
Xml_node const requests = session_requests.xml();
|
||||
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);
|
||||
});
|
||||
}
|
||||
@ -199,7 +199,7 @@ struct Chroot::Main
|
||||
};
|
||||
|
||||
|
||||
void Chroot::Main::handle_session_request(Xml_node request)
|
||||
void Chroot::Main::handle_session_request(Xml_node const &request)
|
||||
{
|
||||
if (!request.has_attribute("id"))
|
||||
return;
|
||||
@ -221,7 +221,6 @@ void Chroot::Main::handle_session_request(Xml_node request)
|
||||
Session_capability cap = request_session(session->client_id.id(), args,
|
||||
Affinity::from_xml(request));
|
||||
|
||||
|
||||
env.parent().deliver_session_cap(server_id, cap);
|
||||
}
|
||||
|
||||
|
@ -23,18 +23,12 @@
|
||||
#include <rom_session/rom_session.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <root/component.h>
|
||||
#include <os/buffered_xml.h>
|
||||
|
||||
|
||||
namespace Dynamic_rom {
|
||||
using Genode::Entrypoint;
|
||||
using Genode::Rpc_object;
|
||||
using Genode::Sliced_heap;
|
||||
using Genode::Env;
|
||||
using Genode::Constructible;
|
||||
using Genode::Signal_context_capability;
|
||||
using Genode::Signal_handler;
|
||||
using Genode::Xml_node;
|
||||
using Genode::Arg_string;
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
class Session_component;
|
||||
class Root;
|
||||
@ -47,9 +41,9 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
private:
|
||||
|
||||
Env &_env;
|
||||
bool &_verbose;
|
||||
Xml_node _rom_node;
|
||||
Timer::Connection _timer;
|
||||
bool const &_verbose;
|
||||
Buffered_xml const _rom_node;
|
||||
Timer::Connection _timer { _env };
|
||||
unsigned _curr_idx = 0;
|
||||
bool _has_content = false;
|
||||
unsigned _last_content_idx = ~0;
|
||||
@ -65,6 +59,14 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
Genode::Signal_transmitter(_sigh).submit();
|
||||
}
|
||||
|
||||
auto _with_step(unsigned const n, auto const &fn) const
|
||||
{
|
||||
unsigned i = 0;
|
||||
_rom_node.xml.for_each_sub_node([&] (Xml_node const &step) {
|
||||
if (i++ == n)
|
||||
fn(step); });
|
||||
}
|
||||
|
||||
/**
|
||||
* Print message prefixed with ROM name
|
||||
*/
|
||||
@ -75,12 +77,12 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
return;
|
||||
|
||||
using Name = Genode::String<160>;
|
||||
Genode::log(_rom_node.attribute_value("name", Name()), ": ", args...);
|
||||
Genode::log(_rom_node.xml.attribute_value("name", Name()), ": ", args...);
|
||||
}
|
||||
|
||||
enum Execution_state { EXEC_CONTINUE, EXEC_BLOCK };
|
||||
|
||||
Execution_state _execute_step(Xml_node curr_step)
|
||||
Execution_state _execute_step(Xml_node const &curr_step)
|
||||
{
|
||||
/*
|
||||
* Replace content of ROM module by new one. Note that the content
|
||||
@ -137,25 +139,27 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
Execution_state exec_state = EXEC_CONTINUE;
|
||||
while (exec_state == EXEC_CONTINUE) {
|
||||
|
||||
exec_state = _execute_step(_rom_node.sub_node(_curr_idx));
|
||||
_with_step(_curr_idx, [&] (Xml_node const &step) {
|
||||
exec_state = _execute_step(step); });
|
||||
|
||||
/* advance step index, wrap at the end */
|
||||
_curr_idx = (_curr_idx + 1) % (unsigned)_rom_node.num_sub_nodes();
|
||||
_curr_idx = (_curr_idx + 1) % (unsigned)_rom_node.xml.num_sub_nodes();
|
||||
}
|
||||
}
|
||||
|
||||
void _handle_timer() { _execute_steps_until_sleep(); }
|
||||
|
||||
Entrypoint &_ep;
|
||||
Entrypoint &_ep = _env.ep();
|
||||
|
||||
using This = Session_component;
|
||||
Signal_handler<This> _timer_handler = { _ep, *this, &This::_handle_timer };
|
||||
|
||||
public:
|
||||
|
||||
Session_component(Env &env, Xml_node rom_node, bool &verbose)
|
||||
Session_component(Env &env, Allocator &alloc, Xml_node const &rom_node,
|
||||
bool const &verbose)
|
||||
:
|
||||
_env(env), _verbose(verbose), _rom_node(rom_node), _timer(env), _ep(env.ep())
|
||||
_env(env), _verbose(verbose), _rom_node(alloc, rom_node)
|
||||
{
|
||||
/* init timer signal handler */
|
||||
_timer.sigh(_timer_handler);
|
||||
@ -172,12 +176,12 @@ class Dynamic_rom::Session_component : public Rpc_object<Genode::Rom_session>
|
||||
return Rom_dataspace_capability();
|
||||
|
||||
/* replace dataspace by new one */
|
||||
_ram_ds.construct(_env.ram(), _env.rm(), _rom_node.size());
|
||||
_ram_ds.construct(_env.ram(), _env.rm(), _rom_node.xml.size());
|
||||
|
||||
/* fill with content of current step */
|
||||
Xml_node step_node = _rom_node.sub_node(_last_content_idx);
|
||||
step_node.with_raw_content([&] (char const *start, size_t size) {
|
||||
memcpy(_ram_ds->local_addr<char>(), start, size); });
|
||||
_with_step(_last_content_idx, [&] (Xml_node const &step_node) {
|
||||
step_node.with_raw_content([&] (char const *start, size_t size) {
|
||||
memcpy(_ram_ds->local_addr<char>(), start, size); }); });
|
||||
|
||||
/* cast RAM into ROM dataspace capability */
|
||||
Dataspace_capability ds_cap = static_cap_cast<Dataspace>(_ram_ds->cap());
|
||||
@ -195,22 +199,24 @@ class Dynamic_rom::Root : public Genode::Root_component<Session_component>
|
||||
{
|
||||
private:
|
||||
|
||||
Env &_env;
|
||||
Xml_node _config_node;
|
||||
bool &_verbose;
|
||||
Env &_env;
|
||||
|
||||
class Nonexistent_rom_module { };
|
||||
bool const &_verbose;
|
||||
|
||||
Xml_node _lookup_rom_node_in_config(Genode::Session_label const &name)
|
||||
Buffered_xml const _config_node;
|
||||
|
||||
void _with_rom_node(Genode::Session_label const &name,
|
||||
auto const &fn, auto const &missing_fn) const
|
||||
{
|
||||
/* lookup ROM module in config */
|
||||
for (unsigned i = 0; i < _config_node.num_sub_nodes(); i++) {
|
||||
Xml_node const node = _config_node.sub_node(i);
|
||||
|
||||
if (node.attribute_value("name", Genode::String<64>()) == name)
|
||||
return node;
|
||||
}
|
||||
throw Nonexistent_rom_module();
|
||||
bool found = false;
|
||||
_config_node.xml.for_each_sub_node([&] (Xml_node const &node) {
|
||||
if (!found && node.attribute_value("name", Genode::String<64>()) == name) {
|
||||
fn(node);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
if (!found)
|
||||
missing_fn();
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -223,25 +229,26 @@ class Dynamic_rom::Root : public Genode::Root_component<Session_component>
|
||||
Session_label const label = label_from_args(args);
|
||||
Session_label const module_name = label.last_element();
|
||||
|
||||
try {
|
||||
return new (md_alloc())
|
||||
Session_component(_env,
|
||||
_lookup_rom_node_in_config(module_name),
|
||||
_verbose);
|
||||
}
|
||||
catch (Nonexistent_rom_module) {
|
||||
error("ROM module lookup of '", label.string(), "' failed");
|
||||
throw Service_denied();
|
||||
}
|
||||
Session_component *result = nullptr;
|
||||
|
||||
_with_rom_node(module_name,
|
||||
[&] (Xml_node const &rom_node) {
|
||||
result = new (md_alloc())
|
||||
Session_component(_env, *md_alloc(), rom_node, _verbose); },
|
||||
[&] {
|
||||
error("ROM module lookup of '", label.string(), "' failed");
|
||||
throw Service_denied(); });
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Root(Env &env, Genode::Allocator &md_alloc,
|
||||
Xml_node config_node, bool &verbose)
|
||||
Xml_node const &config_node, bool const &verbose)
|
||||
:
|
||||
Genode::Root_component<Session_component>(&env.ep().rpc_ep(), &md_alloc),
|
||||
_env(env), _config_node(config_node), _verbose(verbose)
|
||||
_env(env), _verbose(verbose), _config_node(md_alloc, config_node)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -99,11 +99,11 @@ class Event_filter::Accelerate_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "accelerate"; }
|
||||
|
||||
Accelerate_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Accelerate_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config))),
|
||||
_source(factory.create_source_for_sub_node(_owner, config)),
|
||||
_lut (config.attribute_value("curve", 127L)),
|
||||
_sensitivity_percent(config.attribute_value("sensitivity_percent", 100L)),
|
||||
_max (config.attribute_value("max", 20L))
|
||||
|
@ -30,19 +30,33 @@ class Event_filter::Button_scroll_source : public Source, Source::Filter
|
||||
|
||||
struct Wheel
|
||||
{
|
||||
Input::Keycode const _button;
|
||||
|
||||
static Key_name _button_attribute(Xml_node node)
|
||||
struct Attr
|
||||
{
|
||||
return node.attribute_value("button", Key_name("BTN_MIDDLE"));
|
||||
}
|
||||
Input::Keycode button;
|
||||
|
||||
/**
|
||||
* Factor to scale motion events in percent
|
||||
*/
|
||||
int const _factor;
|
||||
int const _factor_sign = (_factor < 0) ? -1 : 1;
|
||||
int const _factor_percent = _factor_sign*_factor;
|
||||
/**
|
||||
* Factor to scale motion events in percent
|
||||
*/
|
||||
int factor;
|
||||
|
||||
static Key_name _button_attribute(Xml_node const &node)
|
||||
{
|
||||
return node.attribute_value("button", Key_name("BTN_MIDDLE"));
|
||||
}
|
||||
|
||||
static Attr from_xml(Xml_node const &node)
|
||||
{
|
||||
return {
|
||||
.button = key_code_by_name(_button_attribute(node).string()),
|
||||
.factor = (int)node.attribute_value("speed_percent", 0L)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Attr const _attr;
|
||||
|
||||
int const _factor_sign = (_attr.factor < 0) ? -1 : 1;
|
||||
int const _factor_percent = _factor_sign*_attr.factor;
|
||||
|
||||
/**
|
||||
* True while user holds the configured button
|
||||
@ -56,17 +70,13 @@ class Event_filter::Button_scroll_source : public Source, Source::Filter
|
||||
*/
|
||||
int _accumulated_motion = 0;
|
||||
|
||||
Wheel(Xml_node config)
|
||||
:
|
||||
_button(key_code_by_name(_button_attribute(config).string())),
|
||||
_factor((int)config.attribute_value("speed_percent", 0L))
|
||||
{ }
|
||||
Wheel(Attr const &attr) : _attr(attr) { }
|
||||
|
||||
void handle_activation(Input::Event const &event)
|
||||
{
|
||||
switch (_state) {
|
||||
case IDLE:
|
||||
if (event.key_press(_button)) {
|
||||
if (event.key_press(_attr.button)) {
|
||||
_state = BUTTON_PRESSED;
|
||||
_accumulated_motion = 0;
|
||||
}
|
||||
@ -91,7 +101,7 @@ class Event_filter::Button_scroll_source : public Source, Source::Filter
|
||||
*/
|
||||
bool handle_deactivation(Input::Event const &event)
|
||||
{
|
||||
if (event.key_release(_button)) {
|
||||
if (event.key_release(_attr.button)) {
|
||||
bool const emit_press_release = (_state == BUTTON_PRESSED);
|
||||
_state = IDLE;
|
||||
_accumulated_motion = 0;
|
||||
@ -132,12 +142,12 @@ class Event_filter::Button_scroll_source : public Source, Source::Filter
|
||||
bool suppressed(Input::Event const event)
|
||||
{
|
||||
return (_state == ACTIVE && event.relative_motion())
|
||||
|| event.key_press(_button);
|
||||
|| event.key_press(_attr.button);
|
||||
}
|
||||
|
||||
bool release(Input::Event const event) const
|
||||
{
|
||||
return event.key_release(_button);
|
||||
return event.key_release(_attr.button);
|
||||
}
|
||||
};
|
||||
|
||||
@ -199,23 +209,25 @@ class Event_filter::Button_scroll_source : public Source, Source::Filter
|
||||
destination.submit(event);
|
||||
}
|
||||
|
||||
static Xml_node _sub_node(Xml_node node, char const *type)
|
||||
static Wheel::Attr _attr_for_sub_node(Xml_node const &node, char const *type)
|
||||
{
|
||||
return node.has_sub_node(type) ? node.sub_node(type)
|
||||
: Xml_node("<ignored/>");
|
||||
Wheel::Attr result { };
|
||||
node.with_optional_sub_node(type, [&] (Xml_node const &sub_node) {
|
||||
result = Wheel::Attr::from_xml(sub_node); });
|
||||
return result;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
static char const *name() { return "button-scroll"; }
|
||||
|
||||
Button_scroll_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Button_scroll_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner),
|
||||
_vertical_wheel (_sub_node(config, "vertical")),
|
||||
_horizontal_wheel(_sub_node(config, "horizontal")),
|
||||
_vertical_wheel (_attr_for_sub_node(config, "vertical")),
|
||||
_horizontal_wheel(_attr_for_sub_node(config, "horizontal")),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config)))
|
||||
_source(factory.create_source_for_sub_node(_owner, config))
|
||||
{ }
|
||||
|
||||
void generate(Sink &destination) override
|
||||
|
@ -51,7 +51,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
|
||||
Input::Keycode const _code;
|
||||
|
||||
static Id id(Xml_node mod_node)
|
||||
static Id id(Xml_node const &mod_node)
|
||||
{
|
||||
if (mod_node.type() == "mod1") return MOD1;
|
||||
if (mod_node.type() == "mod2") return MOD2;
|
||||
@ -91,8 +91,9 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
_element(registry, *this), _id(id)
|
||||
{
|
||||
try {
|
||||
include_accessor.apply_include(name, "capslock", [&] (Xml_node node) {
|
||||
_enabled = node.attribute_value("enabled", false); }); }
|
||||
include_accessor.apply_include(name, "capslock",
|
||||
[&] (Xml_node const &node) {
|
||||
_enabled = node.attribute_value("enabled", false); }); }
|
||||
|
||||
catch (Include_accessor::Include_unavailable) {
|
||||
warning("failed to obtain modifier state from "
|
||||
@ -245,7 +246,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
*
|
||||
* \throw Missing_character_definition
|
||||
*/
|
||||
static Codepoint _codepoint_from_xml_node(Xml_node node)
|
||||
static Codepoint _codepoint_from_xml_node(Xml_node const &node)
|
||||
{
|
||||
if (node.has_attribute("ascii"))
|
||||
return Codepoint { node.attribute_value<uint32_t>("ascii", 0) };
|
||||
@ -318,7 +319,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
* Obtain modifier condition from map XML node
|
||||
*/
|
||||
static Key::Rule::Conditions::Modifier::Constraint
|
||||
_map_mod_cond(Xml_node map, Modifier::Name const &mod_name)
|
||||
_map_mod_cond(Xml_node const &map, Modifier::Name const &mod_name)
|
||||
{
|
||||
if (!map.has_attribute(mod_name.string()))
|
||||
return Key::Rule::Conditions::Modifier::DONT_CARE;
|
||||
@ -329,7 +330,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
: Key::Rule::Conditions::Modifier::RELEASED;
|
||||
}
|
||||
|
||||
void import_map(Xml_node map)
|
||||
void import_map(Xml_node const &map)
|
||||
{
|
||||
/* obtain modifier conditions from map attributes */
|
||||
Key::Rule::Conditions cond;
|
||||
@ -339,7 +340,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
cond.modifiers[Modifier::MOD4].constraint = _map_mod_cond(map, "mod4");
|
||||
|
||||
/* add a rule for each <key> sub node */
|
||||
map.for_each_sub_node("key", [&] (Xml_node key_node) {
|
||||
map.for_each_sub_node("key", [&] (Xml_node const &key_node) {
|
||||
|
||||
Key_name const name = key_node.attribute_value("name", Key_name());
|
||||
|
||||
@ -452,7 +453,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
destroy(_alloc, &rule); });
|
||||
}
|
||||
|
||||
void import_sequence(Xml_node node)
|
||||
void import_sequence(Xml_node const &node)
|
||||
{
|
||||
unsigned const invalid { Codepoint::INVALID };
|
||||
|
||||
@ -555,7 +556,8 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
Timer::One_shot_timeout<Char_repeater> _timeout {
|
||||
_timer, *this, &Char_repeater::_handle_timeout };
|
||||
|
||||
Char_repeater(Timer::Connection &timer, Xml_node node, Source::Trigger &trigger)
|
||||
Char_repeater(Timer::Connection &timer, Xml_node const &node,
|
||||
Source::Trigger &trigger)
|
||||
:
|
||||
_timer(timer), _trigger(trigger),
|
||||
_delay(node.attribute_value("delay_ms", (uint64_t)0)*1000),
|
||||
@ -626,13 +628,13 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
|
||||
Source::Trigger &_trigger;
|
||||
|
||||
void _apply_config(Xml_node const config, unsigned const max_recursion = 4)
|
||||
void _apply_config(Xml_node const &config, unsigned const max_recursion = 4)
|
||||
{
|
||||
config.for_each_sub_node([&] (Xml_node node) {
|
||||
config.for_each_sub_node([&] (Xml_node const &node) {
|
||||
_apply_sub_node(node, max_recursion); });
|
||||
}
|
||||
|
||||
void _apply_sub_node(Xml_node const node, unsigned const max_recursion)
|
||||
void _apply_sub_node(Xml_node const &node, unsigned const max_recursion)
|
||||
{
|
||||
if (max_recursion == 0) {
|
||||
warning("too deeply nested includes");
|
||||
@ -647,7 +649,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
Include_accessor::Name const rom =
|
||||
node.attribute_value("rom", Include_accessor::Name());
|
||||
|
||||
_include_accessor.apply_include(rom, name(), [&] (Xml_node inc) {
|
||||
_include_accessor.apply_include(rom, name(), [&] (Xml_node const &inc) {
|
||||
_apply_config(inc, max_recursion - 1); });
|
||||
return;
|
||||
}
|
||||
@ -694,7 +696,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
if (id == Modifier::UNDEFINED)
|
||||
return;
|
||||
|
||||
node.for_each_sub_node("key", [&] (Xml_node key_node) {
|
||||
node.for_each_sub_node("key", [&] (Xml_node const &key_node) {
|
||||
|
||||
Key_name const name = key_node.attribute_value("name", Key_name());
|
||||
Input::Keycode const key = key_code_by_name(name);
|
||||
@ -702,7 +704,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
new (_alloc) Modifier(_modifiers, id, key);
|
||||
});
|
||||
|
||||
node.for_each_sub_node("rom", [&] (Xml_node rom_node) {
|
||||
node.for_each_sub_node("rom", [&] (Xml_node const &rom_node) {
|
||||
|
||||
using Rom_name = Modifier_rom::Name;
|
||||
Rom_name const rom_name = rom_node.attribute_value("name", Rom_name());
|
||||
@ -718,7 +720,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
static char const *name() { return "chargen"; }
|
||||
|
||||
Chargen_source(Owner &owner,
|
||||
Xml_node config,
|
||||
Xml_node const &config,
|
||||
Source::Factory &factory,
|
||||
Allocator &alloc,
|
||||
Timer_accessor &timer_accessor,
|
||||
@ -732,7 +734,7 @@ class Event_filter::Chargen_source : public Source, Source::Filter
|
||||
_key_map(_alloc),
|
||||
_sequencer(_alloc),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config))),
|
||||
_source(factory.create_source_for_sub_node(_owner, config)),
|
||||
_trigger(trigger)
|
||||
{
|
||||
_apply_config(config);
|
||||
|
@ -92,7 +92,7 @@ class Event_filter::Event_session : public Session_object<Event::Session, Event_
|
||||
/**
|
||||
* (Re-)assign input name to session according to session policy
|
||||
*/
|
||||
void assign_input_name(Xml_node config)
|
||||
void assign_input_name(Xml_node const &config)
|
||||
{
|
||||
_input_name = Input_name();
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Event_filter::Include_accessor : Interface
|
||||
|
||||
protected:
|
||||
|
||||
struct Functor : Interface { virtual void apply(Xml_node node) const = 0; };
|
||||
struct Functor : Interface { virtual void apply(Xml_node const &node) const = 0; };
|
||||
|
||||
/*
|
||||
* \throw Include_unavailable
|
||||
@ -44,7 +44,7 @@ class Event_filter::Include_accessor : Interface
|
||||
public:
|
||||
|
||||
/**
|
||||
* Call functor 'fn' with the 'Xml_node' of the named include
|
||||
* Call functor 'fn' with the 'Xml_node const &' of the named include
|
||||
*
|
||||
* \throw Include_unavailable
|
||||
*/
|
||||
@ -57,7 +57,7 @@ class Event_filter::Include_accessor : Interface
|
||||
|
||||
Functor(FN const &fn) : fn(fn) { }
|
||||
|
||||
void apply(Xml_node node) const override { fn(node); }
|
||||
void apply(Xml_node const &node) const override { fn(node); }
|
||||
} _functor(fn);
|
||||
|
||||
_apply_include(name, type, _functor);
|
||||
|
@ -59,7 +59,7 @@ class Event_filter::Log_source : public Source, Source::Filter
|
||||
destination.submit(event);
|
||||
}
|
||||
|
||||
void _apply_config(Xml_node const config)
|
||||
void _apply_config(Xml_node const &config)
|
||||
{
|
||||
_prefix = config.attribute_value("prefix", Prefix());
|
||||
_motion = config.attribute_value("motion", false);
|
||||
@ -69,11 +69,11 @@ class Event_filter::Log_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "log"; }
|
||||
|
||||
Log_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Log_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config)))
|
||||
_source(factory.create_source_for_sub_node(_owner, config))
|
||||
{
|
||||
_apply_config(config);
|
||||
}
|
||||
|
@ -114,20 +114,18 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
|
||||
bool has_name(Name const &name) const { return _name == name; }
|
||||
|
||||
/**
|
||||
* Return ROM content as XML
|
||||
*
|
||||
* \throw Include_unavailable
|
||||
*/
|
||||
Xml_node xml(Include_accessor::Type const &type) const
|
||||
void with_xml(Include_accessor::Type const &type,
|
||||
auto const &fn, auto const &missing_fn) const
|
||||
{
|
||||
Xml_node const node = _dataspace.xml();
|
||||
if (node.type() == type)
|
||||
return node;
|
||||
Xml_node const &node = _dataspace.xml();
|
||||
if (node.type() == type) {
|
||||
fn(node);
|
||||
return;
|
||||
}
|
||||
|
||||
warning("unexpected <", node.type(), "> node " "in included "
|
||||
"ROM \"", _name, "\", expected, <", type, "> node");
|
||||
throw Include_unavailable();
|
||||
missing_fn();
|
||||
}
|
||||
};
|
||||
|
||||
@ -172,7 +170,8 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
Rom &rom = *new (_alloc) Rom(_registry, _env, name, _sigh);
|
||||
|
||||
/* \throw Include_unavailable on mismatching top-level node type */
|
||||
rom.xml(type);
|
||||
rom.with_xml(type, [] (Xml_node const &) { },
|
||||
[] { throw Include_unavailable(); });
|
||||
}
|
||||
catch (...) { throw Include_unavailable(); }
|
||||
}
|
||||
@ -187,7 +186,9 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
if (!matching_rom)
|
||||
throw Include_unavailable();
|
||||
|
||||
fn.apply(matching_rom->xml(type));
|
||||
matching_rom->with_xml(type,
|
||||
[&] (Xml_node const &node) { fn.apply(node); },
|
||||
[&] { throw Include_unavailable(); });
|
||||
}
|
||||
};
|
||||
|
||||
@ -201,7 +202,7 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
*
|
||||
* \throw Source::Invalid_config
|
||||
*/
|
||||
Source &create_source(Source::Owner &owner, Xml_node node) override
|
||||
Source &create_source(Source::Owner &owner, Xml_node const &node) override
|
||||
{
|
||||
/*
|
||||
* Guard for the protection against too deep recursions while
|
||||
@ -288,10 +289,10 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
* \throw Source::Invalid_config
|
||||
* \throw Genode::Out_of_memory
|
||||
*/
|
||||
Output(Xml_node output, Source::Factory &factory)
|
||||
Output(Xml_node const &output, Source::Factory &factory)
|
||||
:
|
||||
_owner(factory),
|
||||
_top_level(factory.create_source(_owner, Source::input_sub_node(output)))
|
||||
_top_level(factory.create_source_for_sub_node(_owner, output))
|
||||
{ }
|
||||
|
||||
void generate(Source::Sink &destination) { _top_level.generate(destination); }
|
||||
@ -323,7 +324,7 @@ struct Event_filter::Main : Source::Factory, Source::Trigger
|
||||
|
||||
void _apply_config()
|
||||
{
|
||||
Xml_node const config = _config.xml();
|
||||
Xml_node const &config = _config.xml();
|
||||
|
||||
_event_root.apply_config(config);
|
||||
|
||||
|
@ -30,11 +30,11 @@ class Event_filter::Merge_source : public Source
|
||||
|
||||
static char const *name() { return "merge"; }
|
||||
|
||||
Merge_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Merge_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner), _owner(factory)
|
||||
{
|
||||
config.for_each_sub_node([&] (Xml_node node) {
|
||||
config.for_each_sub_node([&] (Xml_node const &node) {
|
||||
if (input_node(node))
|
||||
factory.create_source(_owner, node); });
|
||||
}
|
||||
|
@ -74,13 +74,13 @@ class Event_filter::Remap_source : public Source, Source::Filter
|
||||
destination.submit(Input::Release{remap(key)}); });
|
||||
}
|
||||
|
||||
void _apply_config(Xml_node const config, unsigned const max_recursion = 4)
|
||||
void _apply_config(Xml_node const &config, unsigned const max_recursion = 4)
|
||||
{
|
||||
config.for_each_sub_node([&] (Xml_node node) {
|
||||
config.for_each_sub_node([&] (Xml_node const &node) {
|
||||
_apply_sub_node(node, max_recursion); });
|
||||
}
|
||||
|
||||
void _apply_sub_node(Xml_node const node, unsigned const max_recursion)
|
||||
void _apply_sub_node(Xml_node const &node, unsigned const max_recursion)
|
||||
{
|
||||
if (max_recursion == 0) {
|
||||
warning("too deeply nested includes");
|
||||
@ -95,7 +95,7 @@ class Event_filter::Remap_source : public Source, Source::Filter
|
||||
Include_accessor::Name const rom =
|
||||
node.attribute_value("rom", Include_accessor::Name());
|
||||
|
||||
_include_accessor.apply_include(rom, name(), [&] (Xml_node inc) {
|
||||
_include_accessor.apply_include(rom, name(), [&] (Xml_node const &inc) {
|
||||
_apply_config(inc, max_recursion - 1); });
|
||||
return;
|
||||
}
|
||||
@ -144,12 +144,12 @@ class Event_filter::Remap_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "remap"; }
|
||||
|
||||
Remap_source(Owner &owner, Xml_node config, Source::Factory &factory,
|
||||
Remap_source(Owner &owner, Xml_node const &config, Source::Factory &factory,
|
||||
Include_accessor &include_accessor)
|
||||
:
|
||||
Source(owner),
|
||||
_include_accessor(include_accessor), _owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config)))
|
||||
_source(factory.create_source_for_sub_node(_owner, config))
|
||||
{
|
||||
for (unsigned i = 0; i < Input::KEY_MAX; i++)
|
||||
_keys[i].code = Input::Keycode(i);
|
||||
|
@ -39,7 +39,7 @@ class Event_filter::Source
|
||||
|
||||
virtual ~Source() { }
|
||||
|
||||
static bool input_node(Xml_node node)
|
||||
static bool input_node(Xml_node const &node)
|
||||
{
|
||||
return node.type() == "input"
|
||||
|| node.type() == "remap"
|
||||
@ -55,19 +55,21 @@ class Event_filter::Source
|
||||
return false;
|
||||
}
|
||||
|
||||
static Xml_node input_sub_node(Xml_node node)
|
||||
static void with_input_sub_node(Xml_node const &node,
|
||||
auto const &fn, auto const &missing_fn)
|
||||
{
|
||||
Xml_node result("<none/>");
|
||||
bool found = false;
|
||||
node.for_each_sub_node([&] (Xml_node const &sub_node) {
|
||||
if (!found && input_node(sub_node)) {
|
||||
fn(sub_node);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
node.for_each_sub_node([&] (Xml_node sub_node) {
|
||||
if (input_node(sub_node))
|
||||
result = sub_node; });
|
||||
|
||||
if (result.type() != "none")
|
||||
return result;
|
||||
|
||||
warning("missing input-source sub node in ", node);
|
||||
throw Invalid_config { };
|
||||
if (!found) {
|
||||
warning("missing input-source sub node in ", node);
|
||||
missing_fn();
|
||||
}
|
||||
}
|
||||
|
||||
struct Owner;
|
||||
@ -115,7 +117,21 @@ class Event_filter::Source
|
||||
/*
|
||||
* \throw Invalid_config
|
||||
*/
|
||||
virtual Source &create_source(Owner &, Xml_node) = 0;
|
||||
virtual Source &create_source(Owner &, Xml_node const &) = 0;
|
||||
|
||||
Source &create_source_for_sub_node(Owner &owner, Xml_node const &node)
|
||||
{
|
||||
Source *ptr = nullptr;
|
||||
with_input_sub_node(node,
|
||||
[&] (Xml_node const &sub_node) {
|
||||
ptr = &create_source(owner, sub_node); },
|
||||
[&] { /* no valid input sub node */ });
|
||||
|
||||
if (ptr)
|
||||
return *ptr;
|
||||
else
|
||||
throw Invalid_config();
|
||||
}
|
||||
|
||||
virtual void destroy_source(Source &) = 0;
|
||||
};
|
||||
|
@ -85,11 +85,11 @@ class Event_filter::Touch_click_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "touch-click"; }
|
||||
|
||||
Touch_click_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Touch_click_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config)))
|
||||
_source(factory.create_source_for_sub_node(_owner, config))
|
||||
{ }
|
||||
|
||||
void generate(Sink &destination) override
|
||||
|
@ -101,12 +101,12 @@ class Event_filter::Touch_key_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "touch-key"; }
|
||||
|
||||
Touch_key_source(Owner &owner, Xml_node config,
|
||||
Touch_key_source(Owner &owner, Xml_node const &config,
|
||||
Source::Factory &factory, Allocator &alloc)
|
||||
:
|
||||
Source(owner),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config))),
|
||||
_source(factory.create_source_for_sub_node(_owner, config)),
|
||||
_alloc(alloc)
|
||||
{
|
||||
config.for_each_sub_node("tap", [&] (Xml_node const &node) {
|
||||
|
@ -35,9 +35,9 @@ class Event_filter::Transform_source : public Source, Source::Filter
|
||||
|
||||
Transform::Matrix _transform = Transform::Matrix::identity();
|
||||
|
||||
void _apply_config(Xml_node const config)
|
||||
void _apply_config(Xml_node const &config)
|
||||
{
|
||||
config.for_each_sub_node([&] (Xml_node node) {
|
||||
config.for_each_sub_node([&] (Xml_node const &node) {
|
||||
if (node.has_type("translate")) {
|
||||
_transform = _transform.translate(
|
||||
float(node.attribute_value("x", 0.0)),
|
||||
@ -123,11 +123,11 @@ class Event_filter::Transform_source : public Source, Source::Filter
|
||||
|
||||
static char const *name() { return "transform"; }
|
||||
|
||||
Transform_source(Owner &owner, Xml_node config, Source::Factory &factory)
|
||||
Transform_source(Owner &owner, Xml_node const &config, Source::Factory &factory)
|
||||
:
|
||||
Source(owner),
|
||||
_owner(factory),
|
||||
_source(factory.create_source(_owner, input_sub_node(config)))
|
||||
_source(factory.create_source_for_sub_node(_owner, config))
|
||||
{
|
||||
_apply_config(config);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ struct Gui_fb::Main : View_updater, Input::Session_component::Action
|
||||
|
||||
bool set { false };
|
||||
|
||||
Initial_size(Xml_node config)
|
||||
Initial_size(Xml_node const &config)
|
||||
:
|
||||
_width (config.attribute_value("initial_width", 0L)),
|
||||
_height(config.attribute_value("initial_height", 0L))
|
||||
@ -393,7 +393,7 @@ struct Gui_fb::Main : View_updater, Input::Session_component::Action
|
||||
/**
|
||||
* Return screen-coordinate origin, depening on the config and screen mode
|
||||
*/
|
||||
static Point _coordinate_origin(Gui::Area gui_area, Xml_node config)
|
||||
static Point _coordinate_origin(Gui::Area gui_area, Xml_node const &config)
|
||||
{
|
||||
char const * const attr = "origin";
|
||||
|
||||
@ -414,7 +414,7 @@ struct Gui_fb::Main : View_updater, Input::Session_component::Action
|
||||
|
||||
void _update_size()
|
||||
{
|
||||
Xml_node const config = _config_rom.xml();
|
||||
Xml_node const &config = _config_rom.xml();
|
||||
|
||||
Gui::Area const gui_area = _gui_window().area;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <stdio.h> /* perror */
|
||||
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
|
||||
|
||||
static bool xml_attr_ok(Genode::Xml_node node, char const *attr)
|
||||
static bool xml_attr_ok(Genode::Xml_node const &node, char const *attr)
|
||||
{
|
||||
return node.attribute_value(attr, false);
|
||||
}
|
||||
@ -86,7 +86,7 @@ class Lx_block_driver : public Block::Driver
|
||||
|
||||
struct Could_not_open_file : Genode::Exception { };
|
||||
|
||||
Lx_block_driver(Genode::Env &env, Genode::Xml_node config)
|
||||
Lx_block_driver(Genode::Env &env, Genode::Xml_node const &config)
|
||||
:
|
||||
Block::Driver(env.ram()),
|
||||
_env(env),
|
||||
@ -174,7 +174,7 @@ struct Main
|
||||
{
|
||||
Genode::Constructible<Lx_block_driver> _driver { };
|
||||
|
||||
Factory(Genode::Env &env, Genode::Xml_node config)
|
||||
Factory(Genode::Env &env, Genode::Xml_node const &config)
|
||||
{
|
||||
_driver.construct(env, config);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class Audio_out::Mixer
|
||||
bool const sessions;
|
||||
bool const changes;
|
||||
|
||||
Verbose(Genode::Xml_node config)
|
||||
Verbose(Genode::Xml_node const &config)
|
||||
:
|
||||
sessions(config.attribute_value("verbose_sessions", false)),
|
||||
changes(config.attribute_value("verbose_changes", false))
|
||||
|
@ -160,14 +160,14 @@ Session_component::~Session_component() {
|
||||
}
|
||||
|
||||
|
||||
Net::Root::Root(Genode::Env &env,
|
||||
Net::Nic &nic,
|
||||
Genode::Allocator &md_alloc,
|
||||
bool const &verbose,
|
||||
Genode::Xml_node config)
|
||||
Net::Root::Root(Genode::Env &env,
|
||||
Net::Nic &nic,
|
||||
Genode::Allocator &md_alloc,
|
||||
bool const &verbose,
|
||||
Genode::Attached_rom_dataspace const &config)
|
||||
:
|
||||
Genode::Root_component<Session_component>(env.ep(), md_alloc),
|
||||
_mac_alloc(Mac_address(config.attribute_value("mac", Mac_address(DEFAULT_MAC)))),
|
||||
_mac_alloc(Mac_address(config.xml().attribute_value("mac", Mac_address(DEFAULT_MAC)))),
|
||||
_env(env),
|
||||
_nic(nic),
|
||||
_config(config),
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <base/log.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/ram_allocator.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <nic/packet_allocator.h>
|
||||
#include <nic_session/rpc_object.h>
|
||||
#include <nic_session/connection.h>
|
||||
@ -205,11 +206,11 @@ class Net::Root : public Genode::Root_component<Net::Session_component>
|
||||
|
||||
enum { DEFAULT_MAC = 0x02 };
|
||||
|
||||
Mac_allocator _mac_alloc;
|
||||
Genode::Env &_env;
|
||||
Net::Nic &_nic;
|
||||
Genode::Xml_node _config;
|
||||
bool const &_verbose;
|
||||
Mac_allocator _mac_alloc;
|
||||
Genode::Env &_env;
|
||||
Net::Nic &_nic;
|
||||
Genode::Attached_rom_dataspace const &_config;
|
||||
bool const &_verbose;
|
||||
|
||||
protected:
|
||||
|
||||
@ -218,7 +219,7 @@ class Net::Root : public Genode::Root_component<Net::Session_component>
|
||||
using namespace Genode;
|
||||
|
||||
Session_label const label { label_from_args(args) };
|
||||
Session_policy const policy { label, _config };
|
||||
Session_policy const policy { label, _config.xml() };
|
||||
Mac_address mac { policy.attribute_value("mac", Mac_address()) };
|
||||
|
||||
if (mac == Mac_address()) {
|
||||
@ -251,11 +252,11 @@ class Net::Root : public Genode::Root_component<Net::Session_component>
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Env &env,
|
||||
Net::Nic &nic,
|
||||
Genode::Allocator &md_alloc,
|
||||
bool const &verbose,
|
||||
Genode::Xml_node config);
|
||||
Root(Genode::Env &env,
|
||||
Net::Nic &nic,
|
||||
Genode::Allocator &md_alloc,
|
||||
bool const &verbose,
|
||||
Genode::Attached_rom_dataspace const &config);
|
||||
};
|
||||
|
||||
#endif /* _COMPONENT_H_ */
|
||||
|
@ -34,8 +34,7 @@ struct Main
|
||||
bool const verbose { config.xml().attribute_value("verbose", false) };
|
||||
Net::Nic nic { env, heap, vlan, verbose,
|
||||
nic_label };
|
||||
Net::Root root { env, nic, heap, verbose,
|
||||
config.xml() };
|
||||
Net::Root root { env, nic, heap, verbose, config };
|
||||
|
||||
Main(Genode::Env &e) : env(e)
|
||||
{
|
||||
|
@ -59,11 +59,11 @@ Session_component_base(Ram_allocator &ram,
|
||||
** Session_component **
|
||||
***********************/
|
||||
|
||||
Net::Session_component::Session_component(Ram_quota const ram_quota,
|
||||
Cap_quota const cap_quota,
|
||||
size_t const tx_buf_size,
|
||||
size_t const rx_buf_size,
|
||||
Xml_node const config,
|
||||
Net::Session_component::Session_component(Ram_quota const ram_quota,
|
||||
Cap_quota const cap_quota,
|
||||
size_t const tx_buf_size,
|
||||
size_t const rx_buf_size,
|
||||
Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Duration &curr_time,
|
||||
Env &env)
|
||||
@ -112,13 +112,13 @@ void Session_component::_handle_link_state()
|
||||
|
||||
Net::Root::Root(Env &env,
|
||||
Allocator &alloc,
|
||||
Xml_node config,
|
||||
Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Duration &curr_time)
|
||||
:
|
||||
Root_component<Session_component, Genode::Single_client>(&env.ep().rpc_ep(),
|
||||
&alloc),
|
||||
_env(env), _config(config), _timer(timer), _curr_time(curr_time)
|
||||
_env(env), _config(alloc, config), _timer(timer), _curr_time(curr_time)
|
||||
{ }
|
||||
|
||||
|
||||
@ -143,7 +143,7 @@ Session_component *Net::Root::_create_session(char const *args)
|
||||
}
|
||||
return new (md_alloc())
|
||||
Session_component(Ram_quota{ram_quota.value},
|
||||
cap_quota, tx_buf_size, rx_buf_size, _config, _timer,
|
||||
cap_quota, tx_buf_size, rx_buf_size, _config.xml, _timer,
|
||||
_curr_time, _env);
|
||||
}
|
||||
catch (...) { throw Service_denied(); }
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <nic/packet_allocator.h>
|
||||
#include <nic_session/rpc_object.h>
|
||||
#include <base/heap.h>
|
||||
#include <os/buffered_xml.h>
|
||||
|
||||
/* local includes */
|
||||
#include <interface.h>
|
||||
@ -94,14 +95,14 @@ class Net::Session_component : private Session_component_base,
|
||||
|
||||
public:
|
||||
|
||||
Session_component(Genode::Ram_quota ram_quota,
|
||||
Genode::Cap_quota cap_quota,
|
||||
Genode::size_t tx_buf_size,
|
||||
Genode::size_t rx_buf_size,
|
||||
Genode::Xml_node config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
Genode::Env &env);
|
||||
Session_component(Genode::Ram_quota ram_quota,
|
||||
Genode::Cap_quota cap_quota,
|
||||
Genode::size_t tx_buf_size,
|
||||
Genode::size_t rx_buf_size,
|
||||
Genode::Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
Genode::Env &env);
|
||||
|
||||
|
||||
/******************
|
||||
@ -120,10 +121,10 @@ class Net::Root : public Genode::Root_component<Session_component,
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
Genode::Xml_node _config;
|
||||
Timer::Connection &_timer;
|
||||
Genode::Duration &_curr_time;
|
||||
Genode::Env &_env;
|
||||
Genode::Buffered_xml const _config;
|
||||
Timer::Connection &_timer;
|
||||
Genode::Duration &_curr_time;
|
||||
|
||||
|
||||
/********************
|
||||
@ -134,11 +135,11 @@ class Net::Root : public Genode::Root_component<Session_component,
|
||||
|
||||
public:
|
||||
|
||||
Root(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Xml_node config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time);
|
||||
Root(Genode::Env &env,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time);
|
||||
};
|
||||
|
||||
#endif /* _COMPONENT_H_ */
|
||||
|
@ -96,7 +96,7 @@ Net::Interface::Interface(Entrypoint &ep,
|
||||
Timer::Connection &timer,
|
||||
Duration &curr_time,
|
||||
bool log_time,
|
||||
Xml_node config)
|
||||
Xml_node const &config)
|
||||
:
|
||||
_sink_ack { ep, *this, &Interface::_ack_avail },
|
||||
_sink_submit { ep, *this, &Interface::_ready_to_submit },
|
||||
|
@ -79,12 +79,12 @@ class Net::Interface
|
||||
|
||||
public:
|
||||
|
||||
Interface(Genode::Entrypoint &ep,
|
||||
Interface_label label,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
bool log_time,
|
||||
Genode::Xml_node config);
|
||||
Interface(Genode::Entrypoint &ep,
|
||||
Interface_label label,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
bool log_time,
|
||||
Genode::Xml_node const &config);
|
||||
|
||||
virtual ~Interface() { }
|
||||
|
||||
|
@ -23,7 +23,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
Net::Uplink::Uplink(Env &env,
|
||||
Xml_node config,
|
||||
Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Duration &curr_time,
|
||||
Allocator &alloc)
|
||||
|
@ -44,11 +44,11 @@ class Net::Uplink : public Nic::Packet_allocator,
|
||||
|
||||
public:
|
||||
|
||||
Uplink(Genode::Env &env,
|
||||
Genode::Xml_node config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
Genode::Allocator &alloc);
|
||||
Uplink(Genode::Env &env,
|
||||
Genode::Xml_node const &config,
|
||||
Timer::Connection &timer,
|
||||
Genode::Duration &curr_time,
|
||||
Genode::Allocator &alloc);
|
||||
};
|
||||
|
||||
#endif /* _UPLINK_H_ */
|
||||
|
@ -27,7 +27,7 @@ using namespace Genode;
|
||||
** Configuration **
|
||||
*******************/
|
||||
|
||||
Configuration::Configuration(Xml_node const node,
|
||||
Configuration::Configuration(Xml_node const &node,
|
||||
Allocator &alloc)
|
||||
:
|
||||
_alloc { alloc },
|
||||
@ -47,7 +47,7 @@ Configuration::Configuration(Xml_node const node,
|
||||
_tcp_idle_timeout { 0 },
|
||||
_tcp_max_segm_lifetime { 0 },
|
||||
_arp_request_timeout { 0 },
|
||||
_node { node }
|
||||
_node { alloc, node }
|
||||
{ }
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ Configuration::_init_icmp_type_3_code_on_fragm_ipv4(Xml_node const &node) const
|
||||
|
||||
|
||||
Configuration::Configuration(Env &env,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
Allocator &alloc,
|
||||
Signal_context_capability const &report_signal_cap,
|
||||
Cached_timer &timer,
|
||||
@ -107,7 +107,7 @@ Configuration::Configuration(Env &env,
|
||||
_tcp_idle_timeout { read_sec_attr(node, "tcp_idle_timeout_sec", 600) },
|
||||
_tcp_max_segm_lifetime { read_sec_attr(node, "tcp_max_segm_lifetime_sec", 15) },
|
||||
_arp_request_timeout { read_sec_attr(node, "arp_request_timeout_sec", 10) },
|
||||
_node { node }
|
||||
_node { alloc, node }
|
||||
{
|
||||
/* do parts of domain initialization that do not lookup other domains */
|
||||
node.for_each_sub_node("domain", [&] (Xml_node const node) {
|
||||
@ -178,7 +178,7 @@ Configuration::Configuration(Env &env,
|
||||
*_reporter_ptr, report_signal_cap);
|
||||
});
|
||||
/* initialize NIC clients */
|
||||
_node.for_each_sub_node("nic-client", [&] (Xml_node const node) {
|
||||
_node.xml.for_each_sub_node("nic-client", [&] (Xml_node const &node) {
|
||||
Session_label const label {
|
||||
node.attribute_value("label", Session_label::String { }) };
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/duration.h>
|
||||
#include <os/buffered_xml.h>
|
||||
|
||||
namespace Genode { class Allocator; }
|
||||
|
||||
@ -49,12 +50,12 @@ class Net::Configuration
|
||||
Genode::Microseconds const _udp_idle_timeout;
|
||||
Genode::Microseconds const _tcp_idle_timeout;
|
||||
Genode::Microseconds const _tcp_max_segm_lifetime;
|
||||
Genode::Microseconds const _arp_request_timeout;
|
||||
Genode::Microseconds const _arp_request_timeout;
|
||||
Genode::Constructible<Report> _report { };
|
||||
Genode::Reporter *_reporter_ptr { };
|
||||
Domain_dict _domains { };
|
||||
Nic_client_dict _nic_clients { };
|
||||
Genode::Xml_node const _node;
|
||||
Genode::Buffered_xml const _node;
|
||||
|
||||
/*
|
||||
* Noncopyable
|
||||
@ -70,11 +71,11 @@ class Net::Configuration
|
||||
|
||||
public:
|
||||
|
||||
Configuration(Genode::Xml_node const node,
|
||||
Configuration(Genode::Xml_node const &node,
|
||||
Genode::Allocator &alloc);
|
||||
|
||||
Configuration(Genode::Env &env,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Allocator &alloc,
|
||||
Genode::Signal_context_capability const &report_signal_cap,
|
||||
Cached_timer &timer,
|
||||
@ -108,7 +109,8 @@ class Net::Configuration
|
||||
Genode::Microseconds tcp_max_segm_lifetime() const { return _tcp_max_segm_lifetime; }
|
||||
Genode::Microseconds arp_request_timeout() const { return _arp_request_timeout; }
|
||||
Domain_dict &domains() { return _domains; }
|
||||
Genode::Xml_node node() const { return _node; }
|
||||
|
||||
void with_node(auto const &fn) const { fn(_node.xml); }
|
||||
};
|
||||
|
||||
#endif /* _CONFIGURATION_H_ */
|
||||
|
@ -95,7 +95,7 @@ bool Dhcp_server::dns_servers_empty() const
|
||||
}
|
||||
|
||||
|
||||
Dhcp_server::Dhcp_server(Xml_node const node, Allocator &alloc)
|
||||
Dhcp_server::Dhcp_server(Xml_node const &node, Allocator &alloc)
|
||||
:
|
||||
Dhcp_server_base(alloc),
|
||||
_ip_lease_time (_init_ip_lease_time(node)),
|
||||
@ -107,7 +107,7 @@ Dhcp_server::Dhcp_server(Xml_node const node, Allocator &alloc)
|
||||
{ }
|
||||
|
||||
|
||||
bool Dhcp_server::finish_construction(Xml_node const node,
|
||||
bool Dhcp_server::finish_construction(Xml_node const &node,
|
||||
Domain_dict &domains,
|
||||
Domain &domain,
|
||||
Ipv4_address_prefix const &interface)
|
||||
@ -139,7 +139,7 @@ bool Dhcp_server::finish_construction(Xml_node const node,
|
||||
}
|
||||
|
||||
|
||||
Microseconds Dhcp_server::_init_ip_lease_time(Xml_node const node)
|
||||
Microseconds Dhcp_server::_init_ip_lease_time(Xml_node const &node)
|
||||
{
|
||||
uint64_t ip_lease_time_sec =
|
||||
node.attribute_value("ip_lease_time_sec", (uint64_t)0);
|
||||
|
@ -78,7 +78,7 @@ class Net::Dhcp_server : private Genode::Noncopyable,
|
||||
Genode::uint32_t const _ip_count;
|
||||
Genode::Bit_allocator_dynamic _ip_alloc;
|
||||
|
||||
Genode::Microseconds _init_ip_lease_time(Genode::Xml_node const node);
|
||||
Genode::Microseconds _init_ip_lease_time(Genode::Xml_node const &node);
|
||||
|
||||
Ipv4_config const &_resolve_dns_config_from() const;
|
||||
|
||||
@ -94,10 +94,10 @@ class Net::Dhcp_server : private Genode::Noncopyable,
|
||||
|
||||
struct Invalid : Genode::Exception { };
|
||||
|
||||
Dhcp_server(Genode::Xml_node const node,
|
||||
Dhcp_server(Genode::Xml_node const &node,
|
||||
Genode::Allocator &alloc);
|
||||
|
||||
[[nodiscard]] bool finish_construction(Genode::Xml_node const node,
|
||||
[[nodiscard]] bool finish_construction(Genode::Xml_node const &node,
|
||||
Domain_dict &domains,
|
||||
Domain &domain,
|
||||
Ipv4_address_prefix const &interface);
|
||||
|
@ -167,12 +167,12 @@ void Domain::try_reuse_ip_config(Domain const &domain)
|
||||
|
||||
bool Domain::_read_forward_rules(Cstring const &protocol,
|
||||
Domain_dict &domains,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
char const *type,
|
||||
Forward_rule_tree &rules)
|
||||
{
|
||||
bool result = true;
|
||||
node.for_each_sub_node(type, [&] (Xml_node const node) {
|
||||
node.for_each_sub_node(type, [&] (Xml_node const &node) {
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@ -209,12 +209,12 @@ bool Domain::_invalid(char const *reason) const
|
||||
|
||||
bool Domain::_read_transport_rules(Cstring const &protocol,
|
||||
Domain_dict &domains,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
char const *type,
|
||||
Transport_rule_list &rules)
|
||||
{
|
||||
bool result = true;
|
||||
node.for_each_sub_node(type, [&] (Xml_node const node) {
|
||||
node.for_each_sub_node(type, [&] (Xml_node const &node) {
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@ -254,7 +254,7 @@ Domain::Domain(Configuration &config,
|
||||
:
|
||||
Domain_dict::Element { domains, name },
|
||||
_config { config },
|
||||
_node { node },
|
||||
_node { alloc, node },
|
||||
_alloc { alloc },
|
||||
_ip_config { node, alloc },
|
||||
_verbose_packets { node.attribute_value("verbose_packets",
|
||||
@ -265,7 +265,7 @@ Domain::Domain(Configuration &config,
|
||||
config.trace_packets()) },
|
||||
_icmp_echo_server { node.attribute_value("icmp_echo_server",
|
||||
config.icmp_echo_server()) },
|
||||
_use_arp { _node.attribute_value("use_arp", true) },
|
||||
_use_arp { node.attribute_value("use_arp", true) },
|
||||
_label { node.attribute_value("label",
|
||||
String<160>()).string() }
|
||||
{
|
||||
@ -306,7 +306,7 @@ bool Domain::init(Domain_dict &domains)
|
||||
{
|
||||
/* read DHCP server configuration */
|
||||
bool result = true;
|
||||
_node.with_optional_sub_node("dhcp-server", [&] (Xml_node const &dhcp_server_node) {
|
||||
_node.xml.with_optional_sub_node("dhcp-server", [&] (Xml_node const &dhcp_server_node) {
|
||||
if (_ip_config_dynamic) {
|
||||
result = _invalid("DHCP server and client at once");
|
||||
return;
|
||||
@ -327,14 +327,14 @@ bool Domain::init(Domain_dict &domains)
|
||||
return result;
|
||||
|
||||
/* read forward and transport rules */
|
||||
if (!_read_forward_rules(tcp_name(), domains, _node, "tcp-forward", _tcp_forward_rules) ||
|
||||
!_read_forward_rules(udp_name(), domains, _node, "udp-forward", _udp_forward_rules) ||
|
||||
!_read_transport_rules(tcp_name(), domains, _node, "tcp", _tcp_rules) ||
|
||||
!_read_transport_rules(udp_name(), domains, _node, "udp", _udp_rules))
|
||||
if (!_read_forward_rules(tcp_name(), domains, _node.xml, "tcp-forward", _tcp_forward_rules) ||
|
||||
!_read_forward_rules(udp_name(), domains, _node.xml, "udp-forward", _udp_forward_rules) ||
|
||||
!_read_transport_rules(tcp_name(), domains, _node.xml, "tcp", _tcp_rules) ||
|
||||
!_read_transport_rules(udp_name(), domains, _node.xml, "udp", _udp_rules))
|
||||
return false;
|
||||
|
||||
/* read NAT rules */
|
||||
_node.for_each_sub_node("nat", [&] (Xml_node const node) {
|
||||
_node.xml.for_each_sub_node("nat", [&] (Xml_node const &node) {
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@ -352,7 +352,7 @@ bool Domain::init(Domain_dict &domains)
|
||||
return result;
|
||||
|
||||
/* read ICMP rules */
|
||||
_node.for_each_sub_node("icmp", [&] (Xml_node const node) {
|
||||
_node.xml.for_each_sub_node("icmp", [&] (Xml_node const &node) {
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@ -366,7 +366,7 @@ bool Domain::init(Domain_dict &domains)
|
||||
[&] { result = _invalid("invalid ICMP rule"); });
|
||||
});
|
||||
/* read IP rules */
|
||||
_node.for_each_sub_node("ip", [&] (Xml_node const node) {
|
||||
_node.xml.for_each_sub_node("ip", [&] (Xml_node const &node) {
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/reconstructible.h>
|
||||
#include <os/buffered_xml.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
@ -90,7 +91,7 @@ class Net::Domain : public List<Domain>::Element,
|
||||
private:
|
||||
|
||||
Configuration &_config;
|
||||
Genode::Xml_node _node;
|
||||
Genode::Buffered_xml const _node;
|
||||
Genode::Allocator &_alloc;
|
||||
Ip_rule_list _ip_rules { };
|
||||
Forward_rule_tree _tcp_forward_rules { };
|
||||
@ -130,13 +131,13 @@ class Net::Domain : public List<Domain>::Element,
|
||||
|
||||
[[nodiscard]] bool _read_forward_rules(Genode::Cstring const &protocol,
|
||||
Domain_dict &domains,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
char const *type,
|
||||
Forward_rule_tree &rules);
|
||||
|
||||
[[nodiscard]] bool _read_transport_rules(Genode::Cstring const &protocol,
|
||||
Domain_dict &domains,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
char const *type,
|
||||
Transport_rule_list &rules);
|
||||
|
||||
|
@ -36,7 +36,7 @@ Nat_rule::Nat_rule(Domain &domain,
|
||||
Port_allocator &tcp_port_alloc,
|
||||
Port_allocator &udp_port_alloc,
|
||||
Port_allocator &icmp_port_alloc,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
bool const verbose)
|
||||
:
|
||||
_domain { domain },
|
||||
|
@ -48,7 +48,7 @@ class Net::Nat_rule : public Genode::Avl_node<Nat_rule>
|
||||
Port_allocator &tcp_port_alloc,
|
||||
Port_allocator &udp_port_alloc,
|
||||
Port_allocator &icmp_port_alloc,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
bool const verbose);
|
||||
|
||||
Nat_rule &find_by_domain(Domain &domain);
|
||||
|
@ -62,10 +62,12 @@ Net::Nic_session_component::Interface_policy::determine_domain_name() const
|
||||
{
|
||||
Domain_name domain_name { };
|
||||
try {
|
||||
Session_policy policy(_label, _config_ptr->node());
|
||||
domain_name = policy.attribute_value("domain", Domain_name());
|
||||
if (domain_name == Domain_name() && _config_ptr->verbose())
|
||||
log("[?] no domain attribute in policy for downlink label \"", _label, "\"");
|
||||
_config_ptr->with_node([&] (Xml_node const &node) {
|
||||
Session_policy policy(_label, node);
|
||||
domain_name = policy.attribute_value("domain", Domain_name());
|
||||
if (domain_name == Domain_name() && _config_ptr->verbose())
|
||||
log("[?] no domain attribute in policy for downlink label \"", _label, "\"");
|
||||
});
|
||||
}
|
||||
catch (Session_policy::No_policy_defined) {
|
||||
if (_config_ptr->verbose()) {
|
||||
|
@ -21,7 +21,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
Net::Report::Report(bool const &verbose,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
Cached_timer &timer,
|
||||
Domain_dict &domains,
|
||||
Quota const &shared_quota,
|
||||
|
@ -66,7 +66,7 @@ class Net::Report
|
||||
public:
|
||||
|
||||
Report(bool const &verbose,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
Cached_timer &timer,
|
||||
Domain_dict &domains,
|
||||
Quota const &shared_quota,
|
||||
|
@ -33,7 +33,7 @@ Transport_rule::Transport_rule(Ipv4_address_prefix const &dst,
|
||||
|
||||
|
||||
bool Transport_rule::finish_construction(Domain_dict &domains,
|
||||
Xml_node const node,
|
||||
Xml_node const &node,
|
||||
Cstring const &protocol,
|
||||
Configuration &config,
|
||||
Domain const &local_domain)
|
||||
@ -57,7 +57,7 @@ bool Transport_rule::finish_construction(Domain_dict &domains,
|
||||
return true;
|
||||
}
|
||||
/* read specific permit rules */
|
||||
node.for_each_sub_node("permit", [&] (Xml_node const permit_node) {
|
||||
node.for_each_sub_node("permit", [&] (Xml_node const &permit_node) {
|
||||
if (error)
|
||||
return;
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Net::Transport_rule : public Direct_rule<Transport_rule>
|
||||
|
||||
static Permit_any_rule *
|
||||
_read_permit_any_rule(Domain_dict &domains,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Allocator &alloc);
|
||||
|
||||
/*
|
||||
@ -68,7 +68,7 @@ class Net::Transport_rule : public Direct_rule<Transport_rule>
|
||||
}
|
||||
|
||||
[[nodiscard]] bool finish_construction(Domain_dict &domains,
|
||||
Genode::Xml_node const node,
|
||||
Genode::Xml_node const &node,
|
||||
Genode::Cstring const &protocol,
|
||||
Configuration &config,
|
||||
Domain const &domain);
|
||||
|
@ -60,10 +60,12 @@ Net::Uplink_session_component::Interface_policy::determine_domain_name() const
|
||||
{
|
||||
Domain_name domain_name;
|
||||
try {
|
||||
Session_policy policy(_label, _config_ptr->node());
|
||||
domain_name = policy.attribute_value("domain", Domain_name());
|
||||
if (domain_name == Domain_name() && _config_ptr->verbose())
|
||||
log("[?] no domain attribute in policy for downlink label \"", _label, "\"");
|
||||
_config_ptr->with_node([&] (Xml_node const &node) {
|
||||
Session_policy policy(_label, node);
|
||||
domain_name = policy.attribute_value("domain", Domain_name());
|
||||
if (domain_name == Domain_name() && _config_ptr->verbose())
|
||||
log("[?] no domain attribute in policy for downlink label \"", _label, "\"");
|
||||
});
|
||||
}
|
||||
catch (Session_policy::No_policy_defined) {
|
||||
if (_config_ptr->verbose()) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Microseconds Genode::read_sec_attr(Xml_node const node,
|
||||
Microseconds Genode::read_sec_attr(Xml_node const &node,
|
||||
char const *name,
|
||||
uint64_t const default_sec)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
Microseconds read_sec_attr(Xml_node const node,
|
||||
Microseconds read_sec_attr(Xml_node const &node,
|
||||
char const *name,
|
||||
uint64_t const default_sec);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user