This routine performs a SCSI Move Medium command, or equivalent
if some other I/O architecture is supported. It is used by mrd_
move(3mrd), mrd_load(3mrd), mrd_unload(3mrd), mrd_inject(3mrd)
and mrd_eject(3mrd). Since it accepts a robot_info_t structure
associated with an open medium changer it can be used to perform
multiple move commands, without having to re-open the medium
changer as the other functions that use it do.
The robot_info argument is the address of a robot_info_t that
has been opened by mrd_startup(3mrd). If the medium changer isn't
opened, the Move Medium command will fail with the operating
system error for trying to use an unopened device. On SCSI medium
changers, it maps directly to the SCSI Move Medium command.
The transport address is the absolute address of the transport
element to be used for the command. Many medium changers allow
the use of address zero (0) as the default transport, but some
may require a transport address that is valid for the medium
changer. For single transport medium changers, the transport
base address in the robot_info_t structure, transport_start is a
suitable address.
The source and destination addresses are absolute addresses to
be used as the source and destination for the move. The absolute
address can be calculated from a zero relative address by adding
it to the base address for the element type. The routine makes
no checks for the validity of the address, relying on the medium
changer to do this.
A invert value of one (1) can be used on medium changers that
support inverting the media, when this is desired; an optical
drive with two sided media. Otherwise a value of zero should be
used.
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.