1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +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:
Andreas Kling 2021-09-07 12:09:52 +02:00
parent 7bf8844499
commit b481132418
29 changed files with 85 additions and 118 deletions

View file

@ -93,8 +93,7 @@ KResultOr<size_t> StorageDevice::read(FileDescription&, u64 offset, UserOrKernel
default:
break;
}
if (!outbuf.write(data.data(), pos, remaining))
return EFAULT;
TRY(outbuf.write(data.data(), pos, remaining));
}
return pos + remaining;
@ -166,8 +165,7 @@ KResultOr<size_t> StorageDevice::write(FileDescription&, u64 offset, const UserO
}
}
if (!inbuf.read(data.data(), pos, remaining))
return EFAULT;
TRY(inbuf.read(data.data(), pos, remaining));
{
auto write_request = make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Write, index + whole_blocks, 1, data_buffer, block_size());