xref: /titanic_50/usr/src/cmd/fm/fmdump/common/fmdump.h (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMDUMP_H
28 #define	_FMDUMP_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdarg.h>
37 #include <stdio.h>
38 
39 #include <sys/types.h>
40 #include <sys/fm/protocol.h>
41 #include <fm/fmd_log.h>
42 #include <fm/libtopo.h>
43 
44 enum {
45 	FMDUMP_SHORT,
46 	FMDUMP_VERB1,
47 	FMDUMP_VERB2,
48 	FMDUMP_NFMTS
49 };
50 
51 typedef struct fmdump_ops {
52 	const char *do_label;
53 	struct fmdump_fmt {
54 		const char *do_hdr;
55 		fmd_log_rec_f *do_func;
56 	} do_formats[FMDUMP_NFMTS];
57 } fmdump_ops_t;
58 
59 typedef struct fmdump_arg {
60 	const struct fmdump_fmt *da_fmt;
61 	fmd_log_filter_t *da_fv;
62 	uint_t da_fc;
63 	FILE *da_fp;
64 } fmdump_arg_t;
65 
66 typedef struct fmdump_lyr {
67 	fmd_log_rec_f *dy_func;
68 	void *dy_arg;
69 	FILE *dy_fp;
70 } fmdump_lyr_t;
71 
72 extern const fmdump_ops_t fmdump_err_ops;
73 extern const fmdump_ops_t fmdump_flt_ops;
74 extern const fmdump_ops_t fmdump_asru_ops;
75 
76 extern const char *g_pname;
77 extern ulong_t g_errs;
78 extern ulong_t g_recs;
79 extern char *g_root;
80 extern struct topo_hdl *g_thp;
81 
82 extern void fmdump_printf(FILE *, const char *, ...);
83 extern void fmdump_warn(const char *, ...);
84 extern void fmdump_vwarn(const char *, va_list);
85 
86 extern char *fmdump_date(char *, size_t, const fmd_log_record_t *);
87 extern char *fmdump_year(char *, size_t, const fmd_log_record_t *);
88 extern char *fmdump_nvl2str(nvlist_t *nvl);
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _FMDUMP_H */
95