stream.close();
}
-off_t
+std::streampos
RawDiskImage::size() const
{
if (disk_size == 0) {
return disk_size / SectorSize;
}
-off_t
-RawDiskImage::read(uint8_t *data, off_t offset) const
+std::streampos
+RawDiskImage::read(uint8_t *data, std::streampos offset) const
{
if (!initialized)
panic("RawDiskImage not initialized");
return stream.tellg() - pos;
}
-off_t
-RawDiskImage::write(const uint8_t *data, off_t offset)
+std::streampos
+RawDiskImage::write(const uint8_t *data, std::streampos offset)
{
if (!initialized)
panic("RawDiskImage not initialized");
}
}
-off_t
+std::streampos
CowDiskImage::size() const
{ return child->size(); }
-off_t
-CowDiskImage::read(uint8_t *data, off_t offset) const
+std::streampos
+CowDiskImage::read(uint8_t *data, std::streampos offset) const
{
if (!initialized)
panic("CowDiskImage not initialized");
}
}
-off_t
-CowDiskImage::write(const uint8_t *data, off_t offset)
+std::streampos
+CowDiskImage::write(const uint8_t *data, std::streampos offset)
{
if (!initialized)
panic("RawDiskImage not initialized");
DiskImage(const Params *p) : SimObject(p), initialized(false) {}
virtual ~DiskImage() {}
- virtual off_t size() const = 0;
+ virtual std::streampos size() const = 0;
- virtual off_t read(uint8_t *data, off_t offset) const = 0;
- virtual off_t write(const uint8_t *data, off_t offset) = 0;
+ virtual std::streampos read(uint8_t *data,
+ std::streampos offset) const = 0;
+ virtual std::streampos write(const uint8_t *data,
+ std::streampos offset) = 0;
};
/**
mutable std::fstream stream;
std::string file;
bool readonly;
- mutable off_t disk_size;
+ mutable std::streampos disk_size;
public:
typedef RawDiskImageParams Params;
void close();
void open(const std::string &filename, bool rd_only = false);
- virtual off_t size() const;
+ virtual std::streampos size() const;
- virtual off_t read(uint8_t *data, off_t offset) const;
- virtual off_t write(const uint8_t *data, off_t offset);
+ virtual std::streampos read(uint8_t *data, std::streampos offset) const;
+ virtual std::streampos write(const uint8_t *data, std::streampos offset);
};
/**
void serialize(std::ostream &os);
void unserialize(Checkpoint *cp, const std::string §ion);
- virtual off_t size() const;
+ virtual std::streampos size() const;
- virtual off_t read(uint8_t *data, off_t offset) const;
- virtual off_t write(const uint8_t *data, off_t offset);
+ virtual std::streampos read(uint8_t *data, std::streampos offset) const;
+ virtual std::streampos write(const uint8_t *data, std::streampos offset);
};
#endif // __DISK_IMAGE_HH__
switch (cmdReg.command) {
// Supported non-data commands
case WDSF_READ_NATIVE_MAX:
- size = image->size() - 1;
+ size = (uint32_t)image->size() - 1;
cmdReg.sec_num = (size & 0xff);
cmdReg.cyl_low = ((size & 0xff00) >> 8);
cmdReg.cyl_high = ((size & 0xff0000) >> 16);