Copyright (c) 2007, Sun Microsystems, Inc., All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#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);
The devinfo node of the layered consumer exporting the minor device.
The minor number of the exported minor device.
The type of minor device (S_IFCHR or S_IFBLK).
The final disposition of the state change.
An opaque event cookie for the event type returned by a previous call to ldi_ev_get_cookie(9F).
Event specific data.
Invocation of "finalize" LDI callback handlers registered by layered drivers up the software stack.
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.
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); }