Various ioctl operations must be performed for proper operation of the adapter device driver. The ioctl operations described here are the minimum set of commands the adapter device driver must implement to support device drivers. Other operations might be required in the adapter device driver to support, for example, system management facilities and diagnostics. Device driver writers also need to understand these ioctl operations.
Every adapter device driver must support the IOCINFO ioctl operation. The structure to be returned to the caller is the devinfo structure, including the union definition for the adapter, which can be found in the /usr/include/sys/devinfo.h file. The device driver should request the IOCINFO ioctl operation (probably during its open routine) to get the maximum transfer size of the adapter.
The following SCIOLSTART and SCIOLSTOP operations must be sent by the device driver (for the open and close routines, respectively) for each device. They cause the adapter device driver to allocate and initialize internal resources. The SCIOLHALT ioctl operation is used to abort pending or running commands, usually after signal processing by the device driver. This might be used by a device driver to end an operation instead of waiting for completion or a time out. The SCIOLRESET operation is provided for clearing device hard errors and competing initiator reservations during open processing by the device driver.
The following information is provided on the various ioctl operations:
For more information on these ioctl operations, see FCP and iSCSI Adapter ioctl Operations.
For initiator mode, the FCP device driver can issue an SCIOLEVENT ioctl operation to register for receiving asynchronous event status from the FCP adapter device driver for a particular device instance. This is an optional call for the FCP device driver, and is optionally supported for the FCP adapter device driver. A failing return code from this command, in the absence of any programming error, indicates it is not supported. If the FCP device driver requires this function, it must check the return code to verify the FCP adapter device driver supports it.
Only a kernel process or device driver can invoke these ioctls. If attempted by a user process, the ioctl will fail, and the errno global variable will be set to EPERM.
The event registration performed by this ioctl operation is allowed once per device session. Only the first SCIOLEVENT ioctl operation is accepted after the device session is opened. Succeeding SCIOLEVENT ioctl operations will fail, and the errno global variable will be set to EINVAL. The event registration is canceled automatically when the device session is closed.
The arg parameter to the SCIOLEVENT ioctl operation should be set to the address of an scsi_event_struct structure, which is defined in the /usr/include/sys/scsi_buf.h file. The following parameters are supported:
The following values for the errno global variable are supported:
0 | Indicates successful completion. |
EINVAL | An SCIOLSTART has not been issued to this device instance, or this device is already registered for async events. |
EPERM | Indicates the caller is not running in kernel mode, which is the only mode allowed to execute this operation. |