sdi_addevent(D3I) sdi_addevent(D3I)
NAME
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);
Arguments
event A structure of type sdi_event(D4I) which 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 driver
event applies.
DESCRIPTION
sdi_addevent and sdi_rmevent(D3I), together with
sdi_notifyevent(D3I), implement a driver-to-driver
communication mechanism for PDI 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
sdi_notifyevent.
Return Values
On success, SDI_RET_OK. On failure SDI_RET_ERR.
USAGE
Sdi_addevent will be called, typically from the driver's init
routine, by a driver wishing 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 needs to be notified
of the first open on a given disk. It will do so by setting
up an sdi_event structure pointing to its SDI_FIRSTOPEN event
handler, with event_pdtype set to ID_RANDOM (disk device) and
calling sdi_addevent.
To receive events for all devices of a certain type, set the
event_inquiry field 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 fields accordingly;
values of -1 for event_scsi_adr fields match any device.
Copyright 1994 Novell, Inc. Page 1
sdi_addevent(D3I) sdi_addevent(D3I)
Any event handler registered by sdi_addevent must be un-
registered by sdi_rmevent before unloading the driver.
Level
Initialization or Base.
REFERENCES
sdi_event(D4I), sdi_event_alloc(D3I), sdi_event_free(D3I),
sdi_notifyevent(D3I), sdi_rmevent(D3I)
NOTICES
Applicability
sdi: 2
Copyright 1994 Novell, Inc. Page 2