xref: /titanic_50/usr/src/cmd/fm/fmdump/common/fmdump.h (revision 554ff184129088135ad2643c1c9832174a17be88)
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 2004 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 
43 enum {
44 	FMDUMP_SHORT,
45 	FMDUMP_VERB1,
46 	FMDUMP_VERB2,
47 	FMDUMP_NFMTS
48 };
49 
50 typedef struct fmdump_ops {
51 	const char *do_label;
52 	struct fmdump_fmt {
53 		const char *do_hdr;
54 		fmd_log_rec_f *do_func;
55 	} do_formats[FMDUMP_NFMTS];
56 } fmdump_ops_t;
57 
58 typedef struct fmdump_arg {
59 	const struct fmdump_fmt *da_fmt;
60 	fmd_log_filter_t *da_fv;
61 	uint_t da_fc;
62 	FILE *da_fp;
63 } fmdump_arg_t;
64 
65 typedef struct fmdump_lyr {
66 	fmd_log_rec_f *dy_func;
67 	void *dy_arg;
68 	FILE *dy_fp;
69 } fmdump_lyr_t;
70 
71 extern const fmdump_ops_t fmdump_err_ops;
72 extern const fmdump_ops_t fmdump_flt_ops;
73 extern const fmdump_ops_t fmdump_asru_ops;
74 
75 extern const char *g_pname;
76 extern ulong_t g_errs;
77 extern ulong_t g_recs;
78 extern char *g_root;
79 
80 extern void fmdump_printf(FILE *, const char *, ...);
81 extern void fmdump_warn(const char *, ...);
82 extern void fmdump_vwarn(const char *, va_list);
83 
84 extern char *fmdump_date(char *, size_t, const fmd_log_record_t *);
85 extern char *fmdump_year(char *, size_t, const fmd_log_record_t *);
86 extern char *fmdump_nvl2str(nvlist_t *nvl);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif	/* _FMDUMP_H */
93