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) 2010, Oracle and/or its affiliates. All rights reserved.

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


  97         nvlist_prtctl_free(pctl);
  98         return (rc);
  99 }
 100 
 101 const fmdump_ops_t fmdump_info_ops = {
 102 "info", {
 103 {
 104 "TIME                 CLASS",
 105 (fmd_log_rec_f *)info_short
 106 }, {
 107 "TIME                 UUID                                 CLASS",
 108 (fmd_log_rec_f *)info_verb1
 109 }, {
 110 "TIME                           UUID",
 111 (fmd_log_rec_f *)info_verb2
 112 }, {
 113 "TIME                           UUID",
 114 (fmd_log_rec_f *)info_pretty
 115 }, {
 116 NULL, NULL



 117 } }
 118 };


   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) 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 <stdio.h>
  28 #include <time.h>
  29 
  30 /*ARGSUSED*/
  31 static int
  32 info_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*/
  43 static int


  98         nvlist_prtctl_free(pctl);
  99         return (rc);
 100 }
 101 
 102 const fmdump_ops_t fmdump_info_ops = {
 103 "info", {
 104 {
 105 "TIME                 CLASS",
 106 (fmd_log_rec_f *)info_short
 107 }, {
 108 "TIME                 UUID                                 CLASS",
 109 (fmd_log_rec_f *)info_verb1
 110 }, {
 111 "TIME                           UUID",
 112 (fmd_log_rec_f *)info_verb2
 113 }, {
 114 "TIME                           UUID",
 115 (fmd_log_rec_f *)info_pretty
 116 }, {
 117 NULL, NULL
 118 }, {
 119 NULL,
 120 (fmd_log_rec_f *)fmdump_print_json
 121 } }
 122 };