Processing a single tape device control request can require multiple SRBs and thus multiple calls between the tape class driver and a TapeMiniProcessCommand routine. For example, to partition a tape the miniclass driver must first rewind the tape and then partition it.
When a TapeMiniProcessCommand routine is called by the tape class driver to process a request, the miniclass driver uses the return status to indicate whether the request is complete or whether the miniclass driver should be called back. The tape class driver maintains a zero-based count of the number of times a TapeMiniProcessCommand routine has been called for a given request and passes that count to the miniclass driver in the CallNumber parameter.
After building an SRB for a command, the TapeMiniProcessCommand routine usually returns to the tape class driver with the status TAPE_STATUS_SEND_SRB_AND_CALLBACK. This status directs the class driver to send the SRB to the device. If the operation is successful, the class driver increments the CallNumber and calls the TapeMiniProcessCommand routine again. If the SRB fails, the class driver returns to the calling application or to the TapeMiniProcessCommand routine, depending on the value of RetryFlags.
A TapeMiniProcessCommand routine uses the TAPE_STATUS_CHECK_TEST_UNIT_READY return status to direct the tape class driver to create an SRB for the test unit ready SCSI command and execute the command. This return status moves some work from the tape miniclass driver to the tape class driver.
A TapeMiniProcessCommand routine uses the TAPE_STATUS_CALLBACK return status to increment the CallNumber without sending an SRB to the device. This streamlines case statements that support several devices. For example, assume most of the tape devices supported by a miniclass driver require three SRBs to process a certain request. One device, however, only requires the first and third SRBs. The miniclass driver can use the same code to process the request for all its devices. For the unique device, the tape miniclass driver returns TAPE_STATUS_CALLBACK at the second step in command processing (when CallNumber equals one).
When a TapeMiniProcessCommand routine finishes processing a request, it returns to the tape class driver with a TAPE_STATUS_XXX that indicates the success or failure of the request.
For portability, the tape class/miniclass model insulates miniclass drivers from processing IOCTL codes. A miniclass driver implements the routines required in the TAPE_INIT_DATA structure, some of which equate to IOCTLs, but the miniclass driver does not operate on IOCTLs directly.