Print this page
OS-1840 fmdump shall emit JSON
Reviewed by: Robert Mustacchi <rm@joyent.com>


   3  *
   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.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 #include <fmdump.h>
  26 #include <strings.h>
  27 #include <stdio.h>
  28 #include <time.h>
  29 
  30 /*ARGSUSED*/
  31 static int
  32 asru_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
  33 {
  34         char buf[32];
  35 
  36         fmdump_printf(fp, "%-20s %-32s\n",
  37             fmdump_date(buf, sizeof (buf), rp), rp->rec_class);
  38 
  39         return (0);
  40 }
  41 
  42 /*ARGSUSED*/


 127         nvlist_prtctl_free(pctl);
 128         return (rc);
 129 }
 130 
 131 const fmdump_ops_t fmdump_asru_ops = {
 132 "asru", {
 133 {
 134 "TIME                 CLASS",
 135 (fmd_log_rec_f *)asru_short
 136 }, {
 137 "TIME                 UUID                                 STATE",
 138 (fmd_log_rec_f *)asru_verb1
 139 }, {
 140 "TIME                           UUID                                 STATE",
 141 (fmd_log_rec_f *)asru_verb2
 142 }, {
 143 "TIME                           UUID                                 STATE",
 144 (fmd_log_rec_f *)asru_pretty
 145 }, {
 146 NULL, NULL



 147 } }
 148 };


   3  *
   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.
   7  *
   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.
  12  *
  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]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  24  */
  25 
  26 #include <fmdump.h>
  27 #include <strings.h>
  28 #include <stdio.h>
  29 #include <time.h>
  30 
  31 /*ARGSUSED*/
  32 static int
  33 asru_short(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
  34 {
  35         char buf[32];
  36 
  37         fmdump_printf(fp, "%-20s %-32s\n",
  38             fmdump_date(buf, sizeof (buf), rp), rp->rec_class);
  39 
  40         return (0);
  41 }
  42 
  43 /*ARGSUSED*/


 128         nvlist_prtctl_free(pctl);
 129         return (rc);
 130 }
 131 
 132 const fmdump_ops_t fmdump_asru_ops = {
 133 "asru", {
 134 {
 135 "TIME                 CLASS",
 136 (fmd_log_rec_f *)asru_short
 137 }, {
 138 "TIME                 UUID                                 STATE",
 139 (fmd_log_rec_f *)asru_verb1
 140 }, {
 141 "TIME                           UUID                                 STATE",
 142 (fmd_log_rec_f *)asru_verb2
 143 }, {
 144 "TIME                           UUID                                 STATE",
 145 (fmd_log_rec_f *)asru_pretty
 146 }, {
 147 NULL, NULL
 148 }, {
 149 NULL,
 150 (fmd_log_rec_f *)fmdump_print_json
 151 } }
 152 };