blob: 0b26180bf890165c67088fe02b5b5caca1156ef7 (
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_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
|