diff options
author | Alexis211 <alexis211@gmail.com> | 2009-11-28 12:36:01 +0100 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-11-28 12:36:01 +0100 |
commit | 4d0939e2853ffd9d49b83524923351f9776866d7 (patch) | |
tree | cbaf59ee30e60f268a03ea28f9cbdf2b278f2fcf /Source/Kernel/VFS/Partition.class.cpp | |
parent | bcb8807209f4aa7da4d7fec54857599b60c87947 (diff) | |
download | Melon-4d0939e2853ffd9d49b83524923351f9776866d7.tar.gz Melon-4d0939e2853ffd9d49b83524923351f9776866d7.zip |
Caching mechanism added and floppy driver fixed on qemu/vbox
Diffstat (limited to 'Source/Kernel/VFS/Partition.class.cpp')
-rw-r--r-- | Source/Kernel/VFS/Partition.class.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Kernel/VFS/Partition.class.cpp b/Source/Kernel/VFS/Partition.class.cpp index b62f33c..1476b14 100644 --- a/Source/Kernel/VFS/Partition.class.cpp +++ b/Source/Kernel/VFS/Partition.class.cpp @@ -2,21 +2,23 @@ using namespace CMem; //For memcpy -Partition::Partition(BlockDevice* dev, u8int partnumber, u64int startblock, u64int blockcount) { +Partition::Partition(BlockDevice* dev, u8int partnumber, u64int startblock, u64int blockcount) +: m_cache(dev) { m_device = dev; m_partnumber = partnumber; m_startblock = startblock; m_blockcount = blockcount; + m_cache.init(10 + (m_device->blocks() / 1000 > 100 ? 100 : m_device->blocks() / 1000)); } bool Partition::readBlocks(u64int startblock, u32int count, u8int *data) { if (startblock + count > m_startblock + m_blockcount) return false; - return m_device->readBlocks(startblock - m_startblock, count, data); + return m_cache.readBlocks(startblock - m_startblock, count, data); } bool Partition::writeBlocks(u64int startblock, u32int count, u8int *data) { if (startblock + count > m_startblock + m_blockcount) return false; - return m_device->writeBlocks(startblock - m_startblock, count, data); + return m_cache.writeBlocks(startblock - m_startblock, count, data); } bool Partition::read(u64int start, u32int length, u8int *data) { |