33 #ifndef __DEV_STORAGE_DISK_IMAGE_HH__ 34 #define __DEV_STORAGE_DISK_IMAGE_HH__ 37 #include <unordered_map> 39 #include "params/CowDiskImage.hh" 40 #include "params/DiskImage.hh" 41 #include "params/RawDiskImage.hh" 44 #define SectorSize (512) 59 virtual std::streampos
size()
const = 0;
61 virtual std::streampos
read(uint8_t *
data,
62 std::streampos
offset)
const = 0;
63 virtual std::streampos
write(
const uint8_t *data,
64 std::streampos offset) = 0;
86 void open(
const std::string &filename,
bool rd_only =
false);
88 std::streampos
size()
const override;
90 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
91 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
128 void initSectorTable(
int hash_size);
129 bool open(
const std::string &file);
131 void save(
const std::string &file)
const;
137 std::streampos
size()
const override;
139 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
140 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
159 #endif // __DEV_STORAGE_DISK_IMAGE_HH__
DiskImage(const Params *p)
virtual void notifyFork()
Notify a child process of a fork.
void SafeWriteSwap(std::ofstream &stream, const T &data)
Specialization for accessing a copy-on-write disk image layer.
static const uint32_t VersionMinor
virtual std::streampos size() const =0
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::unordered_map< uint64_t, Sector * > SectorTable
RawDiskImageParams Params
virtual std::streampos write(const uint8_t *data, std::streampos offset)=0
void SafeWrite(std::ofstream &stream, const void *data, int count)
Basic interface for accessing a disk image.
void SafeReadSwap(std::ifstream &stream, T &data)
static const uint32_t VersionMajor
CowDiskImageParams Params
void SafeRead(std::ifstream &stream, void *data, int count)
std::ostream CheckpointOut
virtual std::streampos read(uint8_t *data, std::streampos offset) const =0
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Specialization for accessing a raw disk image.
Abstract superclass for simulation objects.