mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +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:
parent
c459e4ecb2
commit
6a74af8063
14 changed files with 54 additions and 36 deletions
|
@ -166,19 +166,19 @@ InodeMetadata TmpFSInode::metadata() const
|
|||
return m_metadata;
|
||||
}
|
||||
|
||||
bool TmpFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)> callback) const
|
||||
KResult TmpFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)> callback) const
|
||||
{
|
||||
LOCKER(m_lock, Lock::Mode::Shared);
|
||||
|
||||
if (!is_directory())
|
||||
return false;
|
||||
return KResult(-ENOTDIR);
|
||||
|
||||
callback({ ".", identifier(), 0 });
|
||||
callback({ "..", m_parent, 0 });
|
||||
|
||||
for (auto& it : m_children)
|
||||
callback(it.value.entry);
|
||||
return true;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, u8* buffer, FileDescription*) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue