Skip to content

Commit

Permalink
Release 3.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Oct 11, 2024
1 parent 8e4c14c commit 82bd696
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cpp/devices/disk_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ bool DiskTrack::Load(const string &path, uint64_t &cache_miss_read_count)

ifstream in(path, ios::binary);
if (in.fail()) {
in.clear();
return false;
}

in.seekg(offset);
if (in.fail()) {
in.clear();
return false;
}
in.read((char*)dt.buffer, length);
if (in.fail()) {
in.clear();
return false;
}

Expand Down Expand Up @@ -118,6 +121,7 @@ bool DiskTrack::Save(const string &path, uint64_t &cache_miss_write_count)

ofstream out(path, ios::in | ios::out | ios::binary);
if (out.fail()) {
out.clear();
return false;
}

Expand All @@ -131,6 +135,7 @@ bool DiskTrack::Save(const string &path, uint64_t &cache_miss_write_count)

out.seekp(offset + (i << dt.size));
if (out.fail()) {
out.clear();
return false;
}

Expand All @@ -148,6 +153,7 @@ bool DiskTrack::Save(const string &path, uint64_t &cache_miss_write_count)

out.write((const char*)&dt.buffer[i << dt.size], total);
if (out.fail()) {
out.clear();
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions cpp/devices/linux_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int LinuxCache::Read(span<uint8_t> buf, uint64_t start, int length)
file.seekg(sector_size * start, ios::beg);
file.read((char*)buf.data(), length);
if (file.fail()) {
file.clear();
++read_error_count;
return 0;
}
Expand All @@ -59,6 +60,7 @@ int LinuxCache::Write(span<const uint8_t> buf, uint64_t start, int length)
file.seekp(sector_size * start, ios::beg);
file.write((const char*)buf.data(), length);
if (file.fail()) {
file.clear();
++write_error_count;
return 0;
}
Expand All @@ -74,6 +76,7 @@ bool LinuxCache::Flush()
{
file.flush();
if (file.fail()) {
file.clear();
++write_error_count;
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions cpp/devices/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ int Printer::WriteData(span<const uint8_t> buf, scsi_command command)

out.open(filename, ios::binary);
if (out.fail()) {
out.clear();
++print_error_count;
throw scsi_exception(sense_key::aborted_command, asc::printer_write_failed);
}
Expand All @@ -208,6 +209,7 @@ int Printer::WriteData(span<const uint8_t> buf, scsi_command command)

out.write((const char*)buf.data(), length);
if (out.fail()) {
out.clear();
++print_error_count;
throw scsi_exception(sense_key::aborted_command, asc::printer_write_failed);
}
Expand Down
4 changes: 3 additions & 1 deletion cpp/s2pctl/s2pctl_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ string S2pCtlDisplay::DisplayDeviceInfo(const PbDevice &pb_device) const
{
ostringstream s;

s << " " << pb_device.id() << ":" << pb_device.unit() << " " << PbDeviceType_Name(pb_device.type())
const string &type = PbDeviceType_IsValid(pb_device.type()) ? PbDeviceType_Name(pb_device.type()) : "????";

s << " " << pb_device.id() << ":" << pb_device.unit() << " " << type
<< " " << pb_device.vendor() << ":" << pb_device.product() << ":" << pb_device.revision();

// Check for existence because PiSCSI does not support this setting
Expand Down
2 changes: 1 addition & 1 deletion cpp/shared/s2p_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

const int s2p_major_version = 3;
const int s2p_minor_version = 4;
const int s2p_revision = 1;
const int s2p_revision = 2;
const std::string s2p_suffix = "";

0 comments on commit 82bd696

Please sign in to comment.