1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Kernel: Plumb KResult through FileDescription::read_entire_file() implementation.

Allow file system implementation to return meaningful error codes to
callers of the FileDescription::read_entire_file(). This allows both
Process::sys$readlink() and Process::sys$module_load() to return more
detailed errors to the user.
This commit is contained in:
Brian Gianforcaro 2020-05-26 00:36:11 -07:00 committed by Andreas Kling
parent c459e4ecb2
commit 6a74af8063
14 changed files with 54 additions and 36 deletions

View file

@ -146,10 +146,10 @@ InodeMetadata DevPtsFSInode::metadata() const
return m_metadata;
}
bool DevPtsFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)> callback) const
KResult DevPtsFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)> callback) const
{
if (identifier().index() > 1)
return false;
return KResult(-ENOTDIR);
callback({ ".", 1, identifier(), 0 });
callback({ "..", 2, identifier(), 0 });
@ -160,7 +160,7 @@ bool DevPtsFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry
callback({ name.characters(), name.length(), identifier, 0 });
}
return true;
return KSuccess;
}
size_t DevPtsFSInode::directory_entry_count() const