dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / fm / fmdump / common / fmdump.h
blobcc26e0c756fd143954d64747a13d17a6d469a0f2
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
26 #ifndef _FMDUMP_H
27 #define _FMDUMP_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #include <assert.h>
34 #include <stdarg.h>
35 #include <stdio.h>
36 #include <synch.h>
38 #include <sys/types.h>
39 #include <sys/fm/protocol.h>
41 #include <fm/fmd_log.h>
42 #include <fm/fmd_msg.h>
43 #include <fm/libtopo.h>
45 #ifdef DEBUG
46 #define ASSERT(x) (assert(x))
47 #else
48 #define ASSERT(x)
49 #endif
51 enum {
52 FMDUMP_SHORT,
53 FMDUMP_VERB1,
54 FMDUMP_VERB2,
55 FMDUMP_PRETTY,
56 FMDUMP_MSG,
57 FMDUMP_JSON,
58 FMDUMP_NFMTS
61 typedef struct fmdump_ops {
62 const char *do_label;
63 struct fmdump_fmt {
64 const char *do_hdr;
65 fmd_log_rec_f *do_func;
66 } do_formats[FMDUMP_NFMTS];
67 } fmdump_ops_t;
69 typedef struct fmdump_arg {
70 const struct fmdump_fmt *da_fmt;
71 fmd_log_filter_t *da_fv;
72 uint_t da_fc;
73 FILE *da_fp;
74 } fmdump_arg_t;
76 typedef struct fmdump_lyr {
77 fmd_log_rec_f *dy_func;
78 void *dy_arg;
79 FILE *dy_fp;
80 } fmdump_lyr_t;
82 extern const fmdump_ops_t fmdump_err_ops;
83 extern const fmdump_ops_t fmdump_flt_ops;
84 extern const fmdump_ops_t fmdump_asru_ops;
85 extern const fmdump_ops_t fmdump_info_ops;
87 extern const char *g_pname;
88 extern ulong_t g_errs;
89 extern ulong_t g_recs;
90 extern char *g_root;
92 extern struct topo_hdl *g_thp;
93 extern fmd_msg_hdl_t *g_msg;
95 extern void fmdump_printf(FILE *, const char *, ...);
96 extern void fmdump_warn(const char *, ...);
97 extern void fmdump_vwarn(const char *, va_list);
99 extern char *fmdump_date(char *, size_t, const fmd_log_record_t *);
100 extern char *fmdump_year(char *, size_t, const fmd_log_record_t *);
101 extern char *fmdump_nvl2str(nvlist_t *nvl);
103 extern int fmdump_render_nvlist(nvlist_prtctl_t, void *, nvlist_t *,
104 const char *, nvlist_t *);
106 extern int fmdump_print_json(fmd_log_t *, const fmd_log_record_t *, FILE *);
108 #ifdef __cplusplus
110 #endif
112 #endif /* _FMDUMP_H */