mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 11:55:24 +00:00
vfs: let rom fs update ROM when opening file
This commit is contained in:
parent
ffaf65efa0
commit
f917728ecb
@ -58,6 +58,26 @@ class Vfs::Rom_file_system : public Single_file_system
|
||||
static char const *name() { return "rom"; }
|
||||
|
||||
|
||||
/*********************************
|
||||
** Directory-service interface **
|
||||
********************************/
|
||||
|
||||
/*
|
||||
* Overwrite the default open function to update the ROM dataspace
|
||||
* each time when opening the corresponding file.
|
||||
*/
|
||||
Open_result open(char const *path, unsigned,
|
||||
Vfs_handle **out_handle) override
|
||||
{
|
||||
Open_result const result =
|
||||
Single_file_system::open(path, 0, out_handle);
|
||||
|
||||
_rom.update();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/********************************
|
||||
** File I/O service interface **
|
||||
********************************/
|
||||
@ -65,7 +85,10 @@ class Vfs::Rom_file_system : public Single_file_system
|
||||
Stat_result stat(char const *path, Stat &out) override
|
||||
{
|
||||
Stat_result result = Single_file_system::stat(path, out);
|
||||
out.size = _rom.size();
|
||||
|
||||
_rom.update();
|
||||
out.size = _rom.is_valid() ? _rom.size() : 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user