mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-10 17:30:47 +00:00
Removed duplicate code
This commit is contained in:
parent
d46013934a
commit
4859c17ee3
@ -141,8 +141,8 @@ public:
|
|||||||
|
|
||||||
virtual bool Eject(bool);
|
virtual bool Eject(bool);
|
||||||
|
|
||||||
bool IsSASI() const { return type == "SAHD"; }
|
bool IsSASIHD() const { return type == "SAHD"; }
|
||||||
bool IsSCSI() const { return type == "SCHD" || type == "SCRM"; }
|
bool IsSCSIHD() const { return type == "SCHD" || type == "SCRM"; }
|
||||||
bool IsCdRom() const { return type == "SCCD"; }
|
bool IsCdRom() const { return type == "SCCD"; }
|
||||||
bool IsMo() const { return type == "SCMO"; }
|
bool IsMo() const { return type == "SCMO"; }
|
||||||
bool IsBridge() const { return type == "SCBR"; }
|
bool IsBridge() const { return type == "SCBR"; }
|
||||||
|
@ -397,7 +397,7 @@ void Disk::ModeSelect6(SASIDEV *controller)
|
|||||||
{
|
{
|
||||||
LOGTRACE("MODE SELECT for unsupported page %d", ctrl->buffer[0]);
|
LOGTRACE("MODE SELECT for unsupported page %d", ctrl->buffer[0]);
|
||||||
|
|
||||||
ctrl->length = SelectCheck(ctrl->cmd);
|
ctrl->length = SelectCheck6(ctrl->cmd);
|
||||||
if (ctrl->length <= 0) {
|
if (ctrl->length <= 0) {
|
||||||
controller->Error();
|
controller->Error();
|
||||||
return;
|
return;
|
||||||
@ -619,27 +619,26 @@ int Disk::RequestSense(const DWORD *cdb, BYTE *buf)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
int Disk::SelectCheck(const DWORD *cdb, int length)
|
||||||
//
|
|
||||||
// MODE SELECT check
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
int Disk::SelectCheck(const DWORD *cdb)
|
|
||||||
{
|
{
|
||||||
ASSERT(cdb);
|
// Error if save parameters are set for other types than of SCHD or SCRM
|
||||||
|
if (!IsSCSIHD() && (cdb[1] & 0x01)) {
|
||||||
// Error if save parameters are set instead of SCSIHD or SCSIRM
|
|
||||||
if (!IsSCSI()) {
|
|
||||||
// Error if save parameters are set
|
|
||||||
if (cdb[1] & 0x01) {
|
|
||||||
SetStatusCode(STATUS_INVALIDCDB);
|
SetStatusCode(STATUS_INVALIDCDB);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// MODE SELECT(6) check
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
int Disk::SelectCheck6(const DWORD *cdb)
|
||||||
|
{
|
||||||
// Receive the data specified by the parameter length
|
// Receive the data specified by the parameter length
|
||||||
int length = (int)cdb[4];
|
return SelectCheck(cdb, cdb[4]);
|
||||||
return length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -649,25 +648,15 @@ int Disk::SelectCheck(const DWORD *cdb)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
int Disk::SelectCheck10(const DWORD *cdb)
|
int Disk::SelectCheck10(const DWORD *cdb)
|
||||||
{
|
{
|
||||||
ASSERT(cdb);
|
|
||||||
|
|
||||||
// Error if save parameters are set instead of SCSIHD or SCSIRM
|
|
||||||
if (!IsSCSI()) {
|
|
||||||
if (cdb[1] & 0x01) {
|
|
||||||
SetStatusCode(STATUS_INVALIDCDB);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Receive the data specified by the parameter length
|
// Receive the data specified by the parameter length
|
||||||
DWORD length = cdb[7];
|
int length = cdb[7];
|
||||||
length <<= 8;
|
length <<= 8;
|
||||||
length |= cdb[8];
|
length |= cdb[8];
|
||||||
if (length > 0x800) {
|
if (length > 0x800) {
|
||||||
length = 0x800;
|
length = 0x800;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)length;
|
return SelectCheck(cdb, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@ -1723,7 +1712,7 @@ bool Disk::SetConfiguredSectorSize(uint32_t configured_sector_size)
|
|||||||
{
|
{
|
||||||
const DeviceFactory& device_factory = DeviceFactory::instance();
|
const DeviceFactory& device_factory = DeviceFactory::instance();
|
||||||
|
|
||||||
set<uint32_t> sector_sizes = IsSCSI() ? device_factory.GetScsiSectorSizes() : device_factory.GetSasiSectorSizes();
|
set<uint32_t> sector_sizes = IsSCSIHD() ? device_factory.GetScsiSectorSizes() : device_factory.GetSasiSectorSizes();
|
||||||
if (sector_sizes.find(configured_sector_size) == sector_sizes.end()) {
|
if (sector_sizes.find(configured_sector_size) == sector_sizes.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,6 @@ public:
|
|||||||
|
|
||||||
virtual int Read(const DWORD *cdb, BYTE *buf, uint64_t block);
|
virtual int Read(const DWORD *cdb, BYTE *buf, uint64_t block);
|
||||||
int ReadDefectData10(const DWORD *cdb, BYTE *buf); // READ DEFECT DATA(10) command
|
int ReadDefectData10(const DWORD *cdb, BYTE *buf); // READ DEFECT DATA(10) command
|
||||||
int SelectCheck(const DWORD *cdb); // SELECT check
|
|
||||||
int SelectCheck10(const DWORD *cdb); // SELECT(10) check
|
|
||||||
|
|
||||||
uint32_t GetSectorSizeInBytes() const;
|
uint32_t GetSectorSizeInBytes() const;
|
||||||
void SetSectorSizeInBytes(uint32_t, bool);
|
void SetSectorSizeInBytes(uint32_t, bool);
|
||||||
@ -171,4 +169,7 @@ private:
|
|||||||
bool Format(const DWORD *cdb);
|
bool Format(const DWORD *cdb);
|
||||||
int ModeSense6(const DWORD *cdb, BYTE *buf);
|
int ModeSense6(const DWORD *cdb, BYTE *buf);
|
||||||
int ModeSense10(const DWORD *cdb, BYTE *buf);
|
int ModeSense10(const DWORD *cdb, BYTE *buf);
|
||||||
|
int SelectCheck(const DWORD *cdb, int length);
|
||||||
|
int SelectCheck6(const DWORD *cdb);
|
||||||
|
int SelectCheck10(const DWORD *cdb);
|
||||||
};
|
};
|
||||||
|
@ -372,7 +372,7 @@ bool MapController(Device **map)
|
|||||||
int unitno = i * UnitNum + j;
|
int unitno = i * UnitNum + j;
|
||||||
// branch by unit type
|
// branch by unit type
|
||||||
if (devices[unitno]) {
|
if (devices[unitno]) {
|
||||||
if (devices[unitno]->IsSASI()) {
|
if (devices[unitno]->IsSASIHD()) {
|
||||||
// Drive is SASI, so increment SASI count
|
// Drive is SASI, so increment SASI count
|
||||||
sasi_num++;
|
sasi_num++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user