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]
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
32 info_short(fmd_log_t
*lp
, const fmd_log_record_t
*rp
, FILE *fp
)
36 fmdump_printf(fp
, "%-20s %-32s\n",
37 fmdump_date(buf
, sizeof (buf
), rp
), rp
->rec_class
);
44 info_verb1(fmd_log_t
*lp
, const fmd_log_record_t
*rp
, FILE *fp
)
46 char *uuid
= "(absent)";
49 (void) nvlist_lookup_string(rp
->rec_nvl
, FM_IREPORT_UUID
, &uuid
);
51 fmdump_printf(fp
, "%-20s %-36s %s\n",
52 fmdump_date(buf
, sizeof (buf
), rp
), uuid
, rp
->rec_class
);
59 info_verb23_cmn(fmd_log_t
*lp
, const fmd_log_record_t
*rp
, FILE *fp
,
63 char *uuid
= "(absent)";
65 (void) nvlist_lookup_string(rp
->rec_nvl
, FM_IREPORT_UUID
, &uuid
);
67 fmdump_printf(fp
, "%-20s.%9.9llu %s\n",
68 fmdump_year(buf
, sizeof (buf
), rp
), rp
->rec_nsec
, uuid
);
71 nvlist_prt(rp
->rec_nvl
, pctl
);
73 nvlist_print(fp
, rp
->rec_nvl
);
75 fmdump_printf(fp
, "\n");
80 info_verb2(fmd_log_t
*lp
, const fmd_log_record_t
*rp
, FILE *fp
)
82 return (info_verb23_cmn(lp
, rp
, fp
, NULL
));
86 info_pretty(fmd_log_t
*lp
, const fmd_log_record_t
*rp
, FILE *fp
)
91 if ((pctl
= nvlist_prtctl_alloc()) != NULL
) {
92 nvlist_prtctl_setdest(pctl
, fp
);
93 nvlist_prtctlop_nvlist(pctl
, fmdump_render_nvlist
, NULL
);
96 rc
= info_verb23_cmn(lp
, rp
, fp
, pctl
);
98 nvlist_prtctl_free(pctl
);
102 const fmdump_ops_t fmdump_info_ops
= {
106 (fmd_log_rec_f
*)info_short
109 (fmd_log_rec_f
*)info_verb1
112 (fmd_log_rec_f
*)info_verb2
115 (fmd_log_rec_f
*)info_pretty
120 (fmd_log_rec_f
*)fmdump_print_json