mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
Removed obsolete try/catch
This commit is contained in:
parent
eabd041b9f
commit
39ca12d8b1
@ -92,86 +92,80 @@ Device *DeviceFactory::CreateDevice(PbDeviceType type, const string& filename, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
Device *device = NULL;
|
Device *device = NULL;
|
||||||
try {
|
switch (type) {
|
||||||
switch (type) {
|
case SAHD:
|
||||||
case SAHD:
|
device = new SASIHD();
|
||||||
device = new SASIHD();
|
device->SetSupportedLuns(2);
|
||||||
device->SetSupportedLuns(2);
|
((Disk *)device)->SetSectorSizes(sector_sizes[SAHD]);
|
||||||
((Disk *)device)->SetSectorSizes(sector_sizes[SAHD]);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case SCHD:
|
case SCHD:
|
||||||
if (ext == "hdn" || ext == "hdi" || ext == "nhd") {
|
if (ext == "hdn" || ext == "hdi" || ext == "nhd") {
|
||||||
device = new SCSIHD_NEC();
|
device = new SCSIHD_NEC();
|
||||||
((Disk *)device)->SetSectorSizes({ 512 });
|
((Disk *)device)->SetSectorSizes({ 512 });
|
||||||
} else {
|
} else {
|
||||||
device = new SCSIHD(false);
|
device = new SCSIHD(false);
|
||||||
((Disk *)device)->SetSectorSizes(sector_sizes[SCHD]);
|
((Disk *)device)->SetSectorSizes(sector_sizes[SCHD]);
|
||||||
}
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
device->SetProtectable(true);
|
|
||||||
device->SetStoppable(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCRM:
|
|
||||||
device = new SCSIHD(true);
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
device->SetProtectable(true);
|
|
||||||
device->SetStoppable(true);
|
|
||||||
device->SetRemovable(true);
|
|
||||||
device->SetLockable(true);
|
|
||||||
device->SetProduct("SCSI HD (REM.)");
|
|
||||||
((Disk *)device)->SetSectorSizes(sector_sizes[SCRM]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCMO:
|
|
||||||
device = new SCSIMO();
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
device->SetProtectable(true);
|
|
||||||
device->SetStoppable(true);
|
|
||||||
device->SetRemovable(true);
|
|
||||||
device->SetLockable(true);
|
|
||||||
device->SetProduct("SCSI MO");
|
|
||||||
((Disk *)device)->SetGeometries(geometries[SCMO]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCCD:
|
|
||||||
device = new SCSICD();
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
device->SetReadOnly(true);
|
|
||||||
device->SetStoppable(true);
|
|
||||||
device->SetRemovable(true);
|
|
||||||
device->SetLockable(true);
|
|
||||||
device->SetProduct("SCSI CD-ROM");
|
|
||||||
((Disk *)device)->SetSectorSizes(sector_sizes[SCCD]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCBR:
|
|
||||||
device = new SCSIBR();
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
device->SetProduct("SCSI HOST BRIDGE");
|
|
||||||
device->SupportsParams(true);
|
|
||||||
device->SetDefaultParams(default_params[SCBR]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCDP:
|
|
||||||
device = new SCSIDaynaPort();
|
|
||||||
device->SetSupportedLuns(1);
|
|
||||||
// Since this is an emulation for a specific device the full INQUIRY data have to be set accordingly
|
|
||||||
device->SetVendor("Dayna");
|
|
||||||
device->SetProduct("SCSI/Link");
|
|
||||||
device->SetRevision("1.4a");
|
|
||||||
device->SupportsParams(true);
|
|
||||||
device->SetDefaultParams(default_params[SCDP]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
device->SetSupportedLuns(1);
|
||||||
catch(const illegal_argument_exception& e) {
|
device->SetProtectable(true);
|
||||||
// There was an internal problem with setting up the device data
|
device->SetStoppable(true);
|
||||||
return NULL;
|
break;
|
||||||
|
|
||||||
|
case SCRM:
|
||||||
|
device = new SCSIHD(true);
|
||||||
|
device->SetSupportedLuns(1);
|
||||||
|
device->SetProtectable(true);
|
||||||
|
device->SetStoppable(true);
|
||||||
|
device->SetRemovable(true);
|
||||||
|
device->SetLockable(true);
|
||||||
|
device->SetProduct("SCSI HD (REM.)");
|
||||||
|
((Disk *)device)->SetSectorSizes(sector_sizes[SCRM]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCMO:
|
||||||
|
device = new SCSIMO();
|
||||||
|
device->SetSupportedLuns(1);
|
||||||
|
device->SetProtectable(true);
|
||||||
|
device->SetStoppable(true);
|
||||||
|
device->SetRemovable(true);
|
||||||
|
device->SetLockable(true);
|
||||||
|
device->SetProduct("SCSI MO");
|
||||||
|
((Disk *)device)->SetGeometries(geometries[SCMO]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCCD:
|
||||||
|
device = new SCSICD();
|
||||||
|
device->SetSupportedLuns(1);
|
||||||
|
device->SetReadOnly(true);
|
||||||
|
device->SetStoppable(true);
|
||||||
|
device->SetRemovable(true);
|
||||||
|
device->SetLockable(true);
|
||||||
|
device->SetProduct("SCSI CD-ROM");
|
||||||
|
((Disk *)device)->SetSectorSizes(sector_sizes[SCCD]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCBR:
|
||||||
|
device = new SCSIBR();
|
||||||
|
device->SetSupportedLuns(1);
|
||||||
|
device->SetProduct("SCSI HOST BRIDGE");
|
||||||
|
device->SupportsParams(true);
|
||||||
|
device->SetDefaultParams(default_params[SCBR]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCDP:
|
||||||
|
device = new SCSIDaynaPort();
|
||||||
|
device->SetSupportedLuns(1);
|
||||||
|
// Since this is an emulation for a specific device the full INQUIRY data have to be set accordingly
|
||||||
|
device->SetVendor("Dayna");
|
||||||
|
device->SetProduct("SCSI/Link");
|
||||||
|
device->SetRevision("1.4a");
|
||||||
|
device->SupportsParams(true);
|
||||||
|
device->SetDefaultParams(default_params[SCDP]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
|
Loading…
Reference in New Issue
Block a user