mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 03:06:39 +00:00
parent
8ced0f184e
commit
95d9c15607
@ -234,12 +234,18 @@ void Libc::Vfs_plugin::_with_info(File_descriptor &fd, FN const &fn)
|
||||
path.append_element("info");
|
||||
|
||||
try {
|
||||
File_content const content(_alloc, *_root_dir, path.string(),
|
||||
File_content::Limit{4096U});
|
||||
|
||||
content.xml([&] (Xml_node node) {
|
||||
fn(node); });
|
||||
|
||||
/*
|
||||
* Opening the info file repeatedly could be too expensive if
|
||||
* file system servers are part of the VFS, because the directory
|
||||
* status of the path would be checked at each VFS plugin every
|
||||
* time. So, we open the file only once.
|
||||
*/
|
||||
static Readonly_file file { *_root_dir, path.string() };
|
||||
static char buffer[4096];
|
||||
Byte_range_ptr range(buffer,
|
||||
min((size_t)(_root_dir->file_size(path.string())),
|
||||
sizeof(buffer)));
|
||||
with_xml_file_content(file, range, [&] (Xml_node node) { fn(node); });
|
||||
} catch (...) { }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user