35 #ifndef __DEV_STORAGE_DISK_IMAGE_HH__
36 #define __DEV_STORAGE_DISK_IMAGE_HH__
39 #include <unordered_map>
41 #include "params/CowDiskImage.hh"
42 #include "params/DiskImage.hh"
43 #include "params/RawDiskImage.hh"
46 #define SectorSize (512)
61 virtual std::streampos
size()
const = 0;
63 virtual std::streampos
read(uint8_t *
data,
64 std::streampos
offset)
const = 0;
65 virtual std::streampos
write(
const uint8_t *
data,
66 std::streampos
offset) = 0;
88 void open(
const std::string &filename,
bool rd_only =
false);
90 std::streampos
size()
const override;
92 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
93 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
131 bool open(
const std::string &file);
133 void save(
const std::string &file)
const;
139 std::streampos
size()
const override;
141 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
142 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
161 #endif // __DEV_STORAGE_DISK_IMAGE_HH__
std::streampos write(const uint8_t *data, std::streampos offset) override
std::streampos size() const override
DiskImage(const Params *p)
CowDiskImage(const Params *p)
std::streampos read(uint8_t *data, std::streampos offset) const override
void SafeWriteSwap(std::ofstream &stream, const T &data)
std::streampos size() const override
Specialization for accessing a copy-on-write disk image layer.
static const uint32_t VersionMinor
void serialize(CheckpointOut &cp) const override
Serialize an object.
void notifyFork() override
Notify a child process of a fork.
virtual std::streampos size() const =0
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 open(const std::string &filename, bool rd_only=false)
RawDiskImage(const Params *p)
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
std::streampos read(uint8_t *data, std::streampos offset) const override
virtual std::streampos read(uint8_t *data, std::streampos offset) const =0
std::streampos write(const uint8_t *data, std::streampos offset) override
void initSectorTable(int hash_size)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool open(const std::string &file)
Specialization for accessing a raw disk image.
Abstract superclass for simulation objects.
void notifyFork() override
Notify a child process of a fork.