file system: enhanced file status info

This patch extends the 'File_system::Status',
'File_system::Directory_entry', and the related 'Vfs' types with
the following additional information:

- Distinction between continuous and transactional files (Node_type)
  (issue #3507)
- Readable, writeable, and executable attributes (Node_rwx),
  replacing the former 'mode' bits
  (issue #3030)

The types 'Node_rwx', 'Node_type' are defined twice,
once for the VFS (vfs/types.h) and once for the 'File_system'
session (file_system_session/file_system_session.h).
Similarly, there is a direct correspondance between
'Vfs::Directory_service::Dirent' and 'File_system::Directory_entry'.

This duplication of types follows the existing pattern of keeping the
VFS and file-system session independent from each other.
This commit is contained in:
Norman Feske
2019-09-25 17:13:29 +02:00
committed by Christian Helmuth
parent 1297a8fb57
commit 5ab1505d43
52 changed files with 1049 additions and 668 deletions

View File

@ -107,7 +107,8 @@ class Vfs::Rom_file_system : public Single_file_system
Rom_file_system(Vfs::Env &env,
Genode::Xml_node config)
:
Single_file_system(NODE_TYPE_FILE, name(), config),
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
Node_rwx::ro(), config),
/* use 'label' attribute if present, fall back to 'name' if not */
_label(config.attribute_value("label",
@ -161,10 +162,12 @@ class Vfs::Rom_file_system : public Single_file_system
* found a file), obtain the size of the most current ROM module
* version.
*/
if (out.mode == STAT_MODE_FILE) {
if (out.type == Node_type::CONTINUOUS_FILE) {
_rom.update();
out.size = _rom.valid() ? _rom.size() : 0;
out.mode |= 0555;
out.rwx = { .readable = true,
.writeable = false,
.executable = true };
}
return result;