mirror of
https://github.com/ksherlock/profuse.git
synced 2024-09-29 04:55:21 +00:00
37 lines
523 B
C
37 lines
523 B
C
|
#ifndef __BLOCKCACHE_H__
|
||
|
#define __BLOCKCACHE_H__
|
||
|
|
||
|
#include <stdint.h>
|
||
|
#include <vector>
|
||
|
|
||
|
namespace ProFUSE {
|
||
|
|
||
|
class BlockDevice;
|
||
|
|
||
|
struct BlockDescriptor {
|
||
|
unsigned block;
|
||
|
unsigned count;
|
||
|
unsigned ts;
|
||
|
uint8_t *data;
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
class BlockCache {
|
||
|
BlockCache(BlockDevice *device);
|
||
|
~BlockCache();
|
||
|
|
||
|
void write();
|
||
|
|
||
|
void *acquire(unsigned block);
|
||
|
void release(unsigned block);
|
||
|
|
||
|
private:
|
||
|
std::vector<BlockDescriptor> _blocks;
|
||
|
BlockDevice *_device;
|
||
|
unsigned _ts;
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|