mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
Kernel: Make File::write() and File::read() return KResultOr<size_t>
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
This commit is contained in:
parent
58feebeed2
commit
7a3ab6c517
58 changed files with 223 additions and 229 deletions
|
@ -80,7 +80,7 @@ void PATADiskDevice::set_drive_geometry(u16 cyls, u16 heads, u16 spt)
|
|||
m_sectors_per_track = spt;
|
||||
}
|
||||
|
||||
ssize_t PATADiskDevice::read(FileDescription&, size_t offset, u8* outbuf, ssize_t len)
|
||||
KResultOr<size_t> PATADiskDevice::read(FileDescription&, size_t offset, u8* outbuf, size_t len)
|
||||
{
|
||||
unsigned index = offset / block_size();
|
||||
u16 whole_blocks = len / block_size();
|
||||
|
@ -121,7 +121,7 @@ bool PATADiskDevice::can_read(const FileDescription&, size_t offset) const
|
|||
return offset < (m_cylinders * m_heads * m_sectors_per_track * block_size());
|
||||
}
|
||||
|
||||
ssize_t PATADiskDevice::write(FileDescription&, size_t offset, const u8* inbuf, ssize_t len)
|
||||
KResultOr<size_t> PATADiskDevice::write(FileDescription&, size_t offset, const u8* inbuf, size_t len)
|
||||
{
|
||||
unsigned index = offset / block_size();
|
||||
u16 whole_blocks = len / block_size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue