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


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

  23  */
  24 
  25 #ifndef _LIBNVPAIR_H
  26 #define _LIBNVPAIR_H
  27 
  28 #include <sys/nvpair.h>
  29 #include <stdlib.h>
  30 #include <stdio.h>
  31 #include <regex.h>
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 /*
  38  * All interfaces described in this file are private to Solaris, and
  39  * are subject to change at any time and without notice.  The public
  40  * nvlist/nvpair interfaces, as documented in manpage sections 3NVPAIR,
  41  * are all imported from <sys/nvpair.h> included above.
  42  */
  43 
  44 extern int nvpair_value_match(nvpair_t *, int, char *, char **);
  45 extern int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *,
  46     char **);
  47 
  48 extern void nvlist_print(FILE *, nvlist_t *);

  49 extern void dump_nvlist(nvlist_t *, int);
  50 
  51 /*
  52  * Private nvlist printing interface that allows the caller some control
  53  * over output rendering (as opposed to nvlist_print and dump_nvlist).
  54  *
  55  * Obtain an opaque nvlist_prtctl_t cookie using nvlist_prtctl_alloc
  56  * (NULL on failure);  on return the cookie is set up for default formatting
  57  * and rendering.  Quote the cookie in subsequent customisation functions and
  58  * then pass the cookie to nvlist_prt to render the nvlist.  Finally,
  59  * use nvlist_prtctl_free to release the cookie.
  60  *
  61  * For all nvlist_lookup_xxx and nvlist_lookup_xxx_array functions
  62  * we have a corresponding brace of functions that appoint replacement
  63  * rendering functions:
  64  *
  65  *      extern void nvlist_prtctl_xxx(nvlist_prtctl_t,
  66  *          void (*)(nvlist_prtctl_t ctl, void *private, const char *name,
  67  *          xxxtype value))
  68  *




   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) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  24  */
  25 
  26 #ifndef _LIBNVPAIR_H
  27 #define _LIBNVPAIR_H
  28 
  29 #include <sys/nvpair.h>
  30 #include <stdlib.h>
  31 #include <stdio.h>
  32 #include <regex.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 /*
  39  * All interfaces described in this file are private to Solaris, and
  40  * are subject to change at any time and without notice.  The public
  41  * nvlist/nvpair interfaces, as documented in manpage sections 3NVPAIR,
  42  * are all imported from <sys/nvpair.h> included above.
  43  */
  44 
  45 extern int nvpair_value_match(nvpair_t *, int, char *, char **);
  46 extern int nvpair_value_match_regex(nvpair_t *, int, char *, regex_t *,
  47     char **);
  48 
  49 extern void nvlist_print(FILE *, nvlist_t *);
  50 extern void nvlist_print_json(FILE *, nvlist_t *);
  51 extern void dump_nvlist(nvlist_t *, int);
  52 
  53 /*
  54  * Private nvlist printing interface that allows the caller some control
  55  * over output rendering (as opposed to nvlist_print and dump_nvlist).
  56  *
  57  * Obtain an opaque nvlist_prtctl_t cookie using nvlist_prtctl_alloc
  58  * (NULL on failure);  on return the cookie is set up for default formatting
  59  * and rendering.  Quote the cookie in subsequent customisation functions and
  60  * then pass the cookie to nvlist_prt to render the nvlist.  Finally,
  61  * use nvlist_prtctl_free to release the cookie.
  62  *
  63  * For all nvlist_lookup_xxx and nvlist_lookup_xxx_array functions
  64  * we have a corresponding brace of functions that appoint replacement
  65  * rendering functions:
  66  *
  67  *      extern void nvlist_prtctl_xxx(nvlist_prtctl_t,
  68  *          void (*)(nvlist_prtctl_t ctl, void *private, const char *name,
  69  *          xxxtype value))
  70  *