Skip to content

Commit

Permalink
Update error handling when changing sector size fails
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 24, 2024
1 parent 301d891 commit b8de7fc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
11 changes: 8 additions & 3 deletions cpp/devices/optical_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ void OpticalMemory::AddOptionPage(map<int, vector<byte>> &pages, bool) const

void OpticalMemory::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, int length) const
{
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
try {
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
}
}
catch (const scsi_exception &e) {
GetController()->Error(e.get_sense_key(), e.get_asc());
}
}

Expand Down
11 changes: 8 additions & 3 deletions cpp/devices/scsi_cd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,14 @@ vector<uint8_t> ScsiCd::InquiryInternal() const

void ScsiCd::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, int length) const
{
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
try {
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
}
}
catch (const scsi_exception &e) {
GetController()->Error(e.get_sense_key(), e.get_asc());
}
}

Expand Down
11 changes: 8 additions & 3 deletions cpp/devices/scsi_hd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ vector<uint8_t> ScsiHd::InquiryInternal() const

void ScsiHd::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, int length) const
{
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
try {
if (const string result = mode_page_util::ModeSelect(cmd, cdb, buf, length, 1 << GetSectorSizeShiftCount());
!result.empty()) {
LogWarn(result);
}
}
catch (const scsi_exception &e) {
GetController()->Error(e.get_sense_key(), e.get_asc());
}
}

Expand Down

0 comments on commit b8de7fc

Please sign in to comment.