diff options
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/FileDescription.cpp | 14 | ||||
-rw-r--r-- | Kernel/FileSystem/FileDescription.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index 5d14f6f6dc..46ffbca86b 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -202,21 +202,21 @@ KResultOr<NonnullOwnPtr<KBuffer>> FileDescription::read_entire_file() return m_inode->read_entire(this); } -ssize_t FileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, ssize_t size) +KResultOr<ssize_t> FileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, ssize_t size) { Locker locker(m_lock, Lock::Mode::Shared); if (!is_directory()) - return -ENOTDIR; + return ENOTDIR; auto metadata = this->metadata(); if (!metadata.is_valid()) - return -EIO; + return EIO; if (size < 0) - return -EINVAL; + return EINVAL; size_t remaining = size; - ssize_t error = 0; + KResult error = KSuccess; u8 stack_buffer[PAGE_SIZE]; Bytes temp_buffer(stack_buffer, sizeof(stack_buffer)); OutputMemoryStream stream { temp_buffer }; @@ -227,10 +227,10 @@ ssize_t FileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, ssiz if (stream.size() == 0) return true; if (remaining < stream.size()) { - error = -EINVAL; + error = EINVAL; return false; } else if (!output_buffer.write(stream.bytes())) { - error = -EFAULT; + error = EFAULT; return false; } output_buffer = output_buffer.offset(stream.size()); diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h index 47efdec69c..8be270218d 100644 --- a/Kernel/FileSystem/FileDescription.h +++ b/Kernel/FileSystem/FileDescription.h @@ -56,7 +56,7 @@ public: bool can_read() const; bool can_write() const; - ssize_t get_dir_entries(UserOrKernelBuffer& buffer, ssize_t); + KResultOr<ssize_t> get_dir_entries(UserOrKernelBuffer& buffer, ssize_t); KResultOr<NonnullOwnPtr<KBuffer>> read_entire_file(); |