mirror of
https://github.com/ksherlock/profuse.git
synced 2024-10-31 17:04:27 +00:00
51 lines
869 B
C++
51 lines
869 B
C++
#ifndef __BLOCKDEVICE_H__
|
|
#define __BLOCKDEVICE_H__
|
|
|
|
#include <stdint.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <ProFUSE/Exception.h>
|
|
|
|
#include <Device/TrackSector.h>
|
|
|
|
namespace Device {
|
|
|
|
class BlockCache;
|
|
|
|
class BlockDevice {
|
|
public:
|
|
|
|
virtual ~BlockDevice();
|
|
|
|
virtual void read(unsigned block, void *bp) = 0;
|
|
virtual void read(TrackSector ts, void *bp);
|
|
|
|
virtual void write(unsigned block, const void *bp) = 0;
|
|
virtual void write(TrackSector ts, const void *bp);
|
|
|
|
|
|
virtual unsigned blocks() = 0;
|
|
|
|
virtual bool mapped();
|
|
|
|
virtual bool readOnly() = 0;
|
|
|
|
virtual void sync() = 0;
|
|
virtual void sync(unsigned block);
|
|
virtual void sync(TrackSector ts);
|
|
|
|
|
|
void zeroBlock(unsigned block);
|
|
|
|
protected:
|
|
BlockDevice();
|
|
|
|
friend BlockCache;
|
|
virtual BlockCache *createBlockCache();
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif |