mirror of
https://github.com/ksherlock/profuse.git
synced 2024-12-22 20:29:59 +00:00
ac8bbd5265
git-svn-id: https://profuse.googlecode.com/svn/branches/profuse_interim@369 aa027e90-d47c-11dd-86d7-074df07e0730
58 lines
1.0 KiB
C++
58 lines
1.0 KiB
C++
#ifndef __RAWDEVICE_H__
|
|
#define __RAWDEVICE_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <Device/BlockDevice.h>
|
|
|
|
#include <File/File.h>
|
|
|
|
namespace Device {
|
|
|
|
// /dev/xxx
|
|
|
|
|
|
class RawDevice : public BlockDevice {
|
|
public:
|
|
|
|
|
|
|
|
static BlockDevicePointer Open(const char *name, File::FileFlags flags);
|
|
|
|
|
|
virtual ~RawDevice();
|
|
|
|
virtual void read(unsigned block, void *bp);
|
|
virtual void read(TrackSector ts, void *bp);
|
|
|
|
virtual void write(unsigned block, const void *bp);
|
|
virtual void write(TrackSector ts, const void *bp);
|
|
|
|
virtual bool readOnly();
|
|
virtual bool mapped();
|
|
virtual void sync();
|
|
|
|
virtual unsigned blocks();
|
|
|
|
private:
|
|
|
|
|
|
RawDevice(const char *name, File::FileFlags flags);
|
|
|
|
RawDevice(File& file, File::FileFlags flags);
|
|
|
|
void devSize(int fd);
|
|
|
|
File _file;
|
|
bool _readOnly;
|
|
|
|
uint64_t _size; // size of device in bytes.
|
|
unsigned _blocks; // # of 512k blocks i.e. _size / 512
|
|
|
|
unsigned _blockSize; // native block size.
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|