Print this page
8074 need to add FMA event for SSD wearout
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/fm/modules/common/disk-monitor/diskmon_conf.h
+++ new/usr/src/cmd/fm/modules/common/disk-monitor/diskmon_conf.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 + * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
25 26 */
26 27
27 28 #ifndef _DISKMOND_CONF_H
28 29 #define _DISKMOND_CONF_H
29 30
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 31 /*
33 32 * Configuration File data
34 33 */
35 34
36 35 #ifdef __cplusplus
37 36 extern "C" {
38 37 #endif
39 38
40 39 #include <sys/types.h>
41 40 #include <pthread.h>
42 41 #include <libnvpair.h>
43 42 #include <fm/fmd_api.h>
44 43 #include "dm_types.h"
45 44 #include "util.h"
46 45
47 46 #ifndef MIN
48 47 #define MIN(x, y) ((x) < (y) ? (x) : (y))
49 48 #endif
50 49
51 50 #ifndef MAX
52 51 #define MAX(x, y) ((x) > (y) ? (x) : (y))
53 52 #endif
54 53
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
55 54 #define DEVICES_PREFIX "/devices"
56 55
57 56 #define GLOBAL_PROP_LOG_LEVEL "log-level"
58 57
59 58 /* Property names (and values) for the disk configuration file entity */
60 59 #define DISK_PROP_DEVPATH "dev-path"
61 60 #define DISK_PROP_LOGNAME "logical-path"
62 61 #define DISK_PROP_FRUACTION "fru-update-action"
63 62 #define DISK_PROP_OTEMPACTION "overtemp-action"
64 63 #define DISK_PROP_STFAILACTION "selftest-fail-action"
64 +#define DISK_PROP_SSMWEAROUTACTION "ssm-wearout-action"
65 65
66 66 /* Properties for the "ap" subentity */
67 67 #define DISK_AP_PROP_APID "path"
68 68
69 69 #define DEVPATH_MINOR_SEPARATOR ':'
70 70
71 71 #define DEFAULT_FAULT_POLLING_INTERVAL 3600 /* seconds */
72 72
73 73 #define INDICATOR_FAULT_IDENTIFIER "FAULT"
74 74
75 75 typedef enum conf_err_e {
76 76 E_NO_ERROR = 0,
77 77 E_MULTIPLE_IND_LISTS_DEFINED,
78 78 E_MULTIPLE_INDRULE_LISTS_DEFINED,
79 79 E_INVALID_STATE_CHANGE,
80 80 E_IND_MULTIPLY_DEFINED,
81 81 E_IND_ACTION_REDUNDANT,
82 82 E_IND_ACTION_CONFLICT,
83 83 E_IND_MISSING_FAULT_ON,
84 84 E_IND_MISSING_FAULT_OFF,
85 85 E_INDRULE_REFERENCES_NONEXISTENT_IND_ACTION,
86 86 E_DUPLICATE_STATE_TRANSITION
87 87 } conf_err_t;
88 88
89 89 typedef enum {
90 90 INDICATOR_UNKNOWN,
91 91 INDICATOR_ON,
92 92 INDICATOR_OFF
93 93 } ind_state_t;
94 94
95 95 typedef enum {
96 96 TS_NOT_RUNNING,
97 97 TS_RUNNING,
98 98 TS_EXIT_REQUESTED,
99 99 TS_EXITED
100 100 } thread_state_t;
101 101
102 102 typedef struct ind_action {
103 103 ind_state_t ind_state;
104 104 char *ind_name;
105 105 struct ind_action *next;
106 106 } ind_action_t;
107 107
108 108 typedef struct state_transition {
109 109 hotplug_state_t begin;
110 110 hotplug_state_t end;
111 111 } state_transition_t;
112 112
113 113 typedef struct indrule {
114 114 state_transition_t strans;
115 115 ind_action_t *action_list;
116 116 struct indrule *next;
117 117 } indrule_t;
118 118
119 119 typedef struct indicator {
120 120 ind_state_t ind_state;
121 121 char *ind_name;
122 122 char *ind_instr_spec;
123 123 struct indicator *next;
124 124 } indicator_t;
125 125
126 126 typedef struct diskmon {
127 127 /*
128 128 * Static configuration data
129 129 */
130 130 nvlist_t *props;
131 131 char *location; /* descriptive location */
132 132 nvlist_t *app_props;
133 133 indicator_t *ind_list;
134 134 indrule_t *indrule_list;
135 135 /*
136 136 * Dynamic data
137 137 */
138 138 hotplug_state_t state;
139 139
140 140 /*
141 141 * Only one manager can be manipulating the
142 142 * state in the diskmon at one time (either the
143 143 * state-change manager or the fault-polling manager)
144 144 */
145 145 pthread_mutex_t manager_mutex;
146 146
147 147 /*
148 148 * Set to true only during initialization, and
149 149 * cleared the next time a fru update needs to
150 150 * occur, this flag enabled an optimization of
151 151 * NOT calling libtopo for a configuration update
152 152 * when the DE starts up. This allows a HUGE
153 153 * savings (since only a single snapshot-- the
154 154 * initial snapshot) is used as the source of
155 155 * the FRU information.
156 156 */
157 157 boolean_t initial_configuration;
158 158
159 159 /* For the state-change manager: */
160 160
161 161 /*
162 162 * Current state of the fault indicator.
163 163 */
164 164 pthread_mutex_t fault_indicator_mutex;
165 165 ind_state_t fault_indicator_state;
166 166
167 167 /*
168 168 * Set to TRUE when a disk transitions to the CONFIGURED state
169 169 * and remains TRUE until the disk is physically removed.
170 170 */
171 171 boolean_t configured_yet;
172 172
173 173 /*
174 174 * The number of disk hotplug state transitions since the disk
175 175 * was inserted.
176 176 */
177 177 uint_t state_change_count;
178 178
179 179 /* Disk FRU (model, manufacturer, etc) information */
180 180 pthread_mutex_t fru_mutex;
181 181 dm_fru_t *frup;
182 182
183 183 struct diskmon *next;
184 184 } diskmon_t;
185 185
186 186 typedef struct cfgdata {
187 187 nvlist_t *props;
188 188 diskmon_t *disk_list;
189 189 } cfgdata_t;
190 190
191 191 typedef struct namevalpr {
192 192 char *name;
193 193 char *value;
194 194 } namevalpr_t;
195 195
196 196
197 197 extern indicator_t *new_indicator(ind_state_t lstate, char *namep,
198 198 char *actionp);
199 199 extern void link_indicator(indicator_t **first,
200 200 indicator_t *to_add);
201 201 extern void ind_free(indicator_t *indp);
202 202
203 203 extern ind_action_t *new_indaction(ind_state_t state, char *namep);
204 204 extern void link_indaction(ind_action_t **first,
205 205 ind_action_t *to_add);
206 206 extern void indaction_free(ind_action_t *lap);
207 207
208 208 extern indrule_t *new_indrule(state_transition_t *st,
209 209 ind_action_t *actionp);
210 210 extern void link_indrule(indrule_t **first, indrule_t *to_add);
211 211 extern void indrule_free(indrule_t *lrp);
212 212
213 213 extern diskmon_t *new_diskmon(nvlist_t *app_props, indicator_t *indp,
214 214 indrule_t *indrp, nvlist_t *nvlp);
215 215 extern void diskmon_free(diskmon_t *dmp);
216 216
217 217 extern dm_fru_t *new_dmfru(char *manu, char *modl, char *firmrev,
218 218 char *serno, uint64_t capa);
219 219 extern void dmfru_free(dm_fru_t *frup);
220 220
221 221 extern nvlist_t *namevalpr_to_nvlist(namevalpr_t *nvprp);
222 222
223 223 extern conf_err_t check_state_transition(hotplug_state_t s1,
224 224 hotplug_state_t s2);
225 225 extern conf_err_t check_inds(indicator_t *indp);
226 226 extern conf_err_t check_indactions(ind_action_t *indap);
227 227 extern conf_err_t check_indrules(indrule_t *indrp,
228 228 state_transition_t **offender);
229 229 extern conf_err_t check_consistent_ind_indrules(indicator_t *indp,
230 230 indrule_t *indrp, ind_action_t **offender);
231 231
232 232 extern void cfgdata_add_diskmon(cfgdata_t *cfgp, diskmon_t *dmp);
233 233
234 234 extern void conf_error_msg(conf_err_t err, char *buf, int buflen,
235 235 void *arg);
236 236
237 237 extern const char *dm_prop_lookup(nvlist_t *props, const char *prop_name);
238 238 extern int dm_prop_lookup_int(nvlist_t *props,
239 239 const char *prop_name, int *value);
240 240
241 241 extern int config_init(void);
242 242 extern int config_get(fmd_hdl_t *hdl, const fmd_prop_t *fmd_props);
243 243 extern void config_fini(void);
244 244
245 245 extern const char *hotplug_state_string(hotplug_state_t state);
246 246
247 247 extern nvlist_t *dm_global_proplist(void);
248 248
249 249 #ifdef __cplusplus
250 250 }
251 251 #endif
252 252
253 253 #endif /* _DISKMOND_CONF_H */
↓ open down ↓ |
179 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX