summaryrefslogtreecommitdiff
path: root/Source/Kernel/VFS/Partition.class.h
blob: 8df1c4f32c061c726e61c027375bc2a1d3f1f3d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef DEF_PARTITION_CLASS_H
#define DEF_PARTITION_CLASS_H

#include <Devices/BlockDevice.proto.h>

class Partition {
	private:
	BlockDevice* m_device;
	u64int m_startblock, m_blockcount;
	u8int m_partnumber;	//Partition number in partition table of device

	public:
	Partition(BlockDevice* dev, u8int partnumber, u64int startblock, u64int blockcount);

	bool readBlocks(u64int startblock, u32int count, u8int *data);
	bool writeBlocks(u64int startblock, u32int count, u8int *data);

	//These two just use the readBlocks && writeBlocks defined above
	bool read(u64int start, u32int length, u8int *data);
	bool write(u64int start, u32int length, u8int *data);

	//Accessors :
	BlockDevice* getDevice();
	u64int getStartBlock();
	u64int getBlockCount();
	u8int getPartNumber();
	u32int getBlockSize();
	inline u64int blocks() { return getBlockCount(); }
};

#endif