This routine performs a SCSI Read Element Status command, or
equivalent if some other I/O architecture is supported. It is
used by mrd_show(3mrd) and the routines doing volume tag checks.
However, since it provides uninterpreted Read Element Status
data, mrd_show(3mrd) will nearly always be easier to use.
It requires that the medium changer be opened by mrd_
startup(3mrd) and uses absolute element addresses. On SCSI
medium changers, it maps directly to the SCSI Read Element Status
command. Since it uses a robot_info_t structure for an open
robot, it is suitable in applications where it is desirable to
hold the robot open and not incur the robot startup time on each
command.
The type argument specifies the type of element about which
information is to be obtained. It should be one of SLOT,
TRANSPORT, PORT or DRIVE as defined in mrd_common.h. The start
argument is the absolute address of the first element and count
the number of elements for which data is to be obtained.
The data argument is an array of unsigned characters where the
resulting data will be copied. The length is the amount of
space available. If more data is required than there is space
available, the device will only data for as many element as will
fit into length bytes.
Medium Changers which are SCSI-2 compliant support Read Element
Status commands which request only eight bytes of data. In this
case the returned data will indicate how many bytes of data are
needed for the entire request. This feature allows an application
to find how much space is needed for a specific request, allocate
that much and then request all of it.
This routine uses the dev_status_t structure for handing errors.
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.