mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-27 17:48:29 +00:00
resize cache after change of sector size
The disk cache is based on sector size and must be resized when the sector size changes. Disk::ResizeCache needs a `raw` parameter, make this value accessible from the current cache. Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
This commit is contained in:
parent
2d86000329
commit
55769d557d
|
@ -112,7 +112,7 @@ protected:
|
||||||
|
|
||||||
void SetUpCache(off_t, bool = false);
|
void SetUpCache(off_t, bool = false);
|
||||||
void ResizeCache(const string&, bool);
|
void ResizeCache(const string&, bool);
|
||||||
|
bool GetRawMode() { return (cache?cache->GetRawMode():false); }
|
||||||
void SetUpModePages(map<int, vector<byte>>&, int, bool) const override;
|
void SetUpModePages(map<int, vector<byte>>&, int, bool) const override;
|
||||||
void AddErrorPage(map<int, vector<byte>>&, bool) const;
|
void AddErrorPage(map<int, vector<byte>>&, bool) const;
|
||||||
virtual void AddFormatPage(map<int, vector<byte>>&, bool) const;
|
virtual void AddFormatPage(map<int, vector<byte>>&, bool) const;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
~DiskCache() = default;
|
~DiskCache() = default;
|
||||||
|
|
||||||
void SetRawMode(bool b) { cd_raw = b; } // CD-ROM raw mode setting
|
void SetRawMode(bool b) { cd_raw = b; } // CD-ROM raw mode setting
|
||||||
|
bool GetRawMode() { return cd_raw; }
|
||||||
|
|
||||||
bool Save(); // Save and release all
|
bool Save(); // Save and release all
|
||||||
bool ReadSector(span<uint8_t>, uint32_t); // Sector Read
|
bool ReadSector(span<uint8_t>, uint32_t); // Sector Read
|
||||||
|
|
|
@ -178,6 +178,8 @@ void SCSICD::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, in
|
||||||
SetSectorSizeInBytes(wanted_sector_size);
|
SetSectorSizeInBytes(wanted_sector_size);
|
||||||
ClearTrack();
|
ClearTrack();
|
||||||
CreateDataTrack();
|
CreateDataTrack();
|
||||||
|
FlushCache();
|
||||||
|
ResizeCache(GetFilename(), GetRawMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);
|
if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user