9.1 SCSI Mass-storage Device I/O Control Codes

SCSI class drivers of mass-storage devices are required to handle a superset of the I/O control codes for IRP_MJ_DEVICE_CONTROL requests that other drivers of the same types of devices handle. See the preceding chapters about the I/O requests sent to disk, CD-ROM, and tape drivers for information about the basic requirements for all drivers of these types of devices.

This section summarizes the I/O control codes that SCSI class drivers of mass-storage devices also handle, as appropriate to the device.

The IOCTL_STORAGE_XXX control codes replace the previous IOCTL_DeviceType_XXX control codes, where DeviceType was DISK, TAPE, or CDROM. For example, IOCTL_STORAGE_RESERVE replaces IOCTL_DISK_RESERVE, IOCTL_TAPE_RESERVE, and IOCTL_CDROM_RESERVE. The new storage control codes have identical values for function code, transfer method, and required access as the previous disk, tape, and CD-ROM codes. The only difference is the device type. Drivers that pass unrecognized IOCTLs to the SCSI class driver do not need to make any changes for these new IOCTLs.

IOCTL_STORAGE_RESERVE

Operation

Claims a device on a SCSI bus with multiple initiators for the exclusive use of the caller.

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_INVALID_DEVICE_REQUEST, STATUS_DEVICE_NOT_CONNECTED, or STATUS_IO_TIMEOUT.

IOCTL_STORAGE_RELEASE

Operation

Releases a previously reserved device.

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_INVALID_DEVICE_REQUEST.

IOCTL_STORAGE_LOAD_MEDIA

Operation

Causes media to be loaded in a 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_INVALID_DEVICE_REQUEST, STATUS_NO_MEDIA_IN_DEVICE, STATUS_BUFFER_TOO_SMALL, or STATUS_DEVICE_NOT_CONNECTED.

IOCTL_STORAGE_MEDIA_REMOVAL

Operation

If the driver can prevent the media from being removed while the drive is in use, it disables or enables the mechanism that ejects media.

A driver for such a removable media which can support this IOCTL must do the following:

  1. Keep a lock count in the device object extension.

  2. Keep the lock count per physical device.

  3. When called with this IOCTL, if the flag to prevent removing the media is set, increment the count; if the flag is clear, decrement the count.

  4. Prevent removal of the media unless the count is zero.

Input

The buffer at Irp->AssociatedIrp.SystemBuffer contains a Boolean value, with TRUE indicating that the driver should lock the media in the drive.

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_INVALID_DEVICE_REQUEST, STATUS_NO_MEDIA_IN_DEVICE, or STATUS_DEVICE_NOT_CONNECTED.

IOCTL_STORAGE_EJECT_MEDIA

Operation

If the device supports it, ejects the media.

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_NO_MEDIA_IN_DEVICE or STATUS_INVALID_DEVICE_REQUEST.