mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-23 08:06:11 +00:00
Kernel: Tidy up IDEDiskDevice a bit.
The main cleanup here is putting the I/O address base in a member variable.
This commit is contained in:
@@ -14,9 +14,7 @@ bool DiskDevice::read(DiskOffset offset, unsigned length, byte* out) const
|
||||
ASSERT((length % block_size()) == 0);
|
||||
dword first_block = offset / block_size();
|
||||
dword end_block = (offset + length) / block_size();
|
||||
byte* outptr = out;
|
||||
|
||||
return const_cast<DiskDevice*>(this)->read_blocks(first_block, end_block - first_block, outptr);
|
||||
return const_cast<DiskDevice*>(this)->read_blocks(first_block, end_block - first_block, out);
|
||||
}
|
||||
|
||||
bool DiskDevice::write(DiskOffset offset, unsigned length, const byte* in)
|
||||
@@ -27,12 +25,6 @@ bool DiskDevice::write(DiskOffset offset, unsigned length, const byte* in)
|
||||
dword end_block = (offset + length) / block_size();
|
||||
ASSERT(first_block <= 0xffffffff);
|
||||
ASSERT(end_block <= 0xffffffff);
|
||||
const byte* inptr = in;
|
||||
for (unsigned bi = first_block; bi < end_block; ++bi) {
|
||||
if (!write_block(bi, inptr))
|
||||
return false;
|
||||
inptr += block_size();
|
||||
}
|
||||
return true;
|
||||
return write_blocks(first_block, end_block - first_block, in);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user