1eda14cbcSMatt Macy /* 2eda14cbcSMatt Macy * CDDL HEADER START 3eda14cbcSMatt Macy * 4eda14cbcSMatt Macy * The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy * Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy * You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy * 8eda14cbcSMatt Macy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9271171e0SMartin Matuska * or https://opensource.org/licenses/CDDL-1.0. 10eda14cbcSMatt Macy * See the License for the specific language governing permissions 11eda14cbcSMatt Macy * and limitations under the License. 12eda14cbcSMatt Macy * 13eda14cbcSMatt Macy * When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy * If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy * fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy * information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy * 19eda14cbcSMatt Macy * CDDL HEADER END 20eda14cbcSMatt Macy */ 21eda14cbcSMatt Macy /* 22eda14cbcSMatt Macy * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 23eda14cbcSMatt Macy * Copyright (c) 2012, 2018 by Delphix. All rights reserved. 24eda14cbcSMatt Macy */ 25eda14cbcSMatt Macy 26eda14cbcSMatt Macy #ifndef _SYS_NVPAIR_H 273ff01b23SMartin Matuska #define _SYS_NVPAIR_H extern __attribute__((visibility("default"))) 28eda14cbcSMatt Macy 29eda14cbcSMatt Macy #include <sys/types.h> 30eda14cbcSMatt Macy #include <sys/time.h> 31eda14cbcSMatt Macy #include <sys/errno.h> 32eda14cbcSMatt Macy 33eda14cbcSMatt Macy #ifdef __cplusplus 34eda14cbcSMatt Macy extern "C" { 35eda14cbcSMatt Macy #endif 36eda14cbcSMatt Macy 37eda14cbcSMatt Macy typedef enum { 38eda14cbcSMatt Macy DATA_TYPE_DONTCARE = -1, 39eda14cbcSMatt Macy DATA_TYPE_UNKNOWN = 0, 40eda14cbcSMatt Macy DATA_TYPE_BOOLEAN, 41eda14cbcSMatt Macy DATA_TYPE_BYTE, 42eda14cbcSMatt Macy DATA_TYPE_INT16, 43eda14cbcSMatt Macy DATA_TYPE_UINT16, 44eda14cbcSMatt Macy DATA_TYPE_INT32, 45eda14cbcSMatt Macy DATA_TYPE_UINT32, 46eda14cbcSMatt Macy DATA_TYPE_INT64, 47eda14cbcSMatt Macy DATA_TYPE_UINT64, 48eda14cbcSMatt Macy DATA_TYPE_STRING, 49eda14cbcSMatt Macy DATA_TYPE_BYTE_ARRAY, 50eda14cbcSMatt Macy DATA_TYPE_INT16_ARRAY, 51eda14cbcSMatt Macy DATA_TYPE_UINT16_ARRAY, 52eda14cbcSMatt Macy DATA_TYPE_INT32_ARRAY, 53eda14cbcSMatt Macy DATA_TYPE_UINT32_ARRAY, 54eda14cbcSMatt Macy DATA_TYPE_INT64_ARRAY, 55eda14cbcSMatt Macy DATA_TYPE_UINT64_ARRAY, 56eda14cbcSMatt Macy DATA_TYPE_STRING_ARRAY, 57eda14cbcSMatt Macy DATA_TYPE_HRTIME, 58eda14cbcSMatt Macy DATA_TYPE_NVLIST, 59eda14cbcSMatt Macy DATA_TYPE_NVLIST_ARRAY, 60eda14cbcSMatt Macy DATA_TYPE_BOOLEAN_VALUE, 61eda14cbcSMatt Macy DATA_TYPE_INT8, 62eda14cbcSMatt Macy DATA_TYPE_UINT8, 63eda14cbcSMatt Macy DATA_TYPE_BOOLEAN_ARRAY, 64eda14cbcSMatt Macy DATA_TYPE_INT8_ARRAY, 652fec3ae8SWarner Losh #if !defined(_KERNEL) && !defined(_STANDALONE) 66eda14cbcSMatt Macy DATA_TYPE_UINT8_ARRAY, 67eda14cbcSMatt Macy DATA_TYPE_DOUBLE 68eda14cbcSMatt Macy #else 69eda14cbcSMatt Macy DATA_TYPE_UINT8_ARRAY 70eda14cbcSMatt Macy #endif 71eda14cbcSMatt Macy } data_type_t; 72eda14cbcSMatt Macy 73eda14cbcSMatt Macy typedef struct nvpair { 74eda14cbcSMatt Macy int32_t nvp_size; /* size of this nvpair */ 75eda14cbcSMatt Macy int16_t nvp_name_sz; /* length of name string */ 76eda14cbcSMatt Macy int16_t nvp_reserve; /* not used */ 77eda14cbcSMatt Macy int32_t nvp_value_elem; /* number of elements for array types */ 78eda14cbcSMatt Macy data_type_t nvp_type; /* type of value */ 79*2a58b312SMartin Matuska char nvp_name[]; /* name string */ 80eda14cbcSMatt Macy /* aligned ptr array for string arrays */ 81eda14cbcSMatt Macy /* aligned array of data for value */ 82eda14cbcSMatt Macy } nvpair_t; 83eda14cbcSMatt Macy 84eda14cbcSMatt Macy /* nvlist header */ 85eda14cbcSMatt Macy typedef struct nvlist { 86eda14cbcSMatt Macy int32_t nvl_version; 87eda14cbcSMatt Macy uint32_t nvl_nvflag; /* persistent flags */ 88eda14cbcSMatt Macy uint64_t nvl_priv; /* ptr to private data if not packed */ 89eda14cbcSMatt Macy uint32_t nvl_flag; 90eda14cbcSMatt Macy int32_t nvl_pad; /* currently not used, for alignment */ 91eda14cbcSMatt Macy } nvlist_t; 92eda14cbcSMatt Macy 93eda14cbcSMatt Macy /* nvp implementation version */ 94eda14cbcSMatt Macy #define NV_VERSION 0 95eda14cbcSMatt Macy 96eda14cbcSMatt Macy /* nvlist pack encoding */ 97eda14cbcSMatt Macy #define NV_ENCODE_NATIVE 0 98eda14cbcSMatt Macy #define NV_ENCODE_XDR 1 99eda14cbcSMatt Macy 100eda14cbcSMatt Macy /* nvlist persistent unique name flags, stored in nvl_nvflags */ 101eda14cbcSMatt Macy #define NV_UNIQUE_NAME 0x1 102eda14cbcSMatt Macy #define NV_UNIQUE_NAME_TYPE 0x2 103eda14cbcSMatt Macy 104eda14cbcSMatt Macy /* nvlist lookup pairs related flags */ 105eda14cbcSMatt Macy #define NV_FLAG_NOENTOK 0x1 106eda14cbcSMatt Macy 107eda14cbcSMatt Macy /* convenience macros */ 108eda14cbcSMatt Macy #define NV_ALIGN(x) (((ulong_t)(x) + 7ul) & ~7ul) 109eda14cbcSMatt Macy #define NV_ALIGN4(x) (((x) + 3) & ~3) 110eda14cbcSMatt Macy 111eda14cbcSMatt Macy #define NVP_SIZE(nvp) ((nvp)->nvp_size) 112*2a58b312SMartin Matuska #define NVP_NAME(nvp) ((nvp)->nvp_name) 113eda14cbcSMatt Macy #define NVP_TYPE(nvp) ((nvp)->nvp_type) 114eda14cbcSMatt Macy #define NVP_NELEM(nvp) ((nvp)->nvp_value_elem) 115eda14cbcSMatt Macy #define NVP_VALUE(nvp) ((char *)(nvp) + NV_ALIGN(sizeof (nvpair_t) \ 116eda14cbcSMatt Macy + (nvp)->nvp_name_sz)) 117eda14cbcSMatt Macy 118eda14cbcSMatt Macy #define NVL_VERSION(nvl) ((nvl)->nvl_version) 119eda14cbcSMatt Macy #define NVL_SIZE(nvl) ((nvl)->nvl_size) 120eda14cbcSMatt Macy #define NVL_FLAG(nvl) ((nvl)->nvl_flag) 121eda14cbcSMatt Macy 122eda14cbcSMatt Macy /* NV allocator framework */ 123eda14cbcSMatt Macy typedef struct nv_alloc_ops nv_alloc_ops_t; 124eda14cbcSMatt Macy 125eda14cbcSMatt Macy typedef struct nv_alloc { 126eda14cbcSMatt Macy const nv_alloc_ops_t *nva_ops; 127eda14cbcSMatt Macy void *nva_arg; 128eda14cbcSMatt Macy } nv_alloc_t; 129eda14cbcSMatt Macy 130eda14cbcSMatt Macy struct nv_alloc_ops { 131eda14cbcSMatt Macy int (*nv_ao_init)(nv_alloc_t *, va_list); 132eda14cbcSMatt Macy void (*nv_ao_fini)(nv_alloc_t *); 133eda14cbcSMatt Macy void *(*nv_ao_alloc)(nv_alloc_t *, size_t); 134eda14cbcSMatt Macy void (*nv_ao_free)(nv_alloc_t *, void *, size_t); 135eda14cbcSMatt Macy void (*nv_ao_reset)(nv_alloc_t *); 136eda14cbcSMatt Macy }; 137eda14cbcSMatt Macy 138e92ffd9bSMartin Matuska _SYS_NVPAIR_H const nv_alloc_ops_t *const nv_fixed_ops; 139e92ffd9bSMartin Matuska _SYS_NVPAIR_H nv_alloc_t *const nv_alloc_nosleep; 140eda14cbcSMatt Macy 141eda14cbcSMatt Macy #if defined(_KERNEL) 142e92ffd9bSMartin Matuska _SYS_NVPAIR_H nv_alloc_t *const nv_alloc_sleep; 143e92ffd9bSMartin Matuska _SYS_NVPAIR_H nv_alloc_t *const nv_alloc_pushpage; 144eda14cbcSMatt Macy #endif 145eda14cbcSMatt Macy 1463ff01b23SMartin Matuska _SYS_NVPAIR_H int nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *, 1473ff01b23SMartin Matuska /* args */ ...); 1483ff01b23SMartin Matuska _SYS_NVPAIR_H void nv_alloc_reset(nv_alloc_t *); 1493ff01b23SMartin Matuska _SYS_NVPAIR_H void nv_alloc_fini(nv_alloc_t *); 150eda14cbcSMatt Macy 151eda14cbcSMatt Macy /* list management */ 1523ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_alloc(nvlist_t **, uint_t, int); 1533ff01b23SMartin Matuska _SYS_NVPAIR_H void nvlist_free(nvlist_t *); 1543ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_size(nvlist_t *, size_t *, int); 1553ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_pack(nvlist_t *, char **, size_t *, int, int); 1563ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_unpack(char *, size_t, nvlist_t **, int); 157681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_dup(const nvlist_t *, nvlist_t **, int); 1583ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_merge(nvlist_t *, nvlist_t *, int); 159eda14cbcSMatt Macy 1603ff01b23SMartin Matuska _SYS_NVPAIR_H uint_t nvlist_nvflag(nvlist_t *); 161eda14cbcSMatt Macy 1623ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_xalloc(nvlist_t **, uint_t, nv_alloc_t *); 1633ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_xpack(nvlist_t *, char **, size_t *, int, 1643ff01b23SMartin Matuska nv_alloc_t *); 1653ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_xunpack(char *, size_t, nvlist_t **, nv_alloc_t *); 166681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_xdup(const nvlist_t *, nvlist_t **, nv_alloc_t *); 1673ff01b23SMartin Matuska _SYS_NVPAIR_H nv_alloc_t *nvlist_lookup_nv_alloc(nvlist_t *); 168eda14cbcSMatt Macy 1693ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_nvpair(nvlist_t *, nvpair_t *); 1703ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_boolean(nvlist_t *, const char *); 1713ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t); 1723ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_byte(nvlist_t *, const char *, uchar_t); 1733ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int8(nvlist_t *, const char *, int8_t); 1743ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint8(nvlist_t *, const char *, uint8_t); 1753ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int16(nvlist_t *, const char *, int16_t); 1763ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint16(nvlist_t *, const char *, uint16_t); 1773ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int32(nvlist_t *, const char *, int32_t); 1783ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint32(nvlist_t *, const char *, uint32_t); 1793ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int64(nvlist_t *, const char *, int64_t); 1803ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint64(nvlist_t *, const char *, uint64_t); 1813ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_string(nvlist_t *, const char *, const char *); 182681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_nvlist(nvlist_t *, const char *, const nvlist_t *); 1833ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_boolean_array(nvlist_t *, const char *, 184681ce946SMartin Matuska const boolean_t *, uint_t); 185681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_byte_array(nvlist_t *, const char *, 186681ce946SMartin Matuska const uchar_t *, uint_t); 187681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int8_array(nvlist_t *, const char *, 188681ce946SMartin Matuska const int8_t *, uint_t); 189681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint8_array(nvlist_t *, const char *, 190681ce946SMartin Matuska const uint8_t *, uint_t); 191681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int16_array(nvlist_t *, const char *, 192681ce946SMartin Matuska const int16_t *, uint_t); 193681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint16_array(nvlist_t *, const char *, 194681ce946SMartin Matuska const uint16_t *, uint_t); 195681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int32_array(nvlist_t *, const char *, 196681ce946SMartin Matuska const int32_t *, uint_t); 197681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint32_array(nvlist_t *, const char *, 198681ce946SMartin Matuska const uint32_t *, uint_t); 199681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_int64_array(nvlist_t *, const char *, 200681ce946SMartin Matuska const int64_t *, uint_t); 201681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_add_uint64_array(nvlist_t *, const char *, 202681ce946SMartin Matuska const uint64_t *, uint_t); 2033ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_string_array(nvlist_t *, const char *, 204681ce946SMartin Matuska const char * const *, uint_t); 2053ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_nvlist_array(nvlist_t *, const char *, 206681ce946SMartin Matuska const nvlist_t * const *, uint_t); 2073ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t); 2082fec3ae8SWarner Losh #if !defined(_KERNEL) && !defined(_STANDALONE) 2093ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_add_double(nvlist_t *, const char *, double); 210eda14cbcSMatt Macy #endif 211eda14cbcSMatt Macy 2123ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_remove(nvlist_t *, const char *, data_type_t); 2133ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_remove_all(nvlist_t *, const char *); 2143ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_remove_nvpair(nvlist_t *, nvpair_t *); 215eda14cbcSMatt Macy 216681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_boolean(const nvlist_t *, const char *); 217681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_boolean_value(const nvlist_t *, const char *, 2183ff01b23SMartin Matuska boolean_t *); 219681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_byte(const nvlist_t *, const char *, uchar_t *); 220681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int8(const nvlist_t *, const char *, int8_t *); 221681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint8(const nvlist_t *, const char *, 222681ce946SMartin Matuska uint8_t *); 223681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int16(const nvlist_t *, const char *, 224681ce946SMartin Matuska int16_t *); 225681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint16(const nvlist_t *, const char *, 226681ce946SMartin Matuska uint16_t *); 227681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int32(const nvlist_t *, const char *, 228681ce946SMartin Matuska int32_t *); 229681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint32(const nvlist_t *, const char *, 230681ce946SMartin Matuska uint32_t *); 231681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int64(const nvlist_t *, const char *, 232681ce946SMartin Matuska int64_t *); 233681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint64(const nvlist_t *, const char *, 234681ce946SMartin Matuska uint64_t *); 235*2a58b312SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_string(const nvlist_t *, const char *, 236*2a58b312SMartin Matuska const char **); 2373ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_nvlist(nvlist_t *, const char *, nvlist_t **); 2383ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_boolean_array(nvlist_t *, const char *, 239eda14cbcSMatt Macy boolean_t **, uint_t *); 2403ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_byte_array(nvlist_t *, const char *, uchar_t **, 2413ff01b23SMartin Matuska uint_t *); 2423ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int8_array(nvlist_t *, const char *, int8_t **, 2433ff01b23SMartin Matuska uint_t *); 2443ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint8_array(nvlist_t *, const char *, 2453ff01b23SMartin Matuska uint8_t **, uint_t *); 2463ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int16_array(nvlist_t *, const char *, 2473ff01b23SMartin Matuska int16_t **, uint_t *); 2483ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint16_array(nvlist_t *, const char *, 2493ff01b23SMartin Matuska uint16_t **, uint_t *); 2503ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int32_array(nvlist_t *, const char *, 2513ff01b23SMartin Matuska int32_t **, uint_t *); 2523ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint32_array(nvlist_t *, const char *, 2533ff01b23SMartin Matuska uint32_t **, uint_t *); 2543ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_int64_array(nvlist_t *, const char *, 2553ff01b23SMartin Matuska int64_t **, uint_t *); 2563ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_uint64_array(nvlist_t *, const char *, 2573ff01b23SMartin Matuska uint64_t **, uint_t *); 2583ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_string_array(nvlist_t *, const char *, 2593ff01b23SMartin Matuska char ***, uint_t *); 2603ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_nvlist_array(nvlist_t *, const char *, 261eda14cbcSMatt Macy nvlist_t ***, uint_t *); 2623ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *); 2633ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_pairs(nvlist_t *, int, ...); 2642fec3ae8SWarner Losh #if !defined(_KERNEL) && !defined(_STANDALONE) 265681ce946SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_double(const nvlist_t *, const char *, 266681ce946SMartin Matuska double *); 267eda14cbcSMatt Macy #endif 268eda14cbcSMatt Macy 2693ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **); 2703ff01b23SMartin Matuska _SYS_NVPAIR_H int nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, 271*2a58b312SMartin Matuska nvpair_t **, int *, const char **); 272681ce946SMartin Matuska _SYS_NVPAIR_H boolean_t nvlist_exists(const nvlist_t *, const char *); 273681ce946SMartin Matuska _SYS_NVPAIR_H boolean_t nvlist_empty(const nvlist_t *); 274eda14cbcSMatt Macy 275eda14cbcSMatt Macy /* processing nvpair */ 276681ce946SMartin Matuska _SYS_NVPAIR_H nvpair_t *nvlist_next_nvpair(nvlist_t *, const nvpair_t *); 277681ce946SMartin Matuska _SYS_NVPAIR_H nvpair_t *nvlist_prev_nvpair(nvlist_t *, const nvpair_t *); 278*2a58b312SMartin Matuska _SYS_NVPAIR_H const char *nvpair_name(const nvpair_t *); 279681ce946SMartin Matuska _SYS_NVPAIR_H data_type_t nvpair_type(const nvpair_t *); 280681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_type_is_array(const nvpair_t *); 281681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_boolean_value(const nvpair_t *, boolean_t *); 282681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_byte(const nvpair_t *, uchar_t *); 283681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int8(const nvpair_t *, int8_t *); 284681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint8(const nvpair_t *, uint8_t *); 285681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int16(const nvpair_t *, int16_t *); 286681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint16(const nvpair_t *, uint16_t *); 287681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int32(const nvpair_t *, int32_t *); 288681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint32(const nvpair_t *, uint32_t *); 289681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int64(const nvpair_t *, int64_t *); 290681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint64(const nvpair_t *, uint64_t *); 291*2a58b312SMartin Matuska _SYS_NVPAIR_H int nvpair_value_string(const nvpair_t *, const char **); 2923ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_nvlist(nvpair_t *, nvlist_t **); 2933ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_boolean_array(nvpair_t *, boolean_t **, 2943ff01b23SMartin Matuska uint_t *); 2953ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *); 2963ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *); 2973ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *); 2983ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *); 2993ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *); 3003ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *); 3013ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *); 3023ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *); 3033ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *); 304*2a58b312SMartin Matuska _SYS_NVPAIR_H int nvpair_value_string_array(nvpair_t *, const char ***, 305*2a58b312SMartin Matuska uint_t *); 3063ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *); 3073ff01b23SMartin Matuska _SYS_NVPAIR_H int nvpair_value_hrtime(nvpair_t *, hrtime_t *); 3082fec3ae8SWarner Losh #if !defined(_KERNEL) && !defined(_STANDALONE) 309681ce946SMartin Matuska _SYS_NVPAIR_H int nvpair_value_double(const nvpair_t *, double *); 310eda14cbcSMatt Macy #endif 311eda14cbcSMatt Macy 3123ff01b23SMartin Matuska _SYS_NVPAIR_H nvlist_t *fnvlist_alloc(void); 3133ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_free(nvlist_t *); 3143ff01b23SMartin Matuska _SYS_NVPAIR_H size_t fnvlist_size(nvlist_t *); 3153ff01b23SMartin Matuska _SYS_NVPAIR_H char *fnvlist_pack(nvlist_t *, size_t *); 3163ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_pack_free(char *, size_t); 3173ff01b23SMartin Matuska _SYS_NVPAIR_H nvlist_t *fnvlist_unpack(char *, size_t); 318681ce946SMartin Matuska _SYS_NVPAIR_H nvlist_t *fnvlist_dup(const nvlist_t *); 3193ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_merge(nvlist_t *, nvlist_t *); 3203ff01b23SMartin Matuska _SYS_NVPAIR_H size_t fnvlist_num_pairs(nvlist_t *); 321eda14cbcSMatt Macy 3223ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_boolean(nvlist_t *, const char *); 3233ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_boolean_value(nvlist_t *, const char *, 3243ff01b23SMartin Matuska boolean_t); 3253ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_byte(nvlist_t *, const char *, uchar_t); 3263ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int8(nvlist_t *, const char *, int8_t); 3273ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint8(nvlist_t *, const char *, uint8_t); 3283ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int16(nvlist_t *, const char *, int16_t); 3293ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint16(nvlist_t *, const char *, uint16_t); 3303ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int32(nvlist_t *, const char *, int32_t); 3313ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint32(nvlist_t *, const char *, uint32_t); 3323ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int64(nvlist_t *, const char *, int64_t); 3333ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint64(nvlist_t *, const char *, uint64_t); 3343ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_string(nvlist_t *, const char *, const char *); 3353ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *); 3363ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_nvpair(nvlist_t *, nvpair_t *); 3373ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_boolean_array(nvlist_t *, const char *, 338681ce946SMartin Matuska const boolean_t *, uint_t); 339681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_byte_array(nvlist_t *, const char *, 340681ce946SMartin Matuska const uchar_t *, uint_t); 341681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int8_array(nvlist_t *, const char *, 342681ce946SMartin Matuska const int8_t *, uint_t); 343681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint8_array(nvlist_t *, const char *, 344681ce946SMartin Matuska const uint8_t *, uint_t); 345681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int16_array(nvlist_t *, const char *, 346681ce946SMartin Matuska const int16_t *, uint_t); 3473ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint16_array(nvlist_t *, const char *, 348681ce946SMartin Matuska const uint16_t *, uint_t); 349681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int32_array(nvlist_t *, const char *, 350681ce946SMartin Matuska const int32_t *, uint_t); 3513ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint32_array(nvlist_t *, const char *, 352681ce946SMartin Matuska const uint32_t *, uint_t); 353681ce946SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_int64_array(nvlist_t *, const char *, 354681ce946SMartin Matuska const int64_t *, uint_t); 3553ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_uint64_array(nvlist_t *, const char *, 356681ce946SMartin Matuska const uint64_t *, uint_t); 3573ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_string_array(nvlist_t *, const char *, 358681ce946SMartin Matuska const char * const *, uint_t); 3593ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_add_nvlist_array(nvlist_t *, const char *, 360681ce946SMartin Matuska const nvlist_t * const *, uint_t); 361eda14cbcSMatt Macy 3623ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_remove(nvlist_t *, const char *); 3633ff01b23SMartin Matuska _SYS_NVPAIR_H void fnvlist_remove_nvpair(nvlist_t *, nvpair_t *); 364eda14cbcSMatt Macy 3653ff01b23SMartin Matuska _SYS_NVPAIR_H nvpair_t *fnvlist_lookup_nvpair(nvlist_t *, const char *); 366681ce946SMartin Matuska _SYS_NVPAIR_H boolean_t fnvlist_lookup_boolean(const nvlist_t *, const char *); 367681ce946SMartin Matuska _SYS_NVPAIR_H boolean_t fnvlist_lookup_boolean_value(const nvlist_t *, 368681ce946SMartin Matuska const char *); 369681ce946SMartin Matuska _SYS_NVPAIR_H uchar_t fnvlist_lookup_byte(const nvlist_t *, const char *); 370681ce946SMartin Matuska _SYS_NVPAIR_H int8_t fnvlist_lookup_int8(const nvlist_t *, const char *); 371681ce946SMartin Matuska _SYS_NVPAIR_H int16_t fnvlist_lookup_int16(const nvlist_t *, const char *); 372681ce946SMartin Matuska _SYS_NVPAIR_H int32_t fnvlist_lookup_int32(const nvlist_t *, const char *); 373681ce946SMartin Matuska _SYS_NVPAIR_H int64_t fnvlist_lookup_int64(const nvlist_t *, const char *); 374681ce946SMartin Matuska _SYS_NVPAIR_H uint8_t fnvlist_lookup_uint8(const nvlist_t *, const char *); 375681ce946SMartin Matuska _SYS_NVPAIR_H uint16_t fnvlist_lookup_uint16(const nvlist_t *, const char *); 376681ce946SMartin Matuska _SYS_NVPAIR_H uint32_t fnvlist_lookup_uint32(const nvlist_t *, const char *); 377681ce946SMartin Matuska _SYS_NVPAIR_H uint64_t fnvlist_lookup_uint64(const nvlist_t *, const char *); 378*2a58b312SMartin Matuska _SYS_NVPAIR_H const char *fnvlist_lookup_string(const nvlist_t *, 379*2a58b312SMartin Matuska const char *); 3803ff01b23SMartin Matuska _SYS_NVPAIR_H nvlist_t *fnvlist_lookup_nvlist(nvlist_t *, const char *); 3813ff01b23SMartin Matuska _SYS_NVPAIR_H boolean_t *fnvlist_lookup_boolean_array(nvlist_t *, const char *, 3823ff01b23SMartin Matuska uint_t *); 3833ff01b23SMartin Matuska _SYS_NVPAIR_H uchar_t *fnvlist_lookup_byte_array(nvlist_t *, const char *, 3843ff01b23SMartin Matuska uint_t *); 3853ff01b23SMartin Matuska _SYS_NVPAIR_H int8_t *fnvlist_lookup_int8_array(nvlist_t *, const char *, 3863ff01b23SMartin Matuska uint_t *); 3873ff01b23SMartin Matuska _SYS_NVPAIR_H uint8_t *fnvlist_lookup_uint8_array(nvlist_t *, const char *, 3883ff01b23SMartin Matuska uint_t *); 3893ff01b23SMartin Matuska _SYS_NVPAIR_H int16_t *fnvlist_lookup_int16_array(nvlist_t *, const char *, 3903ff01b23SMartin Matuska uint_t *); 3913ff01b23SMartin Matuska _SYS_NVPAIR_H uint16_t *fnvlist_lookup_uint16_array(nvlist_t *, const char *, 3923ff01b23SMartin Matuska uint_t *); 3933ff01b23SMartin Matuska _SYS_NVPAIR_H int32_t *fnvlist_lookup_int32_array(nvlist_t *, const char *, 3943ff01b23SMartin Matuska uint_t *); 3953ff01b23SMartin Matuska _SYS_NVPAIR_H uint32_t *fnvlist_lookup_uint32_array(nvlist_t *, const char *, 3963ff01b23SMartin Matuska uint_t *); 3973ff01b23SMartin Matuska _SYS_NVPAIR_H int64_t *fnvlist_lookup_int64_array(nvlist_t *, const char *, 3983ff01b23SMartin Matuska uint_t *); 3993ff01b23SMartin Matuska _SYS_NVPAIR_H uint64_t *fnvlist_lookup_uint64_array(nvlist_t *, const char *, 4003ff01b23SMartin Matuska uint_t *); 401eda14cbcSMatt Macy 402681ce946SMartin Matuska _SYS_NVPAIR_H boolean_t fnvpair_value_boolean_value(const nvpair_t *nvp); 403681ce946SMartin Matuska _SYS_NVPAIR_H uchar_t fnvpair_value_byte(const nvpair_t *nvp); 404681ce946SMartin Matuska _SYS_NVPAIR_H int8_t fnvpair_value_int8(const nvpair_t *nvp); 405681ce946SMartin Matuska _SYS_NVPAIR_H int16_t fnvpair_value_int16(const nvpair_t *nvp); 406681ce946SMartin Matuska _SYS_NVPAIR_H int32_t fnvpair_value_int32(const nvpair_t *nvp); 407681ce946SMartin Matuska _SYS_NVPAIR_H int64_t fnvpair_value_int64(const nvpair_t *nvp); 408681ce946SMartin Matuska _SYS_NVPAIR_H uint8_t fnvpair_value_uint8(const nvpair_t *nvp); 409681ce946SMartin Matuska _SYS_NVPAIR_H uint16_t fnvpair_value_uint16(const nvpair_t *nvp); 410681ce946SMartin Matuska _SYS_NVPAIR_H uint32_t fnvpair_value_uint32(const nvpair_t *nvp); 411681ce946SMartin Matuska _SYS_NVPAIR_H uint64_t fnvpair_value_uint64(const nvpair_t *nvp); 412*2a58b312SMartin Matuska _SYS_NVPAIR_H const char *fnvpair_value_string(const nvpair_t *nvp); 4133ff01b23SMartin Matuska _SYS_NVPAIR_H nvlist_t *fnvpair_value_nvlist(nvpair_t *nvp); 414eda14cbcSMatt Macy 415eda14cbcSMatt Macy #ifdef __cplusplus 416eda14cbcSMatt Macy } 417eda14cbcSMatt Macy #endif 418eda14cbcSMatt Macy 419eda14cbcSMatt Macy #endif /* _SYS_NVPAIR_H */ 420