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.
.TP
.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:
hd: Hard disk (SCSI or SASI)
mo: Magneto-Optical disk
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: SCSI hard disk drive
rm: SCSI removable media drive
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
.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.

View File

@ -67,25 +67,26 @@ OPTIONS
-t TYPE
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:
hd: Hard disk (SCSI or SASI)
mo: Magneto-Optical disk
rascsi(1) man page for the available device types. For some
types there are shortcuts (only the first letter is required):
hd: SCSI hard disk drive
rm: SCSI removable media drive
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
-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
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
tomatically applied. Once set the name of a device cannot be
tomatically applied. Once set the name of a device cannot be
changed.
-u UNIT
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
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
controller. (This is not common)
EXAMPLES

View File

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

View File

@ -20,9 +20,9 @@ void FileSupport::ReserveFile(const Filepath& path, int id, int 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

View File

@ -37,7 +37,7 @@ public:
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; }
void ReserveFile(const Filepath&, int, int);
void UnreserveFile(const Filepath&);
void UnreserveFile();
bool GetIdsForReservedFile(const Filepath&, int&, int&) const;
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);
if (file_support) {
Filepath filepath;
file_support->GetPath(filepath);
file_support->UnreserveFile(filepath);
file_support->UnreserveFile();
}
// 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;
}
else {
// Parse legacy types
// Parse type shortcuts
switch (tolower(optarg[0])) {
case 'c':
return SCCD;
@ -393,8 +393,14 @@ PbDeviceType ParseType(const char *optarg)
case 'd':
return SCDP;
case 'h':
return SCHD;
case 'm':
return SCMO;
case 'r':
return SCRM;
}
}