SCIOLEVENT

This operation lets a device driver register a particular device instance for receiving asynchronous event status by calling the SCIOLEVENT ioctl operation for the adapter device driver. When an event covered by the SCIOLEVENT ioctl operation is detected by the adapter device driver, it builds an scsi_event_info structure and passes a pointer to the structure and to the asynchronous event-handler routine entry point, which was previously registered.

The information reported in the scsi_event_info.events field does not queue to the device driver, but is instead reported as one or more flags as they occur. Because the data does not queue, the adapter device driver writer can use a single scsi_event_info structure and pass it one at a time, by pointer, to each asynchronous event handler routine for the appropriate device instance. After determining for which device the events are being reported, the device driver must copy the scsi_event_info.events field into local space and must not modify the contents of the rest of the scsi_event_info structure.

Because the event status is optional, the device driver writer determines what action is necessary to take upon receiving event status. The writer might decide to save the status and report it back to the calling application, or the device driver or application level program can take error recovery actions.

This operation should only be issued after a successful SCIOLSTART operation to a device. The following is a typical call:

        rc = fp_ioctl(fp, SCIOLEVENT, &scevent);

where fp is a pointer to a file structure and scevent is a scsi_event_struct structure (defined in /usr/include/sys/scsi_buf.h) that contains the SCSI and Logical Unit Number (LUN) ID values of the device to be started.

A non-zero return value indicates an error has occurred. Possible errno values are:

Item Description
EIO An unrecoverable system error has occurred.
EINVAL The adapter was not in open mode.
For FCP adapters, the version field of the scsi_event_struct structure must be set to a minimum value of SCSI_VERSION_1, which is defined in the /usr/include/sys/scsi_buf.h file. In addition, the following fields can be set:
  • world_wide_name - The caller can set the world_wide_name field to the World Wide Name of the attached target device. If Dynamic Tracking of FC devices is enabled, the world_wide_name field must be set to ensure communication with the device because the scsi_id field of a device can change after dynamic tracking events.
  • node_name - The caller can set the node_name field to the Node Name of the attached target device. If the world_wide_name field and the version field are set to SCSI_VERSION_1 but the node_name field is not set, the scsi_id field is used for device lookup instead of the world_wide_name. If Dynamic Tracking of FC devices is enabled, the node_name field must be set to ensure communication with the device because the scsi_id field of a device can change after dynamic tracking events.

This operation requires SCIOLSTART to be run first.

If the FCP SCIOLEVENT ioctl operation completes successfully, then the adap_set_flags field might have the SC_RET_ID flag set. This field is set only if the world_wide_name and node_ name fields were provided in the ioctl call and the FC adapter driver detects that the scsi_id field of this device has changed. The scsi_id field contains the new scsi_id value.