mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 21:57:55 +00:00
fs_query: report 'writeable' attribute for files
This commit is contained in:
parent
7118ad494c
commit
b2bc718c1f
@ -10,7 +10,7 @@
|
||||
[init -> report_rom] report 'test -> fs_query -> listing'
|
||||
[init -> report_rom] <listing>
|
||||
[init -> report_rom] <dir path="/fs/items">
|
||||
[init -> report_rom] <file name="1">first</file>
|
||||
[init -> report_rom] <file name="1" writeable="yes">first</file>
|
||||
[init -> report_rom] </dir>
|
||||
[init -> report_rom] </listing>
|
||||
</log>
|
||||
|
@ -190,9 +190,9 @@ regsub {.*report 'fs_query -> listing'} $output {} output
|
||||
compare_output_to {
|
||||
[init -> report_rom] <listing>
|
||||
[init -> report_rom] <dir path="/fs/items">
|
||||
[init -> report_rom] <file name="4">fourth</file>
|
||||
[init -> report_rom] <file name="1">first</file>
|
||||
[init -> report_rom] <file name="3">updated
|
||||
[init -> report_rom] <file name="4" writeable="yes">fourth</file>
|
||||
[init -> report_rom] <file name="1" writeable="yes">first</file>
|
||||
[init -> report_rom] <file name="3" writeable="yes">updated
|
||||
[init -> report_rom] </file>
|
||||
[init -> report_rom] </dir>
|
||||
[init -> report_rom] </listing>
|
||||
|
@ -24,6 +24,7 @@ namespace Fs_query {
|
||||
struct Watched_file;
|
||||
struct Watched_directory;
|
||||
struct Main;
|
||||
using Node_rwx = Vfs::Node_rwx;
|
||||
}
|
||||
|
||||
|
||||
@ -31,11 +32,13 @@ struct Fs_query::Watched_file
|
||||
{
|
||||
File_content::Path const _name;
|
||||
|
||||
Node_rwx const _rwx;
|
||||
|
||||
Watcher _watcher;
|
||||
|
||||
Watched_file(Directory const &dir, File_content::Path name,
|
||||
Watched_file(Directory const &dir, File_content::Path name, Node_rwx rwx,
|
||||
Vfs::Watch_response_handler &handler)
|
||||
: _name(name), _watcher(dir, name, handler) { }
|
||||
: _name(name), _rwx(rwx), _watcher(dir, name, handler) { }
|
||||
|
||||
virtual ~Watched_file() { }
|
||||
|
||||
@ -68,6 +71,9 @@ struct Fs_query::Watched_file
|
||||
xml.node("file", [&] () {
|
||||
xml.attribute("name", _name);
|
||||
|
||||
if (_rwx.writeable)
|
||||
xml.attribute("writeable", "yes");
|
||||
|
||||
if (query.attribute_value("content", false))
|
||||
_gen_content(xml, alloc, dir);
|
||||
});
|
||||
@ -110,7 +116,8 @@ struct Fs_query::Watched_directory
|
||||
|| (entry.type() == Dirent_type::TRANSACTIONAL_FILE);
|
||||
if (file) {
|
||||
try {
|
||||
new (_alloc) Registered<Watched_file>(_files, _dir, entry.name(), handler);
|
||||
new (_alloc) Registered<Watched_file>(_files, _dir, entry.name(),
|
||||
entry.rwx(), handler);
|
||||
} catch (...) { }
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user