1ldi_ev_finalize(9F) Kernel Functions for Drivers ldi_ev_finalize(9F)
2
3
4
6 ldi_ev_finalize - propagate disposition of a state change event
7
9 #include <sys/sunldi.h>
10
11 void ldi_ev_finalize(dev_info_t *dip, minor_t minor, int spec_type,
12 int ldi_result, ldi_ev_cookie_t cookie, void *ev_data);
13
14
16 Solaris DDI specific (Solaris DDI)
17
19 dev_info_t *dip
20
21 The devinfo node of the layered consumer exporting the minor
22 device.
23
24
25 minor_t minor
26
27 The minor number of the exported minor device.
28
29
30 int spec_type
31
32 The type of minor device (S_IFCHR or S_IFBLK).
33
34
35 int ldi_result
36
37 The final disposition of the state change.
38
39
40 ldi_ev_cookie_t cookie
41
42 An opaque event cookie for the event type returned by a previous
43 call to ldi_ev_get_cookie(9F).
44
45
46 void *ev_data
47
48 Event specific data.
49
50
52 The ldi_ev_finalize() function propagates the final disposition of an
53 event up the software stack. It may result in two actions:
54
55 o Invocation of "finalize" LDI callback handlers registered by
56 layered drivers up the software stack.
57
58 o Device contract "negotiation end" (CT_EV_NEGEND) events gen‐
59 erated on minors exported to userland.
60
61
62 The event propagated up the software stack may be different than the
63 event received by the layered driver invoking ldi_ev_finalize(). For
64 example, a volume manager may receive an "offline" event on one of it's
65 LDI opened disks, but may choose to propagate a "degraded" event on
66 minors it exports to userland (since it may have more than one copy
67 of the data). The event cookie argument to ldi_ev_notify(9F) may be
68 different from the event cookie currently possessed by the layered
69 driver. If that is the case, the layered driver must generate another
70 event cookie via a new ldi_ev_get_cookie(9F) call.
71
73 None.
74
76 This function can be called from user and kernel contexts only.
77
79 Example 1 Invoking ldi_ev_finalize(9F) from widget's finalize callback
80
81
82 The following example shows how the ldi_ev_finalize() function is
83 invoked from a widget's finalize callback:
84
85
86 static void
87 widget_finalize(ldi_handle_t lh, ldi_ev_cookie_t foo_cookie,
88 int ldi_result, void *arg, void *ev_data)
89
90 {
91 ASSERT(strcmp(ldi_ev_get_type(foo_cookie), LDI_EV_FOO) == 0);
92
93 /* Map imported minor to exported minors */
94 widget_map(lh, &minor, &spec_type);
95
96 if (ldi_result == LDI_EV_SUCCESS) {
97 ldi_ev_finalize(dip, minor, spec_type,
98 LDI_EV_SUCCESS, foo_cookie, ev_data);
99 }
100
101 /*
102 * The event foo failed. Reconfigure yourself
103 * *before* propagating
104 */
105 widget_reconfigure(lh, LDI_EV_FOO, REACQUIRE);
106
107 ldi_ev_finalize(dip, minor, spec_type, LDI_EV_FAILURE,
108 foo_cookie, ev_data);
109 }
110
111
113 ldi_ev_get_cookie(9F), ldi_ev_register_callbacks(9F),
114 ldi_ev_remove_callbacks(9F)
115
116
117
118SunOS 5.11 21 Aug 2007 ldi_ev_finalize(9F)