summaryrefslogtreecommitdiff
path: root/Kernel/Storage/Partition
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-08 00:51:39 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-08 01:10:53 +0100
commit79fa9765ca89869d19364143989436d117974c21 (patch)
tree3af62f70127d9217d841047f6b7461351800d1ae /Kernel/Storage/Partition
parent7ee10c69264cb278845a1e1b06d5acf2e5e7ddf0 (diff)
downloadserenity-79fa9765ca89869d19364143989436d117974c21.zip
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
Diffstat (limited to 'Kernel/Storage/Partition')
-rw-r--r--Kernel/Storage/Partition/DiskPartition.cpp4
-rw-r--r--Kernel/Storage/Partition/DiskPartition.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/Storage/Partition/DiskPartition.cpp b/Kernel/Storage/Partition/DiskPartition.cpp
index 265d5eb76a..2e81fc9914 100644
--- a/Kernel/Storage/Partition/DiskPartition.cpp
+++ b/Kernel/Storage/Partition/DiskPartition.cpp
@@ -47,7 +47,7 @@ void DiskPartition::start_request(AsyncBlockDeviceRequest& request)
request.add_sub_request(sub_request_or_error.release_value());
}
-KResultOr<size_t> DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrKernelBuffer& outbuf, size_t len)
+ErrorOr<size_t> DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrKernelBuffer& outbuf, size_t len)
{
unsigned adjust = m_metadata.start_block() * block_size();
dbgln_if(OFFD_DEBUG, "DiskPartition::read offset={}, adjust={}, len={}", fd.offset(), adjust, len);
@@ -61,7 +61,7 @@ bool DiskPartition::can_read(const OpenFileDescription& fd, size_t offset) const
return m_device.strong_ref()->can_read(fd, offset + adjust);
}
-KResultOr<size_t> DiskPartition::write(OpenFileDescription& fd, u64 offset, const UserOrKernelBuffer& inbuf, size_t len)
+ErrorOr<size_t> DiskPartition::write(OpenFileDescription& fd, u64 offset, const UserOrKernelBuffer& inbuf, size_t len)
{
unsigned adjust = m_metadata.start_block() * block_size();
dbgln_if(OFFD_DEBUG, "DiskPartition::write offset={}, adjust={}, len={}", offset, adjust, len);
diff --git a/Kernel/Storage/Partition/DiskPartition.h b/Kernel/Storage/Partition/DiskPartition.h
index 4c172785be..8c3e1ec6c1 100644
--- a/Kernel/Storage/Partition/DiskPartition.h
+++ b/Kernel/Storage/Partition/DiskPartition.h
@@ -23,9 +23,9 @@ public:
virtual void start_request(AsyncBlockDeviceRequest&) override;
// ^BlockDevice
- virtual KResultOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
+ virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual bool can_read(const OpenFileDescription&, size_t) const override;
- virtual KResultOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
+ virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const OpenFileDescription&, size_t) const override;
const DiskPartitionMetadata& metadata() const;