Print this page
OS-1840 fmdump shall emit JSON (copyright fixes)
OS-1840 fmdump shall emit JSON (use library)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fm/fmdump/common/nvlrender.c
          +++ new/usr/src/cmd/fm/fmdump/common/nvlrender.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  /*
  26   27   * Rendering functions for nvlist_prt that are of use to all types
  27   28   * of log.
  28   29   */
  29   30  
  30   31  #include <fmdump.h>
  31   32  #include <stdio.h>
  32   33  #include <strings.h>
↓ open down ↓ 31 lines elided ↑ open up ↑
  64   65          if (topo_fmri_nvl2str(thp, fmri, &fmristr, &err) != 0 ||
  65   66              fmristr == NULL)
  66   67                  return (0);
  67   68  
  68   69          nvlist_prtctl_doindent(pctl, 1);
  69   70          nvlist_prtctl_dofmt(pctl, NVLIST_FMT_MEMBER_NAME, name);
  70   71          (void) fprintf(fp, "%s", fmristr);
  71   72          topo_hdl_strfree(thp, fmristr);
  72   73  
  73   74          return (1);
       75 +}
       76 +
       77 +/*
       78 + * Thin wrapper around libnvpair's inbuilt JSON routine.  Simply dumps the
       79 + * entire log record nvlist without any reformatting.
       80 + */
       81 +int
       82 +fmdump_print_json(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
       83 +{
       84 +        nvlist_print_json(fp, rp->rec_nvl);
       85 +        fprintf(fp, "\n");
       86 +
       87 +        return (0);
  74   88  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX