17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
51af9825eschrock * Common Development and Distribution License (the "License").
61af9825eschrock * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate/*
22f6e214cGavin Maltby * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
232ec7644Serapheim Dimitropoulos * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
247c478bdstevel@tonic-gate */
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate#ifndef	_SYS_NVPAIR_H
277c478bdstevel@tonic-gate#define	_SYS_NVPAIR_H
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate#include <sys/types.h>
30ad135b5Christopher Siden#include <sys/time.h>
317c478bdstevel@tonic-gate#include <sys/errno.h>
327c478bdstevel@tonic-gate#include <sys/va_list.h>
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate#if defined(_KERNEL) && !defined(_BOOT)
357c478bdstevel@tonic-gate#include <sys/kmem.h>
367c478bdstevel@tonic-gate#endif
377c478bdstevel@tonic-gate
387c478bdstevel@tonic-gate#ifdef	__cplusplus
397c478bdstevel@tonic-gateextern "C" {
407c478bdstevel@tonic-gate#endif
417c478bdstevel@tonic-gate
427c478bdstevel@tonic-gatetypedef enum {
432ec7644Serapheim Dimitropoulos	DATA_TYPE_DONTCARE = -1,
447c478bdstevel@tonic-gate	DATA_TYPE_UNKNOWN = 0,
457c478bdstevel@tonic-gate	DATA_TYPE_BOOLEAN,
467c478bdstevel@tonic-gate	DATA_TYPE_BYTE,
477c478bdstevel@tonic-gate	DATA_TYPE_INT16,
487c478bdstevel@tonic-gate	DATA_TYPE_UINT16,
497c478bdstevel@tonic-gate	DATA_TYPE_INT32,
507c478bdstevel@tonic-gate	DATA_TYPE_UINT32,
517c478bdstevel@tonic-gate	DATA_TYPE_INT64,
527c478bdstevel@tonic-gate	DATA_TYPE_UINT64,
537c478bdstevel@tonic-gate	DATA_TYPE_STRING,
547c478bdstevel@tonic-gate	DATA_TYPE_BYTE_ARRAY,
557c478bdstevel@tonic-gate	DATA_TYPE_INT16_ARRAY,
567c478bdstevel@tonic-gate	DATA_TYPE_UINT16_ARRAY,
577c478bdstevel@tonic-gate	DATA_TYPE_INT32_ARRAY,
587c478bdstevel@tonic-gate	DATA_TYPE_UINT32_ARRAY,
597c478bdstevel@tonic-gate	DATA_TYPE_INT64_ARRAY,
607c478bdstevel@tonic-gate	DATA_TYPE_UINT64_ARRAY,
617c478bdstevel@tonic-gate	DATA_TYPE_STRING_ARRAY,
627c478bdstevel@tonic-gate	DATA_TYPE_HRTIME,
637c478bdstevel@tonic-gate	DATA_TYPE_NVLIST,
647c478bdstevel@tonic-gate	DATA_TYPE_NVLIST_ARRAY,
657c478bdstevel@tonic-gate	DATA_TYPE_BOOLEAN_VALUE,
667c478bdstevel@tonic-gate	DATA_TYPE_INT8,
677c478bdstevel@tonic-gate	DATA_TYPE_UINT8,
687c478bdstevel@tonic-gate	DATA_TYPE_BOOLEAN_ARRAY,
697c478bdstevel@tonic-gate	DATA_TYPE_INT8_ARRAY,
70825ba0frobj#if !defined(_KERNEL)
71825ba0frobj	DATA_TYPE_UINT8_ARRAY,
72825ba0frobj	DATA_TYPE_DOUBLE
73825ba0frobj#else
747c478bdstevel@tonic-gate	DATA_TYPE_UINT8_ARRAY
75825ba0frobj#endif
767c478bdstevel@tonic-gate} data_type_t;
777c478bdstevel@tonic-gate
787c478bdstevel@tonic-gatetypedef struct nvpair {
797c478bdstevel@tonic-gate	int32_t nvp_size;	/* size of this nvpair */
807c478bdstevel@tonic-gate	int16_t	nvp_name_sz;	/* length of name string */
817c478bdstevel@tonic-gate	int16_t	nvp_reserve;	/* not used */
827c478bdstevel@tonic-gate	int32_t	nvp_value_elem;	/* number of elements for array types */
837c478bdstevel@tonic-gate	data_type_t nvp_type;	/* type of value */
847c478bdstevel@tonic-gate	/* name string */
857c478bdstevel@tonic-gate	/* aligned ptr array for string arrays */
867c478bdstevel@tonic-gate	/* aligned array of data for value */
877c478bdstevel@tonic-gate} nvpair_t;
887c478bdstevel@tonic-gate
897c478bdstevel@tonic-gate/* nvlist header */
907c478bdstevel@tonic-gatetypedef struct nvlist {
917c478bdstevel@tonic-gate	int32_t		nvl_version;
927c478bdstevel@tonic-gate	uint32_t	nvl_nvflag;	/* persistent flags */
937c478bdstevel@tonic-gate	uint64_t	nvl_priv;	/* ptr to private data if not packed */
947c478bdstevel@tonic-gate	uint32_t	nvl_flag;
957c478bdstevel@tonic-gate	int32_t		nvl_pad;	/* currently not used, for alignment */
967c478bdstevel@tonic-gate} nvlist_t;
977c478bdstevel@tonic-gate
987c478bdstevel@tonic-gate/* nvp implementation version */
997c478bdstevel@tonic-gate#define	NV_VERSION	0
1007c478bdstevel@tonic-gate
1017c478bdstevel@tonic-gate/* nvlist pack encoding */
1027c478bdstevel@tonic-gate#define	NV_ENCODE_NATIVE	0
1037c478bdstevel@tonic-gate#define	NV_ENCODE_XDR		1
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gate/* nvlist persistent unique name flags, stored in nvl_nvflags */
1067c478bdstevel@tonic-gate#define	NV_UNIQUE_NAME		0x1
1077c478bdstevel@tonic-gate#define	NV_UNIQUE_NAME_TYPE	0x2
1087c478bdstevel@tonic-gate
1097c478bdstevel@tonic-gate/* nvlist lookup pairs related flags */
1107c478bdstevel@tonic-gate#define	NV_FLAG_NOENTOK		0x1
1117c478bdstevel@tonic-gate
1127c478bdstevel@tonic-gate/* convenience macros */
1137c478bdstevel@tonic-gate#define	NV_ALIGN(x)		(((ulong_t)(x) + 7ul) & ~7ul)
1147c478bdstevel@tonic-gate#define	NV_ALIGN4(x)		(((x) + 3) & ~3)
1157c478bdstevel@tonic-gate
1167c478bdstevel@tonic-gate#define	NVP_SIZE(nvp)		((nvp)->nvp_size)
1177c478bdstevel@tonic-gate#define	NVP_NAME(nvp)		((char *)(nvp) + sizeof (nvpair_t))
1187c478bdstevel@tonic-gate#define	NVP_TYPE(nvp)		((nvp)->nvp_type)
1197c478bdstevel@tonic-gate#define	NVP_NELEM(nvp)		((nvp)->nvp_value_elem)
1207c478bdstevel@tonic-gate#define	NVP_VALUE(nvp)		((char *)(nvp) + NV_ALIGN(sizeof (nvpair_t) \
1217c478bdstevel@tonic-gate				+ (nvp)->nvp_name_sz))
1227c478bdstevel@tonic-gate
1237c478bdstevel@tonic-gate#define	NVL_VERSION(nvl)	((nvl)->nvl_version)
1247c478bdstevel@tonic-gate#define	NVL_SIZE(nvl)		((nvl)->nvl_size)
1257c478bdstevel@tonic-gate#define	NVL_FLAG(nvl)		((nvl)->nvl_flag)
1267c478bdstevel@tonic-gate
1277c478bdstevel@tonic-gate/* NV allocator framework */
1287c478bdstevel@tonic-gatetypedef struct nv_alloc_ops nv_alloc_ops_t;
1297c478bdstevel@tonic-gate
1307c478bdstevel@tonic-gatetypedef struct nv_alloc {
1317c478bdstevel@tonic-gate	const nv_alloc_ops_t *nva_ops;
1327c478bdstevel@tonic-gate	void *nva_arg;
1337c478bdstevel@tonic-gate} nv_alloc_t;
1347c478bdstevel@tonic-gate
1357c478bdstevel@tonic-gatestruct nv_alloc_ops {
1367c478bdstevel@tonic-gate	int (*nv_ao_init)(nv_alloc_t *, __va_list);
1377c478bdstevel@tonic-gate	void (*nv_ao_fini)(nv_alloc_t *);
1387c478bdstevel@tonic-gate	void *(*nv_ao_alloc)(nv_alloc_t *, size_t);
1397c478bdstevel@tonic-gate	void (*nv_ao_free)(nv_alloc_t *, void *, size_t);
1407c478bdstevel@tonic-gate	void (*nv_ao_reset)(nv_alloc_t *);
1417c478bdstevel@tonic-gate};
1427c478bdstevel@tonic-gate
1437c478bdstevel@tonic-gateextern const nv_alloc_ops_t *nv_fixed_ops;
1447c478bdstevel@tonic-gateextern nv_alloc_t *nv_alloc_nosleep;
1457c478bdstevel@tonic-gate
1467c478bdstevel@tonic-gate#if defined(_KERNEL) && !defined(_BOOT)
1477c478bdstevel@tonic-gateextern nv_alloc_t *nv_alloc_sleep;
1487c478bdstevel@tonic-gate#endif
1497c478bdstevel@tonic-gate
1507c478bdstevel@tonic-gateint nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *, /* args */ ...);
1517c478bdstevel@tonic-gatevoid nv_alloc_reset(nv_alloc_t *);
1527c478bdstevel@tonic-gatevoid nv_alloc_fini(nv_alloc_t *);
1537c478bdstevel@tonic-gate
1547c478bdstevel@tonic-gate/* list management */
1557c478bdstevel@tonic-gateint nvlist_alloc(nvlist_t **, uint_t, int);
1567c478bdstevel@tonic-gatevoid nvlist_free(nvlist_t *);
1577c478bdstevel@tonic-gateint nvlist_size(nvlist_t *, size_t *, int);
1587c478bdstevel@tonic-gateint nvlist_pack(nvlist_t *, char **, size_t *, int, int);
1597c478bdstevel@tonic-gateint nvlist_unpack(char *, size_t, nvlist_t **, int);
1607c478bdstevel@tonic-gateint nvlist_dup(nvlist_t *, nvlist_t **, int);
1617c478bdstevel@tonic-gateint nvlist_merge(nvlist_t *, nvlist_t *, int);
1627c478bdstevel@tonic-gate
163f6e214cGavin Maltbyuint_t nvlist_nvflag(nvlist_t *);
164f6e214cGavin Maltby
1657c478bdstevel@tonic-gateint nvlist_xalloc(nvlist_t **, uint_t, nv_alloc_t *);
1667c478bdstevel@tonic-gateint nvlist_xpack(nvlist_t *, char **, size_t *, int, nv_alloc_t *);
1677c478bdstevel@tonic-gateint nvlist_xunpack(char *, size_t, nvlist_t **, nv_alloc_t *);
1687c478bdstevel@tonic-gateint nvlist_xdup(nvlist_t *, nvlist_t **, nv_alloc_t *);
1697c478bdstevel@tonic-gatenv_alloc_t *nvlist_lookup_nv_alloc(nvlist_t *);
1707c478bdstevel@tonic-gate
1717c478bdstevel@tonic-gateint nvlist_add_nvpair(nvlist_t *, nvpair_t *);
1727c478bdstevel@tonic-gateint nvlist_add_boolean(nvlist_t *, const char *);
1737c478bdstevel@tonic-gateint nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t);
1747c478bdstevel@tonic-gateint nvlist_add_byte(nvlist_t *, const char *, uchar_t);
1757c478bdstevel@tonic-gateint nvlist_add_int8(nvlist_t *, const char *, int8_t);
1767c478bdstevel@tonic-gateint nvlist_add_uint8(nvlist_t *, const char *, uint8_t);
1777c478bdstevel@tonic-gateint nvlist_add_int16(nvlist_t *, const char *, int16_t);
1787c478bdstevel@tonic-gateint nvlist_add_uint16(nvlist_t *, const char *, uint16_t);
1797c478bdstevel@tonic-gateint nvlist_add_int32(nvlist_t *, const char *, int32_t);
1807c478bdstevel@tonic-gateint nvlist_add_uint32(nvlist_t *, const char *, uint32_t);
1817c478bdstevel@tonic-gateint nvlist_add_int64(nvlist_t *, const char *, int64_t);
1827c478bdstevel@tonic-gateint nvlist_add_uint64(nvlist_t *, const char *, uint64_t);
1837c478bdstevel@tonic-gateint nvlist_add_string(nvlist_t *, const char *, const char *);
1847c478bdstevel@tonic-gateint nvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *);
1857c478bdstevel@tonic-gateint nvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t);
1867c478bdstevel@tonic-gateint nvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t);
1877c478bdstevel@tonic-gateint nvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t);
1887c478bdstevel@tonic-gateint nvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t);
1897c478bdstevel@tonic-gateint nvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t);
1907c478bdstevel@tonic-gateint nvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t);
1917c478bdstevel@tonic-gateint nvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t);
1927c478bdstevel@tonic-gateint nvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t);
1937c478bdstevel@tonic-gateint nvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t);
1947c478bdstevel@tonic-gateint nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t);
1957c478bdstevel@tonic-gateint nvlist_add_string_array(nvlist_t *, const char *, char *const *, uint_t);
1967c478bdstevel@tonic-gateint nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
1977c478bdstevel@tonic-gateint nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t);
198825ba0frobj#if !defined(_KERNEL)
199825ba0frobjint nvlist_add_double(nvlist_t *, const char *, double);
200825ba0frobj#endif
2017c478bdstevel@tonic-gate
2027c478bdstevel@tonic-gateint nvlist_remove(nvlist_t *, const char *, data_type_t);
2037c478bdstevel@tonic-gateint nvlist_remove_all(nvlist_t *, const char *);
20492241e0Tom Ericksonint nvlist_remove_nvpair(nvlist_t *, nvpair_t *);
2057c478bdstevel@tonic-gate
2067c478bdstevel@tonic-gateint nvlist_lookup_boolean(nvlist_t *, const char *);
2077c478bdstevel@tonic-gateint nvlist_lookup_boolean_value(nvlist_t *, const char *, boolean_t *);
2087c478bdstevel@tonic-gateint nvlist_lookup_byte(nvlist_t *, const char *, uchar_t *);
2097c478bdstevel@tonic-gateint nvlist_lookup_int8(nvlist_t *, const char *, int8_t *);
2107c478bdstevel@tonic-gateint nvlist_lookup_uint8(nvlist_t *, const char *, uint8_t *);
2117c478bdstevel@tonic-gateint nvlist_lookup_int16(nvlist_t *, const char *, int16_t *);
2127c478bdstevel@tonic-gateint nvlist_lookup_uint16(nvlist_t *, const char *, uint16_t *);
2137c478bdstevel@tonic-gateint nvlist_lookup_int32(nvlist_t *, const char *, int32_t *);
2147c478bdstevel@tonic-gateint nvlist_lookup_uint32(nvlist_t *, const char *, uint32_t *);
2157c478bdstevel@tonic-gateint nvlist_lookup_int64(nvlist_t *, const char *, int64_t *);
2167c478bdstevel@tonic-gateint nvlist_lookup_uint64(nvlist_t *, const char *, uint64_t *);
2177c478bdstevel@tonic-gateint nvlist_lookup_string(nvlist_t *, const char *, char **);
2187c478bdstevel@tonic-gateint nvlist_lookup_nvlist(nvlist_t *, const char *, nvlist_t **);
2197c478bdstevel@tonic-gateint nvlist_lookup_boolean_array(nvlist_t *, const char *,
2207c478bdstevel@tonic-gate    boolean_t **, uint_t *);
2217c478bdstevel@tonic-gateint nvlist_lookup_byte_array(nvlist_t *, const char *, uchar_t **, uint_t *);
2227c478bdstevel@tonic-gateint nvlist_lookup_int8_array(nvlist_t *, const char *, int8_t **, uint_t *);
2237c478bdstevel@tonic-gateint nvlist_lookup_uint8_array(nvlist_t *, const char *, uint8_t **, uint_t *);
2247c478bdstevel@tonic-gateint nvlist_lookup_int16_array(nvlist_t *, const char *, int16_t **, uint_t *);
2257c478bdstevel@tonic-gateint nvlist_lookup_uint16_array(nvlist_t *, const char *, uint16_t **, uint_t *);
2267c478bdstevel@tonic-gateint nvlist_lookup_int32_array(nvlist_t *, const char *, int32_t **, uint_t *);
2277c478bdstevel@tonic-gateint nvlist_lookup_uint32_array(nvlist_t *, const char *, uint32_t **, uint_t *);
2287c478bdstevel@tonic-gateint nvlist_lookup_int64_array(nvlist_t *, const char *, int64_t **, uint_t *);
2297c478bdstevel@tonic-gateint nvlist_lookup_uint64_array(nvlist_t *, const char *, uint64_t **, uint_t *);
2307c478bdstevel@tonic-gateint nvlist_lookup_string_array(nvlist_t *, const char *, char ***, uint_t *);
2317c478bdstevel@tonic-gateint nvlist_lookup_nvlist_array(nvlist_t *, const char *,
2327c478bdstevel@tonic-gate    nvlist_t ***, uint_t *);
2337c478bdstevel@tonic-gateint nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *);
234602ca9ecthint nvlist_lookup_pairs(nvlist_t *, int, ...);
235825ba0frobj#if !defined(_KERNEL)
236825ba0frobjint nvlist_lookup_double(nvlist_t *, const char *, double *);
237825ba0frobj#endif
2387c478bdstevel@tonic-gate
239602ca9ecthint nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **);
240602ca9ecthint nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, nvpair_t **,
241602ca9ecth    int *, char **);
242602ca9ecthboolean_t nvlist_exists(nvlist_t *, const char *);
24392241e0Tom Ericksonboolean_t nvlist_empty(nvlist_t *);
2441af9825eschrock
2457c478bdstevel@tonic-gate/* processing nvpair */
246602ca9ecthnvpair_t *nvlist_next_nvpair(nvlist_t *, nvpair_t *);
24792241e0Tom Ericksonnvpair_t *nvlist_prev_nvpair(nvlist_t *, nvpair_t *);
2487c478bdstevel@tonic-gatechar *nvpair_name(nvpair_t *);
2497c478bdstevel@tonic-gatedata_type_t nvpair_type(nvpair_t *);
250602ca9ecthint nvpair_type_is_array(nvpair_t *);
2517c478bdstevel@tonic-gateint nvpair_value_boolean_value(nvpair_t *, boolean_t *);
2527c478bdstevel@tonic-gateint nvpair_value_byte(nvpair_t *, uchar_t *);
2537c478bdstevel@tonic-gateint nvpair_value_int8(nvpair_t *, int8_t *);
2547c478bdstevel@tonic-gateint nvpair_value_uint8(nvpair_t *, uint8_t *);
2557c478bdstevel@tonic-gateint nvpair_value_int16(nvpair_t *, int16_t *);
2567c478bdstevel@tonic-gateint nvpair_value_uint16(nvpair_t *, uint16_t *);
2577c478bdstevel@tonic-gateint nvpair_value_int32(nvpair_t *, int32_t *);
2587c478bdstevel@tonic-gateint nvpair_value_uint32(nvpair_t *, uint32_t *);
2597c478bdstevel@tonic-gateint nvpair_value_int64(nvpair_t *, int64_t *);
2607c478bdstevel@tonic-gateint nvpair_value_uint64(nvpair_t *, uint64_t *);
2617c478bdstevel@tonic-gateint nvpair_value_string(nvpair_t *, char **);
2627c478bdstevel@tonic-gateint nvpair_value_nvlist(nvpair_t *, nvlist_t **);
2637c478bdstevel@tonic-gateint nvpair_value_boolean_array(nvpair_t *, boolean_t **, uint_t *);
2647c478bdstevel@tonic-gateint nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *);
2657c478bdstevel@tonic-gateint nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *);
2667c478bdstevel@tonic-gateint nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *);
2677c478bdstevel@tonic-gateint nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *);
2687c478bdstevel@tonic-gateint nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *);
2697c478bdstevel@tonic-gateint nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *);
2707c478bdstevel@tonic-gateint nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *);
2717c478bdstevel@tonic-gateint nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *);
2727c478bdstevel@tonic-gateint nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *);
2737c478bdstevel@tonic-gateint nvpair_value_string_array(nvpair_t *, char ***, uint_t *);
2747c478bdstevel@tonic-gateint nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *);
2757c478bdstevel@tonic-gateint nvpair_value_hrtime(nvpair_t *, hrtime_t *);
276825ba0frobj#if !defined(_KERNEL)
277825ba0frobjint nvpair_value_double(nvpair_t *, double *);
278825ba0frobj#endif
2797c478bdstevel@tonic-gate
280ad135b5Christopher Sidennvlist_t *fnvlist_alloc(void);
281ad135b5Christopher Sidenvoid fnvlist_free(nvlist_t *);
282ad135b5Christopher Sidensize_t fnvlist_size(nvlist_t *);
283ad135b5Christopher Sidenchar *fnvlist_pack(nvlist_t *, size_t *);
284ad135b5Christopher Sidenvoid fnvlist_pack_free(char *, size_t);
285ad135b5Christopher Sidennvlist_t *fnvlist_unpack(char *, size_t);
286ad135b5Christopher Sidennvlist_t *fnvlist_dup(nvlist_t *);
287ad135b5Christopher Sidenvoid fnvlist_merge(nvlist_t *, nvlist_t *);
2883b2aab1Matthew Ahrenssize_t fnvlist_num_pairs(nvlist_t *);
289ad135b5Christopher Siden
290ad135b5Christopher Sidenvoid fnvlist_add_boolean(nvlist_t *, const char *);
291ad135b5Christopher Sidenvoid fnvlist_add_boolean_value(nvlist_t *, const char *, boolean_t);
292ad135b5Christopher Sidenvoid fnvlist_add_byte(nvlist_t *, const char *, uchar_t);
293ad135b5Christopher Sidenvoid fnvlist_add_int8(nvlist_t *, const char *, int8_t);
294ad135b5Christopher Sidenvoid fnvlist_add_uint8(nvlist_t *, const char *, uint8_t);
295ad135b5Christopher Sidenvoid fnvlist_add_int16(nvlist_t *, const char *, int16_t);
296ad135b5Christopher Sidenvoid fnvlist_add_uint16(nvlist_t *, const char *, uint16_t);
297ad135b5Christopher Sidenvoid fnvlist_add_int32(nvlist_t *, const char *, int32_t);
298ad135b5Christopher Sidenvoid fnvlist_add_uint32(nvlist_t *, const char *, uint32_t);
299ad135b5Christopher Sidenvoid fnvlist_add_int64(nvlist_t *, const char *, int64_t);
300ad135b5Christopher Sidenvoid fnvlist_add_uint64(nvlist_t *, const char *, uint64_t);
301ad135b5Christopher Sidenvoid fnvlist_add_string(nvlist_t *, const char *, const char *);
302ad135b5Christopher Sidenvoid fnvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *);
303ad135b5Christopher Sidenvoid fnvlist_add_nvpair(nvlist_t *, nvpair_t *);
304ad135b5Christopher Sidenvoid fnvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t);
305ad135b5Christopher Sidenvoid fnvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t);
306ad135b5Christopher Sidenvoid fnvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t);
307ad135b5Christopher Sidenvoid fnvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t);
308ad135b5Christopher Sidenvoid fnvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t);
309ad135b5Christopher Sidenvoid fnvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t);
310ad135b5Christopher Sidenvoid fnvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t);
311ad135b5Christopher Sidenvoid fnvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t);
312ad135b5Christopher Sidenvoid fnvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t);
313ad135b5Christopher Sidenvoid fnvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t);
314ad135b5Christopher Sidenvoid fnvlist_add_string_array(nvlist_t *, const char *, char * const *, uint_t);
315ad135b5Christopher Sidenvoid fnvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
316ad135b5Christopher Siden
317ad135b5Christopher Sidenvoid fnvlist_remove(nvlist_t *, const char *);
318ad135b5Christopher Sidenvoid fnvlist_remove_nvpair(nvlist_t *, nvpair_t *);
319ad135b5Christopher Siden
320ad135b5Christopher Sidennvpair_t *fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name);
321ad135b5Christopher Sidenboolean_t fnvlist_lookup_boolean(nvlist_t *nvl, const char *name);
322ad135b5Christopher Sidenboolean_t fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name);
323ad135b5Christopher Sidenuchar_t fnvlist_lookup_byte(nvlist_t *nvl, const char *name);
324ad135b5Christopher Sidenint8_t fnvlist_lookup_int8(nvlist_t *nvl, const char *name);
325ad135b5Christopher Sidenint16_t fnvlist_lookup_int16(nvlist_t *nvl, const char *name);
326ad135b5Christopher Sidenint32_t fnvlist_lookup_int32(nvlist_t *nvl, const char *name);
327ad135b5Christopher Sidenint64_t fnvlist_lookup_int64(nvlist_t *nvl, const char *name);
328ad135b5Christopher Sidenuint8_t fnvlist_lookup_uint8_t(nvlist_t *nvl, const char *name);
329ad135b5Christopher Sidenuint16_t fnvlist_lookup_uint16(nvlist_t *nvl, const char *name);
330ad135b5Christopher Sidenuint32_t fnvlist_lookup_uint32(nvlist_t *nvl, const char *name);
331ad135b5Christopher Sidenuint64_t fnvlist_lookup_uint64(nvlist_t *nvl, const char *name);
332ad135b5Christopher Sidenchar *fnvlist_lookup_string(nvlist_t *nvl, const char *name);
333ad135b5Christopher Sidennvlist_t *fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name);
334ad135b5Christopher Siden
335ad135b5Christopher Sidenboolean_t fnvpair_value_boolean_value(nvpair_t *nvp);
336ad135b5Christopher Sidenuchar_t fnvpair_value_byte(nvpair_t *nvp);
337ad135b5Christopher Sidenint8_t fnvpair_value_int8(nvpair_t *nvp);
338ad135b5Christopher Sidenint16_t fnvpair_value_int16(nvpair_t *nvp);
339ad135b5Christopher Sidenint32_t fnvpair_value_int32(nvpair_t *nvp);
340ad135b5Christopher Sidenint64_t fnvpair_value_int64(nvpair_t *nvp);
341ad135b5Christopher Sidenuint8_t fnvpair_value_uint8_t(nvpair_t *nvp);
342ad135b5Christopher Sidenuint16_t fnvpair_value_uint16(nvpair_t *nvp);
343ad135b5Christopher Sidenuint32_t fnvpair_value_uint32(nvpair_t *nvp);
344ad135b5Christopher Sidenuint64_t fnvpair_value_uint64(nvpair_t *nvp);
345ad135b5Christopher Sidenchar *fnvpair_value_string(nvpair_t *nvp);
346ad135b5Christopher Sidennvlist_t *fnvpair_value_nvlist(nvpair_t *nvp);
347ad135b5Christopher Siden
3487c478bdstevel@tonic-gate#ifdef	__cplusplus
3497c478bdstevel@tonic-gate}
3507c478bdstevel@tonic-gate#endif
3517c478bdstevel@tonic-gate
3527c478bdstevel@tonic-gate#endif	/* _SYS_NVPAIR_H */
353