Rework DiskDevice's read() and write() to be non-virtual wrappers.

This way subclasses only have to implement readBlock() and writeBlock().
read() and write() require that the offset and length are both divisible
by the blockSize().
This commit is contained in:
Andreas Kling 2018-10-16 14:11:58 +02:00
parent cafb5b2ad6
commit 8293a0ff36
Notes: sideshowbarker 2024-07-19 18:47:22 +09:00
5 changed files with 47 additions and 10 deletions

View file

@ -965,8 +965,8 @@ InodeIdentifier Ext2FileSystem::createInode(InodeIdentifier parentInode, const S
// FIXME: Implement writing out indirect blocks!
ASSERT(blocks.size() < EXT2_NDIR_BLOCKS);
printf("[XXX] writing %u blocks to i_block array\n", min((unsigned)EXT2_NDIR_BLOCKS, blocks.size()));
for (unsigned i = 0; i < min((unsigned)EXT2_NDIR_BLOCKS, blocks.size()); ++i) {
printf("[XXX] writing %u blocks to i_block array\n", min((size_t)EXT2_NDIR_BLOCKS, blocks.size()));
for (unsigned i = 0; i < min((size_t)EXT2_NDIR_BLOCKS, blocks.size()); ++i) {
e2inode->i_block[i] = blocks[i];
}