diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-07 12:09:52 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-07 13:53:14 +0200 |
commit | b4811324183cc64bd671f93c889fa5e6590e0182 (patch) | |
tree | 083ec95329a20fbcf74f78ce8ea2bf3c9a4055b8 /Kernel/FileSystem/BlockBasedFileSystem.cpp | |
parent | 7bf88444993a72f588ce3bd849042c3420e222a7 (diff) | |
download | serenity-b4811324183cc64bd671f93c889fa5e6590e0182.zip |
Kernel: Make UserOrKernelBuffer return KResult from read/write/memset
This allows us to simplify a whole bunch of call sites with TRY(). :^)
Diffstat (limited to 'Kernel/FileSystem/BlockBasedFileSystem.cpp')
-rw-r--r-- | Kernel/FileSystem/BlockBasedFileSystem.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 5254364e58..cfc02a650b 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -156,8 +156,7 @@ KResult BlockBasedFileSystem::write_block(BlockIndex index, const UserOrKernelBu // Fill the cache first. TRY(read_block(index, nullptr, block_size())); } - if (!data.read(entry.data + offset, count)) - return EFAULT; + TRY(data.read(entry.data + offset, count)); cache->mark_dirty(entry); entry.has_data = true; @@ -238,8 +237,8 @@ KResult BlockBasedFileSystem::read_block(BlockIndex index, UserOrKernelBuffer* b VERIFY(nread == block_size()); entry.has_data = true; } - if (buffer && !buffer->write(entry.data + offset, count)) - return EFAULT; + if (buffer) + TRY(buffer->write(entry.data + offset, count)); return KSuccess; }); } |