Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldi_ev_get_cookie(9f) [opensolaris man page]

ldi_ev_get_cookie(9F)					   Kernel Functions for Drivers 				     ldi_ev_get_cookie(9F)

NAME
ldi_ev_get_cookie - get an LDI event cookie for a specified event SYNOPSIS
#include <sys/sunldi.h> int ldi_ev_get_cookie(ldi_handle_t lh, char *evname, ldi_ev_cookie_t *cookiep); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
ldi_handle_t lh A layered handle representing the device for which the event notification was requested. char *evname The string name of the event. ldi_ev_cookie_t *cookiep A pointer to type ldi_ev_cookie_t. Contains a pointer to the event cookie on return. DESCRIPTION
The ldi_ev_get_cookie() function accepts the string name of a state change event affecting the device represented by the layered driver handle "lh" and returns an opaque cookie on success. The call is successful if the framework supports event notification for the event named by "evname". If successful, the function returns an opaque cookie through the "cookiep" parameter. The cookie is required in subse- quent calls for registering callbacks on events. The following two LDI events are currently defined: LDI_EV_OFFLINE The device is moving to the offline state. LDI_EV_DEGRADE The device is moving to the degraded state. ldi_ev_get_cookie() also accepts the string name of any events defined for NDI event services. For such events, ldi_ev_get_cookie() replaces ldi_get_eventcookie(9F) (which is now obsolete). RETURN VALUES
The return values for this function are: LDI_EV_SUCCESS The event cookie was created successfully. LDI_EV_FAILURE An error occurred and the cookie was not created. CONTEXT
This function can be called from user and kernel contexts only. SEE ALSO
ldi_ev_register_callbacks(9F), ldi_ev_remove_callbacks(9F) SunOS 5.11 21 Aug 2007 ldi_ev_get_cookie(9F)

Check Out this Related Man Page

ldi_ev_finalize(9F)					   Kernel Functions for Drivers 				       ldi_ev_finalize(9F)

NAME
ldi_ev_finalize - propagate disposition of a state change event SYNOPSIS
#include <sys/sunldi.h> void ldi_ev_finalize(dev_info_t *dip, minor_t minor, int spec_type, int ldi_result, ldi_ev_cookie_t cookie, void *ev_data); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI) PARAMETERS
dev_info_t *dip The devinfo node of the layered consumer exporting the minor device. minor_t minor The minor number of the exported minor device. int spec_type The type of minor device (S_IFCHR or S_IFBLK). int ldi_result The final disposition of the state change. ldi_ev_cookie_t cookie An opaque event cookie for the event type returned by a previous call to ldi_ev_get_cookie(9F). void *ev_data Event specific data. DESCRIPTION
The ldi_ev_finalize() function propagates the final disposition of an event up the software stack. It may result in two actions: o Invocation of "finalize" LDI callback handlers registered by layered drivers up the software stack. o Device contract "negotiation end" (CT_EV_NEGEND) events generated on minors exported to userland. The event propagated up the software stack may be different than the event received by the layered driver invoking ldi_ev_finalize(). For example, a volume manager may receive an "offline" event on one of it's LDI opened disks, but may choose to propagate a "degraded" event on minors it exports to userland (since it may have more than one copy of the data). The event cookie argument to ldi_ev_notify(9F) may be different from the event cookie currently possessed by the layered driver. If that is the case, the layered driver must generate another event cookie via a new ldi_ev_get_cookie(9F) call. RETURN VALUES
None. CONTEXT
This function can be called from user and kernel contexts only. EXAMPLES
Example 1 Invoking ldi_ev_finalize(9F) from widget's finalize callback The following example shows how the ldi_ev_finalize() function is invoked from a widget's finalize callback: static void widget_finalize(ldi_handle_t lh, ldi_ev_cookie_t foo_cookie, int ldi_result, void *arg, void *ev_data) { ASSERT(strcmp(ldi_ev_get_type(foo_cookie), LDI_EV_FOO) == 0); /* Map imported minor to exported minors */ widget_map(lh, &minor, &spec_type); if (ldi_result == LDI_EV_SUCCESS) { ldi_ev_finalize(dip, minor, spec_type, LDI_EV_SUCCESS, foo_cookie, ev_data); } /* * The event foo failed. Reconfigure yourself * *before* propagating */ widget_reconfigure(lh, LDI_EV_FOO, REACQUIRE); ldi_ev_finalize(dip, minor, spec_type, LDI_EV_FAILURE, foo_cookie, ev_data); } SEE ALSO
ldi_ev_get_cookie(9F), ldi_ev_register_callbacks(9F), ldi_ev_remove_callbacks(9F) SunOS 5.11 21 Aug 2007 ldi_ev_finalize(9F)
Man Page