mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-06 22:29:30 +00:00
419dca3c4c
* Fixed buster compile-time issue
* Host services inherit from ModePageDevice
* Call base class
* Visibility update
* Updated includes
* Updated dispatcher
* Added TODOs
* Logging update
* Code cleanup
* Use namespace instead of class for ScsiDefs
* Renaming
* Cleanup
* Use dispatcher template in order to remove duplicate code
* Updated all dispatchers
* Clean up commands
* Removed duplicate code
* Removed duplicate code
* Updated template definition
* Fixed typo
* Fixed warning
* Code cleanup
* Device list must be static
* Cleanup
* Logging update
* Added comments
* Cleanup
* Base class update
* SCSIBR is not a subclass of Disk anymore, but of PrimaryDevice
* Updated includes
* Fixed compile-time issue on the Pi
* Header file cleanup
* Interface cleanup
* Removed wrong override
* include file cleanup
* Removed obsolete usage of streams
* Removed more stream usages
* Stream usage cleanup
* Include cleanup
* Renaming
* Include cleanup
* Interface update
* SCLP device skeleton
* Initial RELEASE/RESERVE UNIT
* Added full set of commands
* Extracted command phase code
* Stripped SCSI controller code
* Removed unused code
* Commented out code
* Initial naive implementation
* Added debug output
* Disable printing for now
* Updated file handling
* Updated DataOut()
* Added comment
* Updated assertion
* Comment update
* Updated assertion
* Code cleanup
* Reset bytes to transfer
* Reverted change
* Refactoring
* Moved assertion
* Updated ReceiveBytes()
* Removed override
* Added interface
* Code cleanup
* Updated TEST UNIT READY
* Added flag for byte-oriented transfer
* Updated TEST UNIT READY
* Length handling update
* Updated bytecount handling
* Fixed warning
* Added TODO
* Updated assertion
* Enabled priting
* Updated error handling
* Code cleanup
* Logging update
* First working version
* Use temporary file
* Logging update
* Handle parameters
* Updated format string
* Updated logging
* File handling update
* Code cleanup
* Fixed buffer size
* Updated file handling
* Manpage update
* Initial reservation handling
* Updated reservation handling
* Initial reservation testing
* Remember initiator ID
* Extract initiator ID
* Updated SCSI initiator ID handling
* Logging update
* Added reservation timeout
* Updated timeout handling
* Code cleanup
* Only pass initiator ID to *SCSI* controller
* Added comments
* Added comment
* Implemented STOP PRINT
* Comment update
* Comment update
* Comment update
* Added comment
* Comment update
* Removed useless comments
* Updated printer parameter handling
* Updated parameter handling
* Manpage update
* Manpage update
* Comment update
* Default printer product name update
* Renaming
* Updated logging
* Logging update
* Logging update
* Comment update
* Code cleanup
* Added printer shortcut
* Comment update
* Comment update
* Output formatting update
* Updated error handling
* Code cleanup
* More cleanup
* Revert "More cleanup"
This reverts commit 05708986ee
.
* Output formatting update
* Output format update
* Sort parameters
* Comment update
* Improved parsing of parameters
* Manpage update
* Updated SCSI level
* Removed magic constants
* Removed magic constant
* Template update
* Template usage update
* Get rid of SASIDEV for printer
* Get rid of SASIDEV for host services
* Moved initiator_id field
* Moved field
* Moved field
* Added comment
* Error handling must use effective LUN
* Removed obsolete casts
* Removed unused method declarations
* Comment update
* Code cleanup
* More code cleanup
* Optimization
* Removed duplicate code
* Logging update
* Fixed warning
* Code cleanup
* Added TODOs
* TODO update
* Backwards compatibility update
* Comment update
85 lines
1.9 KiB
C++
85 lines
1.9 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI (*^..^*)
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2021 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <list>
|
|
#include <sstream>
|
|
#include "rascsi_interface.pb.h"
|
|
#include "rasutil.h"
|
|
|
|
using namespace std;
|
|
using namespace rascsi_interface;
|
|
|
|
bool ras_util::GetAsInt(const string& value, int& result)
|
|
{
|
|
if (value.find_first_not_of("0123456789") != string::npos) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
result = std::stoul(value);
|
|
}
|
|
catch(const invalid_argument& e) {
|
|
return false;
|
|
}
|
|
catch(const out_of_range& e) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
string ras_util::ListDevices(const list<PbDevice>& pb_devices)
|
|
{
|
|
if (pb_devices.empty()) {
|
|
return "No images currently attached.";
|
|
}
|
|
|
|
ostringstream s;
|
|
s << "+----+-----+------+-------------------------------------" << endl
|
|
<< "| ID | LUN | TYPE | IMAGE FILE" << endl
|
|
<< "+----+-----+------+-------------------------------------" << endl;
|
|
|
|
list<PbDevice> devices = pb_devices;
|
|
devices.sort([](const auto& a, const auto& b) { return a.id() < b.id() && a.unit() < b.unit(); });
|
|
|
|
for (const auto& device : devices) {
|
|
string filename;
|
|
switch (device.type()) {
|
|
case SCBR:
|
|
filename = "X68000 HOST BRIDGE";
|
|
break;
|
|
|
|
case SCDP:
|
|
filename = "DaynaPort SCSI/Link";
|
|
break;
|
|
|
|
case SCHS:
|
|
filename = "Host Services";
|
|
break;
|
|
|
|
case SCLP:
|
|
filename = "SCSI Printer";
|
|
break;
|
|
|
|
default:
|
|
filename = device.file().name();
|
|
break;
|
|
}
|
|
|
|
s << "| " << device.id() << " | " << device.unit() << " | " << PbDeviceType_Name(device.type()) << " | "
|
|
<< (filename.empty() ? "NO MEDIA" : filename)
|
|
<< (!device.status().removed() && (device.properties().read_only() || device.status().protected_()) ? " (READ-ONLY)" : "")
|
|
<< endl;
|
|
}
|
|
|
|
s << "+----+-----+------+-------------------------------------";
|
|
|
|
return s.str();
|
|
}
|