sdi_event(D4I) sdi_event(D4I)
NAME
sdi_event - driver event definition structure
SYNOPSIS
#include <sys/sdi.h>
#include <sys/ddi.h>
DESCRIPTION
The sdi_event structure defines the parameters of a driver
event, including the event-handling routine, used in driver-
to-driver communication.
USAGE
This structure is passed to sdi_addevent(D3I) and
sdi_rmevent(D3I) to register and un-register event handlers.
The sdi_notifyevent(D3I) routine obtains information about
which event handlers to call from the list of registered
sdi_event structures.
sdi_event structures must be allocated with
sdi_event_alloc(D3I) and freed with sdi_event_free(D3I).
Drivers must not allocate them statically or as automatic
variables.
Structure Definitions
The sdi_event structure is defined as type struct sdi_event
and contains the following members:
int event_type; /* event type code */
int (*event_handler)(); /* address of handler routine */
void *event_info; /* event-specific info */
int event_pdtype; /* device type */
char event_inquiry[INQ_EXLEN]; /* device inquiry string */
struct scsi_adr event_scsi_adr; /* device's SCSI address */
The event field indicates the type of driver event being
manipulated. The following events are currently defined:
SDI_FIRSTOPEN First open of a particular device
SDI_LASTCLOSE Last close of a device, with no errors
SDI_LASTCLOSE_ERR Last close of a device, with errors
Note that the sdi_event mechanism as implemented allows
communicating drivers to define their own private event code
values outside of this set. That is, the event codes need
only be unique to the driver reporting the event and the
driver handling it.
Copyright 1994 Novell, Inc. Page 1
sdi_event(D4I) sdi_event(D4I)
The event_handler field points to the event handler routine.
This is a function which will be called as follows:
(*event_handler) (struct sdi_event *event, struct scsi_adr *scsi_adr,
struct sb *sbp)
The event_info field is provided as optional private data for
the driver handling the event.
The event_pdtype field holds the SCSI device type of the
device for which a driver event is being reported.
The event_inquiry and event_scsi_adr fields specify to which
devices the event will apply. A zero-length event_inquiry
string and -1 values for event_scsi_adr members act as wild
cards. Specific values can be provided to narrow the range of
devices applicable.
REFERENCES
sb(D4I), scsi_adr(D4I), sd01(7), sdi_addevent(D3I),
sdi_event_free(D3I), sdi_event_alloc(D3I),
sdi_notifyevent(D3I), sdi_rmevent(D3I)
Future Directions
The event types SDI_FIRSTOPEN, SDI_LASTCLOSE, and
SDI_LASTCLOSE_ERR are currently only generated for ID_RANDOM
type devices (random-access disks) by the sd01 target driver.
In the future, these events will also be supported for other
device types.
Copyright 1994 Novell, Inc. Page 2