8.2 Tape I/O Control Codes

All public I/O control codes for drivers of tape devices use buffered I/O. Consequently, the input or output data for these requests is at Irp->AssociatedIrp.SystemBuffer.

Class drivers for SCSI tape devices handle additional public I/O control codes, along with those described in this section. See also Chapter 9 for more information about requirements for SCSI class drivers of mass-storage devices.

IOCTL_TAPE_ERASE

Operation

Erases the current tape partition, either as a TAPE_ERASE_LONG (a.k.a. “secure”) operation that overwrites data with a pattern or as a TAPE_ERASE_SHORT (a.k.a. “quick”) operation that writes an end-of-recorded-data mark at the current position.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_ERASE). If the Immediate member is TRUE, the operation should be asynchronous.

Output

None

I/O Status Block

The Information field is set to the number of bytes transferred. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_IO_DEVICE_ERROR, STATUS_MEDIA_WRITE_PROTECTED, STATUS_INSUFFICIENT_RESOURCES, STATUS_NOT_IMPLEMENTED, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_PREPARE

Operation

Loads or unloads tape, resets the tape’s tension, locks or unlocks the ejection mechanism, or formats the tape.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_PREPARE). If the Immediate member is TRUE, the operation should be asynchronous.

Output

None

I/O Status Block

The Information field is set to the number of bytes transferred. The Status field is set to STATUS_SUCCESS or possibly to STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_IO_DEVICE_ERROR, STATUS_INSUFFICIENT_RESOURCES, STATUS_DEVICE_NOT_CONNECTED, STATUS_MEDIA_WRITE_PROTECTED, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_WRITE_MARKS

Operation

Writes one of setmarks, filemarks, short filemarks, or long filemarks to tape.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_WRITE_MARKS). If the Immediate member is TRUE, the operation should be asynchronous.

Output

None

I/O Status Block

The Information field is set to the number of bytes written. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_MEDIA_WRITE_PROTECTED, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_CHECK_VERIFY

Operation

This IOCTL is replaced by IOCTL_STORAGE_CHECK_VERIFY. The only difference between the two IOCTLs is the base code.

IOCTL_STORAGE_CHECK_VERIFY

Operation

Determines whether the media has changed on a tape drive.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field must be set to either of STATUS_SUCCESS or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_GET_POSITION

Operation

Returns the current absolute, logical, or pseudological partition and offset position on the tape.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_GET_POSITION).

Output

The driver returns the TAPE_GET_POSITION data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_SET_POSITION

Operation

Moves the current position on the tape to the specified partition and offset, according to the given method.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_SET_POSITION). If the Immediate member is TRUE, the operation should be asynchronous.

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_GET_DRIVE_PARAMS

Operation

Returns information about the tape drive’s capabilities, such as its default block size, maximum and minimum block sizes, maximum partition count, whether the drive has EEC, compression, data padding, and report-setmark capabilities, that is, which configurable features the drive supports, including the EOT warning zone size.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_GET_DRIVE_PARAMETERS).

Output

The driver returns the TAPE_GET_DRIVE_PARAMETERS data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, or STATUS_DEVICE_NOT_READY.

IOCTL_TAPE_SET_DRIVE_PARAMS

Operation

Adjusts a tape drive’s configurable parameters.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_SET_DRIVE_PARAMETERS). The buffer at Irp->AssociatedIrp.SystemBuffer contains the values to be set.

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_IO_DEVICE_ERROR, STATUS_INVALID_DEVICE_REQUEST, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_INFO_LENGTH_MISMATCH, or STATUS_DEVICE_NOT_READY.

IOCTL_TAPE_GET_MEDIA_PARAMS

Operation

Returns information about the media’s total and remaining capacity, its block size, the number of partitions, and whether it is write-protected.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_GET_MEDIA_PARAMETERS).

Output

The driver returns the TAPE_GET_MEDIA_PARAMETERS data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_DATA_ERROR, STATUS_DATA_OVERRUN, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_INFO_LENGTH_MISMATCH, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_SET_MEDIA_PARAMS

Operation

Resets the block size of the media in the drive.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_SET_MEDIA_PARAMETERS). The buffer at Irp->AssociatedIrp.SystemBuffer contains the block size to be set.

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_IO_DEVICE_ERROR, STATUS_MEDIA_WRITE_PROTECTED, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_INFO_LENGTH_MISMATCH, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_GET_STATUS

Operation

Returns the current status of the drive.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_CREATE_PARTITION

Operation

Creates the specified number of fixed, select, or initiator partition(s) of the given size on the media.

Input

Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the parameter buffer, which must be >= sizeof(TAPE_CREATE_PARTITION). The buffer at Irp->AssociatedIrp.SystemBuffer specifies the partition(s) to be created.

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_IO_DEVICE_ERROR, STATUS_MEDIA_WRITE_PROTECTED, STATUS_DEVICE_DATA_ERROR, STATUS_NO_SUCH_DEVICE, STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_INFO_LENGTH_MISMATCH, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_VERIFY_REQUIRED.

IOCTL_TAPE_FIND_NEW_DEVICES

Operation

This IOCTL is replaced by IOCTL_STORAGE_FIND_NEW_DEVICES. The only difference between the two IOCTLs is the base code.

IOCTL_STORAGE_FIND_NEW_DEVICES

Operation

Determines whether another device that the driver supports has just been connected to the I/O bus. If such a device is found, the driver sets up any necessary system objects and resources to handle I/O requests for its new device. It also initializes the device on receipt of this request dynamically: that is, without requiring the machine to be rebooted. Such a driver is assumed to support devices connected on a dynamically configurable I/O bus.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to any other value returned by the driver’s (re)initialization code.