mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-31 22:50:54 +00:00
vfs: dynamic configuration support
This commit is contained in:
parent
8025f5f570
commit
aa602032dd
@ -97,7 +97,7 @@ install_config $config
|
|||||||
# generic modules
|
# generic modules
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core ld.lib.so init timer
|
core ld.lib.so init timer
|
||||||
libc.lib.so lxip.lib.so test-lxip_http_srv libc_resolv.lib.so
|
libc.lib.so libm.lib.so lxip.lib.so test-lxip_http_srv libc_resolv.lib.so
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
|
@ -173,6 +173,7 @@ class Vfs::Rump_file_system : public File_system
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
static char const *name() { return "rump"; }
|
static char const *name() { return "rump"; }
|
||||||
|
char const *type() override { return "rump"; }
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
@ -66,6 +66,7 @@ class Jitterentropy_file_system : public Vfs::Single_file_system
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char const *name() { return "jitterentropy"; }
|
static char const *name() { return "jitterentropy"; }
|
||||||
|
char const *type() override { return "jitterentropy"; }
|
||||||
|
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
|
@ -563,6 +563,7 @@ class Vfs::Dir_file_system : public File_system
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
char const *name() const { return "dir"; }
|
char const *name() const { return "dir"; }
|
||||||
|
char const *type() override { return "dir"; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize all file systems
|
* Synchronize all file systems
|
||||||
@ -583,6 +584,25 @@ class Vfs::Dir_file_system : public File_system
|
|||||||
fs->sync(path);
|
fs->sync(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void apply_config(Genode::Xml_node const &node) override
|
||||||
|
{
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
|
File_system *curr = _first_file_system;
|
||||||
|
for (unsigned i = 0; i < node.num_sub_nodes(); i++, curr = curr->next) {
|
||||||
|
Xml_node const &sub_node = node.sub_node(i);
|
||||||
|
|
||||||
|
/* check if type of XML node matches current file-system type */
|
||||||
|
if (sub_node.has_type(curr->type()) == false) {
|
||||||
|
Genode::error("VFS config update failed (node type '",
|
||||||
|
sub_node.type(), "' != fs type '", curr->type(),"')");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
curr->apply_config(node.sub_node(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** File I/O service interface **
|
** File I/O service interface **
|
||||||
|
@ -35,6 +35,16 @@ struct Vfs::File_system : Directory_service, File_io_service
|
|||||||
* This method flushes any delayed operations from the file system.
|
* This method flushes any delayed operations from the file system.
|
||||||
*/
|
*/
|
||||||
virtual void sync(char const *path) { }
|
virtual void sync(char const *path) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust to configuration changes
|
||||||
|
*/
|
||||||
|
virtual void apply_config(Genode::Xml_node const &node) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the file-system type
|
||||||
|
*/
|
||||||
|
virtual char const *type() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__VFS__FILE_SYSTEM_H_ */
|
#endif /* _INCLUDE__VFS__FILE_SYSTEM_H_ */
|
||||||
|
@ -149,7 +149,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char const *name() { return "block"; }
|
static char const *name() { return "block"; }
|
||||||
|
char const *type() override { return "block"; }
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Directory service interface **
|
** Directory service interface **
|
||||||
|
@ -582,6 +582,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
static char const *name() { return "fs"; }
|
static char const *name() { return "fs"; }
|
||||||
|
char const *type() override { return "fs"; }
|
||||||
|
|
||||||
void sync(char const *path) override
|
void sync(char const *path) override
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ class Vfs::Inline_file_system : public Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "inline"; }
|
static char const *name() { return "inline"; }
|
||||||
|
char const *type() override { return "inline"; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** Directory service interface **
|
** Directory service interface **
|
||||||
|
@ -59,7 +59,7 @@ class Vfs::Log_file_system : public Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static const char *name() { return "log"; }
|
static const char *name() { return "log"; }
|
||||||
|
char const *type() override { return "log"; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** File I/O service interface **
|
** File I/O service interface **
|
||||||
|
@ -31,7 +31,7 @@ struct Vfs::Null_file_system : Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "null"; }
|
static char const *name() { return "null"; }
|
||||||
|
char const *type() override { return "null"; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** File I/O service interface **
|
** File I/O service interface **
|
||||||
|
@ -787,6 +787,7 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
static char const *name() { return "ram"; }
|
static char const *name() { return "ram"; }
|
||||||
|
char const *type() override { return "ram"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__VFS__RAM_FILE_SYSTEM_H_ */
|
#endif /* _INCLUDE__VFS__RAM_FILE_SYSTEM_H_ */
|
||||||
|
@ -59,7 +59,7 @@ class Vfs::Rom_file_system : public Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "rom"; }
|
static char const *name() { return "rom"; }
|
||||||
|
char const *type() override { return "rom"; }
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Directory-service interface **
|
** Directory-service interface **
|
||||||
|
@ -40,7 +40,7 @@ class Vfs::Rtc_file_system : public Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "rtc"; }
|
static char const *name() { return "rtc"; }
|
||||||
|
char const *type() override { return "rtc"; }
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Directory-service interface **
|
** Directory-service interface **
|
||||||
|
@ -41,7 +41,7 @@ class Vfs::Symlink_file_system : public Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "symlink"; }
|
static char const *name() { return "symlink"; }
|
||||||
|
char const *type() override { return "symlink"; }
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Directory-service interface **
|
** Directory-service interface **
|
||||||
|
@ -358,7 +358,6 @@ class Vfs::Tar_file_system : public File_system
|
|||||||
_for_each_tar_record_do(Add_node_action(_alloc, _root_node));
|
_for_each_tar_record_do(Add_node_action(_alloc, _root_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
** Directory-service interface **
|
** Directory-service interface **
|
||||||
*********************************/
|
*********************************/
|
||||||
@ -575,6 +574,7 @@ class Vfs::Tar_file_system : public File_system
|
|||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
static char const *name() { return "tar"; }
|
static char const *name() { return "tar"; }
|
||||||
|
char const *type() override { return "tar"; }
|
||||||
|
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
|
@ -68,7 +68,7 @@ class Vfs::Terminal_file_system : public Single_file_system
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *name() { return "terminal"; }
|
static const char *name() { return "terminal"; }
|
||||||
|
char const *type() override { return "terminal"; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** File I/O service interface **
|
** File I/O service interface **
|
||||||
|
@ -31,7 +31,7 @@ struct Vfs::Zero_file_system : Single_file_system
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
static char const *name() { return "zero"; }
|
static char const *name() { return "zero"; }
|
||||||
|
char const *type() override { return "zero"; }
|
||||||
|
|
||||||
/********************************
|
/********************************
|
||||||
** File I/O service interface **
|
** File I/O service interface **
|
||||||
|
@ -500,6 +500,15 @@ class Vfs_server::Root :
|
|||||||
_env, _heap, vfs_config(), _io_response_handler,
|
_env, _heap, vfs_config(), _io_response_handler,
|
||||||
Vfs::global_file_system_factory() };
|
Vfs::global_file_system_factory() };
|
||||||
|
|
||||||
|
Genode::Signal_handler<Root> _config_dispatcher {
|
||||||
|
_env.ep(), *this, &Root::_config_update };
|
||||||
|
|
||||||
|
void _config_update()
|
||||||
|
{
|
||||||
|
_config_rom.update();
|
||||||
|
_vfs.apply_config(vfs_config());
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Session_component *_create_session(const char *args) override
|
Session_component *_create_session(const char *args) override
|
||||||
@ -603,6 +612,7 @@ class Vfs_server::Root :
|
|||||||
Root_component<Session_component>(&env.ep().rpc_ep(), &md_alloc),
|
Root_component<Session_component>(&env.ep().rpc_ep(), &md_alloc),
|
||||||
_env(env)
|
_env(env)
|
||||||
{
|
{
|
||||||
|
_config_rom.sigh(_config_dispatcher);
|
||||||
env.parent().announce(env.ep().manage(*this));
|
env.parent().announce(env.ep().manage(*this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user