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)
62 virtual std::streampos
size()
const = 0;
65 std::streampos
offset)
const = 0;
67 std::streampos
offset) = 0;
89 void open(
const std::string &filename,
bool rd_only =
false);
91 std::streampos
size()
const override;
93 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
94 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
133 bool open(
const std::string &file);
135 void save(
const std::string &file)
const;
141 std::streampos
size()
const override;
143 std::streampos
read(uint8_t *
data, std::streampos
offset)
const override;
144 std::streampos
write(
const uint8_t *
data, std::streampos
offset)
override;
Specialization for accessing a copy-on-write disk image layer.
void notifyFork() override
Notify a child process of a fork.
std::streampos write(const uint8_t *data, std::streampos offset) override
std::streampos size() const override
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static const uint32_t VersionMajor
std::streampos read(uint8_t *data, std::streampos offset) const override
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::unordered_map< uint64_t, Sector * > SectorTable
bool open(const std::string &file)
CowDiskImageParams Params
static const uint32_t VersionMinor
void initSectorTable(int hash_size)
CowDiskImage(const Params &p)
Basic interface for accessing a disk image.
virtual std::streampos write(const uint8_t *data, std::streampos offset)=0
virtual std::streampos size() const =0
virtual std::streampos read(uint8_t *data, std::streampos offset) const =0
DiskImage(const Params &p)
Specialization for accessing a raw disk image.
void notifyFork() override
Notify a child process of a fork.
void open(const std::string &filename, bool rd_only=false)
std::streampos size() const override
RawDiskImage(const Params &p)
std::streampos read(uint8_t *data, std::streampos offset) const override
std::streampos write(const uint8_t *data, std::streampos offset) override
RawDiskImageParams Params
Abstract superclass for simulation objects.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
void SafeWriteSwap(std::ofstream &stream, const T &data)
std::ostream CheckpointOut
void SafeRead(std::ifstream &stream, void *data, int count)
void SafeWrite(std::ofstream &stream, const void *data, int count)
void SafeReadSwap(std::ifstream &stream, T &data)