Added more device shortcuts to rasctl

This commit is contained in:
Uwe Seimet 2021-09-03 12:53:27 +02:00
parent e18934d545
commit ec42fd9215
7 changed files with 29 additions and 24 deletions

View File

@ -70,11 +70,13 @@ The optional block size. For SCSI drives 512, 1024, 2048 or 4096 bytes, default
Path to the disk image file. See the rascsi(1) man page for allowable file types. Path to the disk image file. See the rascsi(1) man page for allowable file types.
.TP .TP
.BR \-t\fI " " \fITYPE .BR \-t\fI " " \fITYPE
Specifies the device type. This type overrides the type derived from the file extension of the specified image. See the rascsi(1) man page for the available device types. Legacy drive types are: Specifies the device type. This type overrides the type derived from the file extension of the specified image. See the rascsi(1) man page for the available device types. For some types there are shortcuts (only the first letter is required):
hd: Hard disk (SCSI or SASI) hd: SCSI hard disk drive
mo: Magneto-Optical disk rm: SCSI removable media drive
cd: CD-ROM cd: CD-ROM
bridge: Bridge device (This is only applicable to the Sharp X68000) mo: Magneto-Optical disk
bridge: Bridge device (Only applicable to the Sharp X68000)
daynaport: Daynaport network adapter
.TP .TP
.BR \-u\fI " " \fIVENDOR:PRODUCT:REVISION .BR \-u\fI " " \fIVENDOR:PRODUCT:REVISION
The vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed. The vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed.

View File

@ -67,25 +67,26 @@ OPTIONS
-t TYPE -t TYPE
Specifies the device type. This type overrides the type derived Specifies the device type. This type overrides the type derived
from the file extension of the specified image. See the from the file extension of the specified image. See the
rascsi(1) man page for the available device types. Legacy drive rascsi(1) man page for the available device types. For some
types are: types there are shortcuts (only the first letter is required):
hd: Hard disk (SCSI or SASI) hd: SCSI hard disk drive
mo: Magneto-Optical disk rm: SCSI removable media drive
cd: CD-ROM cd: CD-ROM
bridge: Bridge device (This is only applicable to the Sharp mo: Magneto-Optical disk
X68000) bridge: Bridge device (Only applicable to the Sharp X68000)
daynaport: Daynaport network adapter
-u VENDOR:PRODUCT:REVISION -u VENDOR:PRODUCT:REVISION
The vendor, product and revision for the device, to be returned The vendor, product and revision for the device, to be returned
with the INQUIRY data. A complete set of name components must be with the INQUIRY data. A complete set of name components must be
provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up
to 4 characters. Padding with blanks to the maxium length is au to 4 characters. Padding with blanks to the maxium length is au
tomatically applied. Once set the name of a device cannot be tomatically applied. Once set the name of a device cannot be
changed. changed.
-u UNIT -u UNIT
Unit number (0 or 1). This will default to 0. This option is Unit number (0 or 1). This will default to 0. This option is
only used when there are multiple SCSI devices on a shared SCSI only used when there are multiple SCSI devices on a shared SCSI
controller. (This is not common) controller. (This is not common)
EXAMPLES EXAMPLES

View File

@ -519,9 +519,7 @@ bool Disk::Eject(bool force)
// The image file for this drive is not in use anymore // The image file for this drive is not in use anymore
FileSupport *file_support = dynamic_cast<FileSupport *>(this); FileSupport *file_support = dynamic_cast<FileSupport *>(this);
if (file_support) { if (file_support) {
Filepath filepath; file_support->UnreserveFile();
file_support->GetPath(filepath);
file_support->UnreserveFile(filepath);
} }
} }

View File

@ -20,9 +20,9 @@ void FileSupport::ReserveFile(const Filepath& path, int id, int lun)
reserved_files[path.GetPath()] = make_pair(id, lun); reserved_files[path.GetPath()] = make_pair(id, lun);
} }
void FileSupport::UnreserveFile(const Filepath& path) void FileSupport::UnreserveFile()
{ {
reserved_files.erase(path.GetPath()); reserved_files.erase(diskpath.GetPath());
} }
bool FileSupport::GetIdsForReservedFile(const Filepath& path, int& id, int& unit) const bool FileSupport::GetIdsForReservedFile(const Filepath& path, int& id, int& unit) const

View File

@ -37,7 +37,7 @@ public:
static const map<string, id_set> GetReservedFiles() { return reserved_files; } const static const map<string, id_set> GetReservedFiles() { return reserved_files; } const
static void SetReservedFiles(const map<string, id_set>& files_in_use) { FileSupport::reserved_files = files_in_use; } static void SetReservedFiles(const map<string, id_set>& files_in_use) { FileSupport::reserved_files = files_in_use; }
void ReserveFile(const Filepath&, int, int); void ReserveFile(const Filepath&, int, int);
void UnreserveFile(const Filepath&); void UnreserveFile();
bool GetIdsForReservedFile(const Filepath&, int&, int&) const; bool GetIdsForReservedFile(const Filepath&, int&, int&) const;
static void UnreserveAll(); static void UnreserveAll();

View File

@ -867,9 +867,7 @@ bool ProcessCmd(int fd, const PbDeviceDefinition& pb_device, const PbOperation o
FileSupport *file_support = dynamic_cast<FileSupport *>(device); FileSupport *file_support = dynamic_cast<FileSupport *>(device);
if (file_support) { if (file_support) {
Filepath filepath; file_support->UnreserveFile();
file_support->GetPath(filepath);
file_support->UnreserveFile(filepath);
} }
// Re-map the controller, remember the device type because the device gets lost when re-mapping // Re-map the controller, remember the device type because the device gets lost when re-mapping

View File

@ -382,7 +382,7 @@ PbDeviceType ParseType(const char *optarg)
return type; return type;
} }
else { else {
// Parse legacy types // Parse type shortcuts
switch (tolower(optarg[0])) { switch (tolower(optarg[0])) {
case 'c': case 'c':
return SCCD; return SCCD;
@ -393,8 +393,14 @@ PbDeviceType ParseType(const char *optarg)
case 'd': case 'd':
return SCDP; return SCDP;
case 'h':
return SCHD;
case 'm': case 'm':
return SCMO; return SCMO;
case 'r':
return SCRM;
} }
} }