mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 10:44:58 +00:00
Kernel: Make UserOrKernelBuffer return KResult from read/write/memset
This allows us to simplify a whole bunch of call sites with TRY(). :^)
This commit is contained in:
parent
7bf8844499
commit
b481132418
29 changed files with 85 additions and 118 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue