DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_addevent(D3sdi)


sdi_addevent -- add a driver event handler

Synopsis

   #include <sys/scsi.h>
   #include <sys/sdi.h>
   #include <sys/ddi.h>

int sdi_addevent(struct sdi_event *event);

Description

sdi_addevent( ) is used with the sdi_rmevent(D3sdi) and sdi_notifyevent(D3sdi) functions and the sdi_event(D4sdi) structure to implement a driver-to-driver communication mechanism for SDI SCSI drivers based on event codes and SCSI device types. sdi_addevent( ) adds event to an internal list of driver events, effectively registering the driver event handler, which may later be called by the sdi_notifyevent( ) function.

Arguments


event
an sdi_event(D4sdi) structure that defines the parameters of the driver event, including the event code, SCSI device address, SCSI inquiry string, event-handling routine, and SCSI device type to which the driver event applies.

Return values

On success, SDI_RET_OK. On failure SDI_RET_ERR.

Usage

sdi_addevent( ) is typically called from the driver's init(D2sdi) entry point routine by a driver wanting to be notified of the occurrence of an event through the use of its event handler. An example of such an interaction is when the driver must to be notified of the first open on a given disk. It will do so by setting up an sdi_event structure that points to its SDI_FIRSTOPEN event handler, with event_pdtype set to ID_RANDOM (disk device) and calling the sdi_addevent( ) function.

To receive events for all devices of a certain type, set the event_inquiry member in the event structure to the desired string; null string values for event_inquiry match any device.

To receive events for devices with certain SCSI address patterns (for example, on a particular controller or with a given target ID), set the event_scsi_adr members accordingly; values of -1 for event_scsi_adr members match any device.

Any event handler registered with sdi_addevent( ) must be unregistered with sdi_rmevent( ) before unloading the driver.

Context and synchronization

Blockable context.

Applicable hardware

x86/Pentium compatible architectures

Version applicability

sdi: 2, 3, 4 target drivers.

References

sdi_event(D4sdi), sdi_event_alloc(D3sdi), sdi_event_free(D3sdi), sdi_notifyevent(D3sdi), sdi_rmevent(D3sdi)

``SDI event handling'' in HDK Technical Reference


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005