xref: /titanic_41/usr/src/cmd/fm/modules/common/eversholt/fme.h (revision 5fbb41393be5d63f75952b1d72d4df2642d22557)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * fme.h -- public definitions for fme module
26  *
27  * this module supports the management of a "fault management exercise".
28  */
29 
30 #ifndef	_EFT_FME_H
31 #define	_EFT_FME_H
32 
33 #include <fm/fmd_api.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	UNDIAG_DEFECT_CHKPT	"defect.sunos.eft.undiag.checkpoint"
40 #define	UNDIAG_DEFECT_FME	"defect.sunos.eft.undiag.fme"
41 #define	UNDIAG_DEFECT_LIMIT	"defect.sunos.eft.undiag.limit"
42 #define	UNDIAG_DEFECT_UNKNOWN	"defect.sunos.eft.undiag.unknown"
43 
44 #define	UNDIAG_REASON		"reason"
45 
46 /* Undiagnosable reason values */
47 #define	UD_VAL_UNKNOWN		0
48 #define	UD_VAL_BADEVENTI	1
49 #define	UD_VAL_BADOBS		2
50 #define	UD_VAL_CFGMISMATCH	3
51 #define	UD_VAL_INSTFAIL		4
52 #define	UD_VAL_MAXFME		5
53 #define	UD_VAL_MISSINGINFO	6
54 #define	UD_VAL_MISSINGOBS	7
55 #define	UD_VAL_MISSINGPATH	8
56 #define	UD_VAL_MISSINGZERO	9
57 #define	UD_VAL_NOPATH		10
58 #define	UD_VAL_UNSOLVD		11
59 
60 /* Undiagnosable reason strings */
61 #define	UD_STR_UNKNOWN		"undiagnosable reason unknown"
62 #define	UD_STR_MISSINGPATH	"bad or missing path in persisted observation"
63 #define	UD_STR_MISSINGINFO	"buffer persisting case info is AWOL"
64 #define	UD_STR_MISSINGZERO	"buffer persisting principal ereport is AWOL"
65 #define	UD_STR_CFGMISMATCH	"persisted config buffer size != actual size"
66 #define	UD_STR_MISSINGOBS	"buffer persisting an observation is AWOL"
67 #define	UD_STR_BADEVENTI	"ereport zero not found in instance tree"
68 #define	UD_STR_INSTFAIL	"creation of instance tree failed"
69 #define	UD_STR_UNSOLVD	"all hypotheses disproved"
70 #define	UD_STR_BADOBS	"persisted observation not found in instance tree"
71 #define	UD_STR_NOPATH	"no path to component found in ereport"
72 #define	UD_STR_MAXFME	"reached the maximum number of open FMEs (maxfme)"
73 
74 #define	WOBUF_CFGLEN	"rawcfglen"
75 #define	WOBUF_POSTD	"posted"
76 #define	WOBUF_NOBS	"observations"
77 #define	WOBUF_PULL	"timewaited"
78 #define	WOBUF_CFG	"rawcfgdata"
79 #define	WOBUF_ID	"fmeid"
80 #define	WOBUF_ISTATS	"istats"
81 #define	WOBUF_SERDS	"serds"
82 
83 struct lut *Istats;	/* instanced stats a la "count=" */
84 struct lut *SerdEngines;
85 
86 struct fme;
87 
88 void fme_receive_external_report(fmd_hdl_t *hdl, fmd_event_t *ffep,
89     nvlist_t *nvl, const char *eventstring);
90 void fme_receive_topology_change(void);
91 void fme_receive_repair_list(fmd_hdl_t *hdl, fmd_event_t *ffep,
92     nvlist_t *nvl, const char *eventstring);
93 void fme_restart(fmd_hdl_t *hdl, fmd_case_t *inprogress);
94 void fme_istat_load(fmd_hdl_t *hdl);
95 void fme_serd_load(fmd_hdl_t *hdl);
96 void fme_close_case(fmd_hdl_t *hdl, fmd_case_t *fmcase);
97 void fme_timer_fired(struct fme *, id_t);
98 void fme_status(int flags);
99 void fme_fini(void);
100 void istat_fini(void);
101 
102 struct istat_entry {
103 	const char *ename;
104 	const struct ipath *ipath;
105 };
106 int istat_cmp(struct istat_entry *ent1, struct istat_entry *ent2);
107 
108 void serd_fini(void);
109 
110 struct serd_entry {
111 	const char *ename;
112 	const struct ipath *ipath;
113 	fmd_hdl_t *hdl;
114 };
115 int serd_cmp(struct serd_entry *ent1, struct serd_entry *ent2);
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _EFT_FME_H */
122