summaryrefslogtreecommitdiff
path: root/Source/Kernel/VFS/Partition.class.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-31 21:44:26 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-31 21:44:26 +0200
commitdf76b24fed5ac3b5af406aad3df277d7f4c347e5 (patch)
treeea8a0ca4856cce9da63c047eff6e72a58c643159 /Source/Kernel/VFS/Partition.class.cpp
parent6bf215215e1ebaa9613b51500031e6963c12d33b (diff)
downloadMelon-df76b24fed5ac3b5af406aad3df277d7f4c347e5.tar.gz
Melon-df76b24fed5ac3b5af406aad3df277d7f4c347e5.zip
Now we can read frop floppy drives !!! Next : FAT driver.
Diffstat (limited to 'Source/Kernel/VFS/Partition.class.cpp')
-rw-r--r--Source/Kernel/VFS/Partition.class.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/Kernel/VFS/Partition.class.cpp b/Source/Kernel/VFS/Partition.class.cpp
new file mode 100644
index 0000000..0c7832b
--- /dev/null
+++ b/Source/Kernel/VFS/Partition.class.cpp
@@ -0,0 +1,25 @@
+#include "Partition.class.h"
+
+Partition::Partition(BlockDevice* dev, u8int partnumber, u64int startblock, u64int blockcount) {
+ m_device = dev;
+ m_partnumber = partnumber;
+ m_startblock = startblock;
+ m_blockcount = blockcount;
+}
+
+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);
+}
+
+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);
+}
+
+//Accessors
+BlockDevice* Partition::getDevice() { return m_device; }
+u64int Partition::getStartBlock() { return m_startblock; }
+u64int Partition::getBlockCount() { return m_blockcount; }
+u8int Partition::getPartNumber() { return m_partnumber; }
+u32int Partition::getBlockSize() { return m_device->blockSize(); }