This routine performs a SCSI Request Sense command, or equivalent
if some other I/O architecture is supported. It is used by all
MRD API routines to determine the cause of a command failure.
The robot_info is the address of a robot_info_t structure that
has been opened by mrd_startup(3mrd). If the medium changer isn't
opened, the Request Sense command will fail with the operating
system error for trying to use an unopened device.
The dev_status_t structure includes the code, os_status, and SCSI
error fields. The following describes how to decode errors with
the dev_status_t structure.
SCSI Errors
SCSI errors are indicated when the value of the valid field of
the SCSI error is not equal to 0. The key, asc, and ascq fields
provide additional information to help determine the cause of the
error.
The code usually maps the Additional Sense Code and Additional
Sense Code Qualifier (ASC/ASCQ) values to an MRD error. The asc
and ascq values are copied from the request sense data returned
by the target.
The Additional Sense Code (asc) indicates further information
related to the error or exception condition reported in the sense
key field. The Additional Sense Code Qualifier (ascq) indicates
detailed information related to the additional sense code. For
more information, consult the SCSI-2 Specification.
Operating System Errors
Operating system errors are indicated when the value of the valid
field of the SCSI error is equal to 0 and the value of the os_
status field is not equal to 0. This result is most likely caused
by an operating system error, and probably has a mapped error in
MRD.
MRD Errors
MRD errors are indicated when the value of the os_status field is
0, and the value of the valid field of the SCSI error is 0. This
result is most likely caused when MRD encounters its own failure.
In typical usage by MRD, the os_status argument will be an
operating system specific code. However, The SCSI-2 specification
allows Request Sense to be used at any time to obtain status
information about a device. To support this feature, the MRD
implementation of mrd_reqeust_sense(3mrd) can be called with the
code MRD_CHECK_SENSE to force a Request Sense command.