Поделиться через


Processing Tape Device Control Requests

All tape miniclass drivers must report status using the values listed in the TAPE_STATUS enumerator. However, when the tape class driver completes an I/O control request, it reports status using the equivalent NT Status Values. The following table provides a mapping between TAPE_STATUS values and their equivalent NT status values:

NT Status Value Tape Status Value

STATUS_INSUFFICIENT_RESOURCES

TAPE_STATUS_INSUFFICIENT_RESOURCES

STATUS_NOT_IMPLEMENTED

TAPE_STATUS_NOT_IMPLEMENTED

STATUS_INVALID_DEVICE_REQUEST

TAPE_STATUS_INVALID_DEVICE_REQUEST

STATUS_INVALID_PARAMETER

TAPE_STATUS_INVALID_PARAMETER

STATUS_VERIFY_REQUIRED

TAPE_STATUS_MEDIA_CHANGED

STATUS_BUS_RESET

TAPE_STATUS_BUS_RESET

STATUS_SETMARK_DETECTED

TAPE_STATUS_SETMARK_DETECTED

STATUS_FILEMARK_DETECTED

TAPE_STATUS_FILEMARK_DETECTED

STATUS_BEGINNING_OF_MEDIA

TAPE_STATUS_BEGINNING_OF_MEDIA

STATUS_END_OF_MEDIA

TAPE_STATUS_END_OF_MEDIA

STATUS_BUFFER_OVERFLOW

TAPE_STATUS_BUFFER_OVERFLOW

STATUS_NO_DATA_DETECTED

TAPE_STATUS_NO_DATA_DETECTED

STATUS_EOM_OVERFLOW

TAPE_STATUS_EOM_OVERFLOW

STATUS_NO_MEDIA

TAPE_STATUS_NO_MEDIA

STATUS_IO_DEVICE_ERROR

TAPE_STATUS_IO_DEVICE_ERROR

STATUS_UNRECOGNIZED_MEDIA

TAPE_STATUS_UNRECOGNIZED_MEDIA

STATUS_DEVICE_NOT_READY

TAPE_STATUS_DEVICE_NOT_READY

STATUS_MEDIA_WRITE_PROTECTED

TAPE_STATUS_MEDIA_WRITE_PROTECTED

STATUS_DEVICE_DATA_ERROR

TAPE_STATUS_DEVICE_DATA_ERROR

STATUS_NO_SUCH_DEVICE

TAPE_STATUS_NO_SUCH_DEVICE

STATUS_INVALID_BLOCK_LENGTH

TAPE_STATUS_INVALID_BLOCK_LENGTH

STATUS_IO_TIMEOUT

TAPE_STATUS_IO_TIMEOUT

STATUS_DEVICE_NOT_CONNECTED

TAPE_STATUS_DEVICE_NOT_CONNECTED

STATUS_DATA_OVERRUN

TAPE_STATUS_DATA_OVERRUN

STATUS_DEVICE_BUSY

TAPE_STATUS_DEVICE_BUSY

STATUS_DEVICE_REQUIRES_CLEANING

TAPE_STATUS_REQUIRES_CLEANING

STATUS_CLEANER_CARTRIDGE_INSTALLED

TAPE_STATUS_CLEANER_CARTRIDGE_INSTALLED

Whenever the class driver must call a miniclass routine more than once to complete a request, the miniclass driver uses the return status to indicate whether the request is complete or whether the routine should be called again. The tape class driver maintains a zero-based count of the number of times that it has called the miniclass routine for a given request and passes that count to the routine as the CallNumber parameter.

A miniclass routine returns one of the following status values to indicate that the class driver should call the routine again:

  • TAPE_STATUS_SEND_SRB_AND_CALLBACK

    This return value directs the tape class driver to send the SRB to the device. A tape miniclass routine usually returns this status after filling in the SRB passed by the tape class driver. If the operation is successful, the class driver increments CallNumber and calls the miniclass routine again. If the SRB fails, the class driver calls the miniclass routine again depending on the value of RetryFlags.

  • TAPE_STATUS_CHECK_TEST_UNIT_READY

    This return value directs the tape class driver to create an SRB for the test unit ready command and to send the SRB to the device.

  • TAPE_STATUS_CALLBACK

    This return value directs the tape class driver to increment CallNumber without sending an SRB to the device. This streamlines case statements that support several devices. For example, suppose that most of the tape devices supported by a particular miniclass driver require three SRBs to process a certain request. One device, however, requires only the first and third SRBs. For the unique device the tape miniclass driver can return TAPE_STATUS_CALLBACK to skip the second SRB, allowing the driver to use the same code to process the request for all the devices it supports.

  • TAPE_STATUS_REQUIRES_CLEANING

    If a tape device supports cleaning notification in sense data rather than as an error, a tape miniclass driver's TapeMiniGetStatus routine returns this status to indicate to the tape class driver that the drive needs cleaning.

When the miniclass routine finishes processing a request--either successfully or with an error after retries are exhausted--it returns to the tape class driver with a TAPE_STATUS_XXX that indicates the success or failure of the request.