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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_ADM_H
28 #define	_FMD_ADM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <fm/fmd_api.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Fault Management Daemon Administrative Interfaces
40  *
41  * Note: The contents of this file are private to the implementation of the
42  * Solaris system and FMD subsystem and are subject to change at any time
43  * without notice.  Applications and drivers using these interfaces will fail
44  * to run on future releases.  These interfaces should not be used for any
45  * purpose until they are publicly documented for use outside of Sun.
46  */
47 
48 #define	FMD_ADM_VERSION	1		/* library ABI interface version */
49 #define	FMD_ADM_PROGRAM	0		/* connect library to system fmd */
50 
51 typedef struct fmd_adm fmd_adm_t;
52 
53 extern fmd_adm_t *fmd_adm_open(const char *, uint32_t, int);
54 extern void fmd_adm_close(fmd_adm_t *);
55 extern const char *fmd_adm_errmsg(fmd_adm_t *);
56 
57 typedef struct fmd_adm_stats {
58 	fmd_stat_t *ams_buf;		/* statistics data array */
59 	uint_t ams_len;			/* length of data array */
60 } fmd_adm_stats_t;
61 
62 extern int fmd_adm_stats_read(fmd_adm_t *, const char *, fmd_adm_stats_t *);
63 extern int fmd_adm_stats_free(fmd_adm_t *, fmd_adm_stats_t *);
64 
65 typedef struct fmd_adm_modinfo {
66 	const char *ami_name;		/* string name of module */
67 	const char *ami_desc;		/* module description */
68 	const char *ami_vers;		/* module version */
69 	uint_t ami_flags;		/* flags (see below) */
70 } fmd_adm_modinfo_t;
71 
72 #define	FMD_ADM_MOD_FAILED	0x1	/* module has failed */
73 
74 typedef int fmd_adm_module_f(const fmd_adm_modinfo_t *, void *);
75 
76 extern int fmd_adm_module_iter(fmd_adm_t *, fmd_adm_module_f *, void *);
77 extern int fmd_adm_module_load(fmd_adm_t *, const char *);
78 extern int fmd_adm_module_unload(fmd_adm_t *, const char *);
79 extern int fmd_adm_module_reset(fmd_adm_t *, const char *);
80 extern int fmd_adm_module_stats(fmd_adm_t *, const char *, fmd_adm_stats_t *);
81 extern int fmd_adm_module_gc(fmd_adm_t *, const char *);
82 
83 typedef struct fmd_adm_rsrcinfo {
84 	const char *ari_fmri;		/* fmri name of resource */
85 	const char *ari_uuid;		/* uuid name of resource */
86 	const char *ari_case;		/* uuid of case associated w/ state */
87 	uint_t ari_flags;		/* flags (see below) */
88 } fmd_adm_rsrcinfo_t;
89 
90 #define	FMD_ADM_RSRC_FAULTY	0x1	/* resource is faulty */
91 #define	FMD_ADM_RSRC_UNUSABLE	0x2	/* resource is unusable */
92 #define	FMD_ADM_RSRC_INVISIBLE	0x4	/* resource is not directly visible */
93 
94 typedef int fmd_adm_rsrc_f(const fmd_adm_rsrcinfo_t *, void *);
95 
96 extern int fmd_adm_rsrc_iter(fmd_adm_t *, int, fmd_adm_rsrc_f *, void *);
97 extern int fmd_adm_rsrc_flush(fmd_adm_t *, const char *);
98 extern int fmd_adm_rsrc_repair(fmd_adm_t *, const char *);
99 extern int fmd_adm_case_repair(fmd_adm_t *, const char *);
100 
101 typedef struct fmd_adm_serdinfo {
102 	const char *asi_name;		/* name of serd engine */
103 	uint64_t asi_delta;		/* nsecs from oldest event to now */
104 	uint64_t asi_n;			/* N parameter (event count) */
105 	uint64_t asi_t;			/* T parameter (nanoseconds) */
106 	uint_t asi_count;		/* number of events in engine */
107 	uint_t asi_flags;		/* flags (see below) */
108 } fmd_adm_serdinfo_t;
109 
110 #define	FMD_ADM_SERD_FIRED	0x1	/* serd engine has fired */
111 
112 typedef int fmd_adm_serd_f(const fmd_adm_serdinfo_t *, void *);
113 
114 extern int fmd_adm_serd_iter(fmd_adm_t *, const char *,
115     fmd_adm_serd_f *, void *);
116 extern int fmd_adm_serd_reset(fmd_adm_t *, const char *, const char *);
117 
118 typedef int fmd_adm_xprt_f(id_t, void *);
119 
120 extern int fmd_adm_xprt_iter(fmd_adm_t *, fmd_adm_xprt_f *, void *);
121 extern int fmd_adm_xprt_stats(fmd_adm_t *, id_t, fmd_adm_stats_t *);
122 
123 extern int fmd_adm_log_rotate(fmd_adm_t *, const char *);
124 
125 #ifdef	__cplusplus
126 }
127 #endif
128 
129 #endif	/* _FMD_ADM_H */
130