summaryrefslogblamecommitdiff
path: root/Source/Kernel/VFS/BlockCache.class.h
blob: 0b26180bf890165c67088fe02b5b5caca1156ef7 (plain) (tree)































                                                                       
#ifndef DEF_BLOCKCACHE_CLASS_H
#define DEF_BLOCKCACHE_CLASS_H

template <typename T>
class BlockCache {
	private:
	T* m_dev;
	u32int m_count;
	struct cached_block_t {
		u64int id;
		u32int lastuse;
		bool dirty;
	} *m_cacheInfo;
	u8int* m_cache;

	void sync();
	bool setCache(u64int block, u8int* data, bool dirty = false);
	bool getCache(u64int block, u8int* data);

	public:
	BlockCache(T* dev);
	~BlockCache();
	void init(u32int count);

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

#include "BlockCache.class.cpp"

#endif