mirror of
https://github.com/ksherlock/profuse.git
synced 2024-12-25 23:33:15 +00:00
42 lines
588 B
C++
42 lines
588 B
C++
#ifndef __RAWDEVICE_H__
|
|
#define __RAWDEVICE_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <Device/BlockDevice.h>
|
|
|
|
namespace Device {
|
|
|
|
// /dev/xxx
|
|
|
|
|
|
class RawDevice : BlockDevice {
|
|
public:
|
|
|
|
RawDevice(const char *name, bool readOnly);
|
|
|
|
virtual ~RawDevice();
|
|
|
|
virtual void read(unsigned block, void *bp);
|
|
virtual void write(unsigned block, const void *bp);
|
|
|
|
virtual bool readOnly();
|
|
virtual void sync();
|
|
|
|
private:
|
|
|
|
void devSize(int fd);
|
|
|
|
int _fd;
|
|
bool _readOnly;
|
|
|
|
uint64_t _size;
|
|
unsigned _blocks;
|
|
|
|
unsigned _blockSize;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|