xref: /freebsd/sys/contrib/openzfs/include/sys/nvpair.h (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1*eda14cbcSMatt Macy /*
2*eda14cbcSMatt Macy  * CDDL HEADER START
3*eda14cbcSMatt Macy  *
4*eda14cbcSMatt Macy  * The contents of this file are subject to the terms of the
5*eda14cbcSMatt Macy  * Common Development and Distribution License (the "License").
6*eda14cbcSMatt Macy  * You may not use this file except in compliance with the License.
7*eda14cbcSMatt Macy  *
8*eda14cbcSMatt Macy  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*eda14cbcSMatt Macy  * or http://www.opensolaris.org/os/licensing.
10*eda14cbcSMatt Macy  * See the License for the specific language governing permissions
11*eda14cbcSMatt Macy  * and limitations under the License.
12*eda14cbcSMatt Macy  *
13*eda14cbcSMatt Macy  * When distributing Covered Code, include this CDDL HEADER in each
14*eda14cbcSMatt Macy  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*eda14cbcSMatt Macy  * If applicable, add the following below this CDDL HEADER, with the
16*eda14cbcSMatt Macy  * fields enclosed by brackets "[]" replaced with your own identifying
17*eda14cbcSMatt Macy  * information: Portions Copyright [yyyy] [name of copyright owner]
18*eda14cbcSMatt Macy  *
19*eda14cbcSMatt Macy  * CDDL HEADER END
20*eda14cbcSMatt Macy  */
21*eda14cbcSMatt Macy /*
22*eda14cbcSMatt Macy  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
23*eda14cbcSMatt Macy  * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24*eda14cbcSMatt Macy  */
25*eda14cbcSMatt Macy 
26*eda14cbcSMatt Macy #ifndef	_SYS_NVPAIR_H
27*eda14cbcSMatt Macy #define	_SYS_NVPAIR_H
28*eda14cbcSMatt Macy 
29*eda14cbcSMatt Macy #include <sys/types.h>
30*eda14cbcSMatt Macy #include <sys/time.h>
31*eda14cbcSMatt Macy #include <sys/errno.h>
32*eda14cbcSMatt Macy 
33*eda14cbcSMatt Macy #ifdef	__cplusplus
34*eda14cbcSMatt Macy extern "C" {
35*eda14cbcSMatt Macy #endif
36*eda14cbcSMatt Macy 
37*eda14cbcSMatt Macy typedef enum {
38*eda14cbcSMatt Macy 	DATA_TYPE_DONTCARE = -1,
39*eda14cbcSMatt Macy 	DATA_TYPE_UNKNOWN = 0,
40*eda14cbcSMatt Macy 	DATA_TYPE_BOOLEAN,
41*eda14cbcSMatt Macy 	DATA_TYPE_BYTE,
42*eda14cbcSMatt Macy 	DATA_TYPE_INT16,
43*eda14cbcSMatt Macy 	DATA_TYPE_UINT16,
44*eda14cbcSMatt Macy 	DATA_TYPE_INT32,
45*eda14cbcSMatt Macy 	DATA_TYPE_UINT32,
46*eda14cbcSMatt Macy 	DATA_TYPE_INT64,
47*eda14cbcSMatt Macy 	DATA_TYPE_UINT64,
48*eda14cbcSMatt Macy 	DATA_TYPE_STRING,
49*eda14cbcSMatt Macy 	DATA_TYPE_BYTE_ARRAY,
50*eda14cbcSMatt Macy 	DATA_TYPE_INT16_ARRAY,
51*eda14cbcSMatt Macy 	DATA_TYPE_UINT16_ARRAY,
52*eda14cbcSMatt Macy 	DATA_TYPE_INT32_ARRAY,
53*eda14cbcSMatt Macy 	DATA_TYPE_UINT32_ARRAY,
54*eda14cbcSMatt Macy 	DATA_TYPE_INT64_ARRAY,
55*eda14cbcSMatt Macy 	DATA_TYPE_UINT64_ARRAY,
56*eda14cbcSMatt Macy 	DATA_TYPE_STRING_ARRAY,
57*eda14cbcSMatt Macy 	DATA_TYPE_HRTIME,
58*eda14cbcSMatt Macy 	DATA_TYPE_NVLIST,
59*eda14cbcSMatt Macy 	DATA_TYPE_NVLIST_ARRAY,
60*eda14cbcSMatt Macy 	DATA_TYPE_BOOLEAN_VALUE,
61*eda14cbcSMatt Macy 	DATA_TYPE_INT8,
62*eda14cbcSMatt Macy 	DATA_TYPE_UINT8,
63*eda14cbcSMatt Macy 	DATA_TYPE_BOOLEAN_ARRAY,
64*eda14cbcSMatt Macy 	DATA_TYPE_INT8_ARRAY,
65*eda14cbcSMatt Macy #if !defined(_KERNEL)
66*eda14cbcSMatt Macy 	DATA_TYPE_UINT8_ARRAY,
67*eda14cbcSMatt Macy 	DATA_TYPE_DOUBLE
68*eda14cbcSMatt Macy #else
69*eda14cbcSMatt Macy 	DATA_TYPE_UINT8_ARRAY
70*eda14cbcSMatt Macy #endif
71*eda14cbcSMatt Macy } data_type_t;
72*eda14cbcSMatt Macy 
73*eda14cbcSMatt Macy typedef struct nvpair {
74*eda14cbcSMatt Macy 	int32_t nvp_size;	/* size of this nvpair */
75*eda14cbcSMatt Macy 	int16_t	nvp_name_sz;	/* length of name string */
76*eda14cbcSMatt Macy 	int16_t	nvp_reserve;	/* not used */
77*eda14cbcSMatt Macy 	int32_t	nvp_value_elem;	/* number of elements for array types */
78*eda14cbcSMatt Macy 	data_type_t nvp_type;	/* type of value */
79*eda14cbcSMatt Macy 	/* name string */
80*eda14cbcSMatt Macy 	/* aligned ptr array for string arrays */
81*eda14cbcSMatt Macy 	/* aligned array of data for value */
82*eda14cbcSMatt Macy } nvpair_t;
83*eda14cbcSMatt Macy 
84*eda14cbcSMatt Macy /* nvlist header */
85*eda14cbcSMatt Macy typedef struct nvlist {
86*eda14cbcSMatt Macy 	int32_t		nvl_version;
87*eda14cbcSMatt Macy 	uint32_t	nvl_nvflag;	/* persistent flags */
88*eda14cbcSMatt Macy 	uint64_t	nvl_priv;	/* ptr to private data if not packed */
89*eda14cbcSMatt Macy 	uint32_t	nvl_flag;
90*eda14cbcSMatt Macy 	int32_t		nvl_pad;	/* currently not used, for alignment */
91*eda14cbcSMatt Macy } nvlist_t;
92*eda14cbcSMatt Macy 
93*eda14cbcSMatt Macy /* nvp implementation version */
94*eda14cbcSMatt Macy #define	NV_VERSION	0
95*eda14cbcSMatt Macy 
96*eda14cbcSMatt Macy /* nvlist pack encoding */
97*eda14cbcSMatt Macy #define	NV_ENCODE_NATIVE	0
98*eda14cbcSMatt Macy #define	NV_ENCODE_XDR		1
99*eda14cbcSMatt Macy 
100*eda14cbcSMatt Macy /* nvlist persistent unique name flags, stored in nvl_nvflags */
101*eda14cbcSMatt Macy #define	NV_UNIQUE_NAME		0x1
102*eda14cbcSMatt Macy #define	NV_UNIQUE_NAME_TYPE	0x2
103*eda14cbcSMatt Macy 
104*eda14cbcSMatt Macy /* nvlist lookup pairs related flags */
105*eda14cbcSMatt Macy #define	NV_FLAG_NOENTOK		0x1
106*eda14cbcSMatt Macy 
107*eda14cbcSMatt Macy /* convenience macros */
108*eda14cbcSMatt Macy #define	NV_ALIGN(x)		(((ulong_t)(x) + 7ul) & ~7ul)
109*eda14cbcSMatt Macy #define	NV_ALIGN4(x)		(((x) + 3) & ~3)
110*eda14cbcSMatt Macy 
111*eda14cbcSMatt Macy #define	NVP_SIZE(nvp)		((nvp)->nvp_size)
112*eda14cbcSMatt Macy #define	NVP_NAME(nvp)		((char *)(nvp) + sizeof (nvpair_t))
113*eda14cbcSMatt Macy #define	NVP_TYPE(nvp)		((nvp)->nvp_type)
114*eda14cbcSMatt Macy #define	NVP_NELEM(nvp)		((nvp)->nvp_value_elem)
115*eda14cbcSMatt Macy #define	NVP_VALUE(nvp)		((char *)(nvp) + NV_ALIGN(sizeof (nvpair_t) \
116*eda14cbcSMatt Macy 				+ (nvp)->nvp_name_sz))
117*eda14cbcSMatt Macy 
118*eda14cbcSMatt Macy #define	NVL_VERSION(nvl)	((nvl)->nvl_version)
119*eda14cbcSMatt Macy #define	NVL_SIZE(nvl)		((nvl)->nvl_size)
120*eda14cbcSMatt Macy #define	NVL_FLAG(nvl)		((nvl)->nvl_flag)
121*eda14cbcSMatt Macy 
122*eda14cbcSMatt Macy /* NV allocator framework */
123*eda14cbcSMatt Macy typedef struct nv_alloc_ops nv_alloc_ops_t;
124*eda14cbcSMatt Macy 
125*eda14cbcSMatt Macy typedef struct nv_alloc {
126*eda14cbcSMatt Macy 	const nv_alloc_ops_t *nva_ops;
127*eda14cbcSMatt Macy 	void *nva_arg;
128*eda14cbcSMatt Macy } nv_alloc_t;
129*eda14cbcSMatt Macy 
130*eda14cbcSMatt Macy struct nv_alloc_ops {
131*eda14cbcSMatt Macy 	int (*nv_ao_init)(nv_alloc_t *, va_list);
132*eda14cbcSMatt Macy 	void (*nv_ao_fini)(nv_alloc_t *);
133*eda14cbcSMatt Macy 	void *(*nv_ao_alloc)(nv_alloc_t *, size_t);
134*eda14cbcSMatt Macy 	void (*nv_ao_free)(nv_alloc_t *, void *, size_t);
135*eda14cbcSMatt Macy 	void (*nv_ao_reset)(nv_alloc_t *);
136*eda14cbcSMatt Macy };
137*eda14cbcSMatt Macy 
138*eda14cbcSMatt Macy extern const nv_alloc_ops_t *nv_fixed_ops;
139*eda14cbcSMatt Macy extern nv_alloc_t *nv_alloc_nosleep;
140*eda14cbcSMatt Macy 
141*eda14cbcSMatt Macy #if defined(_KERNEL)
142*eda14cbcSMatt Macy extern nv_alloc_t *nv_alloc_sleep;
143*eda14cbcSMatt Macy extern nv_alloc_t *nv_alloc_pushpage;
144*eda14cbcSMatt Macy #endif
145*eda14cbcSMatt Macy 
146*eda14cbcSMatt Macy int nv_alloc_init(nv_alloc_t *, const nv_alloc_ops_t *, /* args */ ...);
147*eda14cbcSMatt Macy void nv_alloc_reset(nv_alloc_t *);
148*eda14cbcSMatt Macy void nv_alloc_fini(nv_alloc_t *);
149*eda14cbcSMatt Macy 
150*eda14cbcSMatt Macy /* list management */
151*eda14cbcSMatt Macy int nvlist_alloc(nvlist_t **, uint_t, int);
152*eda14cbcSMatt Macy void nvlist_free(nvlist_t *);
153*eda14cbcSMatt Macy int nvlist_size(nvlist_t *, size_t *, int);
154*eda14cbcSMatt Macy int nvlist_pack(nvlist_t *, char **, size_t *, int, int);
155*eda14cbcSMatt Macy int nvlist_unpack(char *, size_t, nvlist_t **, int);
156*eda14cbcSMatt Macy int nvlist_dup(nvlist_t *, nvlist_t **, int);
157*eda14cbcSMatt Macy int nvlist_merge(nvlist_t *, nvlist_t *, int);
158*eda14cbcSMatt Macy 
159*eda14cbcSMatt Macy uint_t nvlist_nvflag(nvlist_t *);
160*eda14cbcSMatt Macy 
161*eda14cbcSMatt Macy int nvlist_xalloc(nvlist_t **, uint_t, nv_alloc_t *);
162*eda14cbcSMatt Macy int nvlist_xpack(nvlist_t *, char **, size_t *, int, nv_alloc_t *);
163*eda14cbcSMatt Macy int nvlist_xunpack(char *, size_t, nvlist_t **, nv_alloc_t *);
164*eda14cbcSMatt Macy int nvlist_xdup(nvlist_t *, nvlist_t **, nv_alloc_t *);
165*eda14cbcSMatt Macy nv_alloc_t *nvlist_lookup_nv_alloc(nvlist_t *);
166*eda14cbcSMatt Macy 
167*eda14cbcSMatt Macy int nvlist_add_nvpair(nvlist_t *, nvpair_t *);
168*eda14cbcSMatt Macy int nvlist_add_boolean(nvlist_t *, const char *);
169*eda14cbcSMatt Macy int nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t);
170*eda14cbcSMatt Macy int nvlist_add_byte(nvlist_t *, const char *, uchar_t);
171*eda14cbcSMatt Macy int nvlist_add_int8(nvlist_t *, const char *, int8_t);
172*eda14cbcSMatt Macy int nvlist_add_uint8(nvlist_t *, const char *, uint8_t);
173*eda14cbcSMatt Macy int nvlist_add_int16(nvlist_t *, const char *, int16_t);
174*eda14cbcSMatt Macy int nvlist_add_uint16(nvlist_t *, const char *, uint16_t);
175*eda14cbcSMatt Macy int nvlist_add_int32(nvlist_t *, const char *, int32_t);
176*eda14cbcSMatt Macy int nvlist_add_uint32(nvlist_t *, const char *, uint32_t);
177*eda14cbcSMatt Macy int nvlist_add_int64(nvlist_t *, const char *, int64_t);
178*eda14cbcSMatt Macy int nvlist_add_uint64(nvlist_t *, const char *, uint64_t);
179*eda14cbcSMatt Macy int nvlist_add_string(nvlist_t *, const char *, const char *);
180*eda14cbcSMatt Macy int nvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *);
181*eda14cbcSMatt Macy int nvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t);
182*eda14cbcSMatt Macy int nvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t);
183*eda14cbcSMatt Macy int nvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t);
184*eda14cbcSMatt Macy int nvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t);
185*eda14cbcSMatt Macy int nvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t);
186*eda14cbcSMatt Macy int nvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t);
187*eda14cbcSMatt Macy int nvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t);
188*eda14cbcSMatt Macy int nvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t);
189*eda14cbcSMatt Macy int nvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t);
190*eda14cbcSMatt Macy int nvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t);
191*eda14cbcSMatt Macy int nvlist_add_string_array(nvlist_t *, const char *, char *const *, uint_t);
192*eda14cbcSMatt Macy int nvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
193*eda14cbcSMatt Macy int nvlist_add_hrtime(nvlist_t *, const char *, hrtime_t);
194*eda14cbcSMatt Macy #if !defined(_KERNEL)
195*eda14cbcSMatt Macy int nvlist_add_double(nvlist_t *, const char *, double);
196*eda14cbcSMatt Macy #endif
197*eda14cbcSMatt Macy 
198*eda14cbcSMatt Macy int nvlist_remove(nvlist_t *, const char *, data_type_t);
199*eda14cbcSMatt Macy int nvlist_remove_all(nvlist_t *, const char *);
200*eda14cbcSMatt Macy int nvlist_remove_nvpair(nvlist_t *, nvpair_t *);
201*eda14cbcSMatt Macy 
202*eda14cbcSMatt Macy int nvlist_lookup_boolean(nvlist_t *, const char *);
203*eda14cbcSMatt Macy int nvlist_lookup_boolean_value(nvlist_t *, const char *, boolean_t *);
204*eda14cbcSMatt Macy int nvlist_lookup_byte(nvlist_t *, const char *, uchar_t *);
205*eda14cbcSMatt Macy int nvlist_lookup_int8(nvlist_t *, const char *, int8_t *);
206*eda14cbcSMatt Macy int nvlist_lookup_uint8(nvlist_t *, const char *, uint8_t *);
207*eda14cbcSMatt Macy int nvlist_lookup_int16(nvlist_t *, const char *, int16_t *);
208*eda14cbcSMatt Macy int nvlist_lookup_uint16(nvlist_t *, const char *, uint16_t *);
209*eda14cbcSMatt Macy int nvlist_lookup_int32(nvlist_t *, const char *, int32_t *);
210*eda14cbcSMatt Macy int nvlist_lookup_uint32(nvlist_t *, const char *, uint32_t *);
211*eda14cbcSMatt Macy int nvlist_lookup_int64(nvlist_t *, const char *, int64_t *);
212*eda14cbcSMatt Macy int nvlist_lookup_uint64(nvlist_t *, const char *, uint64_t *);
213*eda14cbcSMatt Macy int nvlist_lookup_string(nvlist_t *, const char *, char **);
214*eda14cbcSMatt Macy int nvlist_lookup_nvlist(nvlist_t *, const char *, nvlist_t **);
215*eda14cbcSMatt Macy int nvlist_lookup_boolean_array(nvlist_t *, const char *,
216*eda14cbcSMatt Macy     boolean_t **, uint_t *);
217*eda14cbcSMatt Macy int nvlist_lookup_byte_array(nvlist_t *, const char *, uchar_t **, uint_t *);
218*eda14cbcSMatt Macy int nvlist_lookup_int8_array(nvlist_t *, const char *, int8_t **, uint_t *);
219*eda14cbcSMatt Macy int nvlist_lookup_uint8_array(nvlist_t *, const char *, uint8_t **, uint_t *);
220*eda14cbcSMatt Macy int nvlist_lookup_int16_array(nvlist_t *, const char *, int16_t **, uint_t *);
221*eda14cbcSMatt Macy int nvlist_lookup_uint16_array(nvlist_t *, const char *, uint16_t **, uint_t *);
222*eda14cbcSMatt Macy int nvlist_lookup_int32_array(nvlist_t *, const char *, int32_t **, uint_t *);
223*eda14cbcSMatt Macy int nvlist_lookup_uint32_array(nvlist_t *, const char *, uint32_t **, uint_t *);
224*eda14cbcSMatt Macy int nvlist_lookup_int64_array(nvlist_t *, const char *, int64_t **, uint_t *);
225*eda14cbcSMatt Macy int nvlist_lookup_uint64_array(nvlist_t *, const char *, uint64_t **, uint_t *);
226*eda14cbcSMatt Macy int nvlist_lookup_string_array(nvlist_t *, const char *, char ***, uint_t *);
227*eda14cbcSMatt Macy int nvlist_lookup_nvlist_array(nvlist_t *, const char *,
228*eda14cbcSMatt Macy     nvlist_t ***, uint_t *);
229*eda14cbcSMatt Macy int nvlist_lookup_hrtime(nvlist_t *, const char *, hrtime_t *);
230*eda14cbcSMatt Macy int nvlist_lookup_pairs(nvlist_t *, int, ...);
231*eda14cbcSMatt Macy #if !defined(_KERNEL)
232*eda14cbcSMatt Macy int nvlist_lookup_double(nvlist_t *, const char *, double *);
233*eda14cbcSMatt Macy #endif
234*eda14cbcSMatt Macy 
235*eda14cbcSMatt Macy int nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **);
236*eda14cbcSMatt Macy int nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, nvpair_t **,
237*eda14cbcSMatt Macy     int *, char **);
238*eda14cbcSMatt Macy boolean_t nvlist_exists(nvlist_t *, const char *);
239*eda14cbcSMatt Macy boolean_t nvlist_empty(nvlist_t *);
240*eda14cbcSMatt Macy 
241*eda14cbcSMatt Macy /* processing nvpair */
242*eda14cbcSMatt Macy nvpair_t *nvlist_next_nvpair(nvlist_t *, nvpair_t *);
243*eda14cbcSMatt Macy nvpair_t *nvlist_prev_nvpair(nvlist_t *, nvpair_t *);
244*eda14cbcSMatt Macy char *nvpair_name(nvpair_t *);
245*eda14cbcSMatt Macy data_type_t nvpair_type(nvpair_t *);
246*eda14cbcSMatt Macy int nvpair_type_is_array(nvpair_t *);
247*eda14cbcSMatt Macy int nvpair_value_boolean_value(nvpair_t *, boolean_t *);
248*eda14cbcSMatt Macy int nvpair_value_byte(nvpair_t *, uchar_t *);
249*eda14cbcSMatt Macy int nvpair_value_int8(nvpair_t *, int8_t *);
250*eda14cbcSMatt Macy int nvpair_value_uint8(nvpair_t *, uint8_t *);
251*eda14cbcSMatt Macy int nvpair_value_int16(nvpair_t *, int16_t *);
252*eda14cbcSMatt Macy int nvpair_value_uint16(nvpair_t *, uint16_t *);
253*eda14cbcSMatt Macy int nvpair_value_int32(nvpair_t *, int32_t *);
254*eda14cbcSMatt Macy int nvpair_value_uint32(nvpair_t *, uint32_t *);
255*eda14cbcSMatt Macy int nvpair_value_int64(nvpair_t *, int64_t *);
256*eda14cbcSMatt Macy int nvpair_value_uint64(nvpair_t *, uint64_t *);
257*eda14cbcSMatt Macy int nvpair_value_string(nvpair_t *, char **);
258*eda14cbcSMatt Macy int nvpair_value_nvlist(nvpair_t *, nvlist_t **);
259*eda14cbcSMatt Macy int nvpair_value_boolean_array(nvpair_t *, boolean_t **, uint_t *);
260*eda14cbcSMatt Macy int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *);
261*eda14cbcSMatt Macy int nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *);
262*eda14cbcSMatt Macy int nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *);
263*eda14cbcSMatt Macy int nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *);
264*eda14cbcSMatt Macy int nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *);
265*eda14cbcSMatt Macy int nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *);
266*eda14cbcSMatt Macy int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *);
267*eda14cbcSMatt Macy int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *);
268*eda14cbcSMatt Macy int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *);
269*eda14cbcSMatt Macy int nvpair_value_string_array(nvpair_t *, char ***, uint_t *);
270*eda14cbcSMatt Macy int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *);
271*eda14cbcSMatt Macy int nvpair_value_hrtime(nvpair_t *, hrtime_t *);
272*eda14cbcSMatt Macy #if !defined(_KERNEL)
273*eda14cbcSMatt Macy int nvpair_value_double(nvpair_t *, double *);
274*eda14cbcSMatt Macy #endif
275*eda14cbcSMatt Macy 
276*eda14cbcSMatt Macy nvlist_t *fnvlist_alloc(void);
277*eda14cbcSMatt Macy void fnvlist_free(nvlist_t *);
278*eda14cbcSMatt Macy size_t fnvlist_size(nvlist_t *);
279*eda14cbcSMatt Macy char *fnvlist_pack(nvlist_t *, size_t *);
280*eda14cbcSMatt Macy void fnvlist_pack_free(char *, size_t);
281*eda14cbcSMatt Macy nvlist_t *fnvlist_unpack(char *, size_t);
282*eda14cbcSMatt Macy nvlist_t *fnvlist_dup(nvlist_t *);
283*eda14cbcSMatt Macy void fnvlist_merge(nvlist_t *, nvlist_t *);
284*eda14cbcSMatt Macy size_t fnvlist_num_pairs(nvlist_t *);
285*eda14cbcSMatt Macy 
286*eda14cbcSMatt Macy void fnvlist_add_boolean(nvlist_t *, const char *);
287*eda14cbcSMatt Macy void fnvlist_add_boolean_value(nvlist_t *, const char *, boolean_t);
288*eda14cbcSMatt Macy void fnvlist_add_byte(nvlist_t *, const char *, uchar_t);
289*eda14cbcSMatt Macy void fnvlist_add_int8(nvlist_t *, const char *, int8_t);
290*eda14cbcSMatt Macy void fnvlist_add_uint8(nvlist_t *, const char *, uint8_t);
291*eda14cbcSMatt Macy void fnvlist_add_int16(nvlist_t *, const char *, int16_t);
292*eda14cbcSMatt Macy void fnvlist_add_uint16(nvlist_t *, const char *, uint16_t);
293*eda14cbcSMatt Macy void fnvlist_add_int32(nvlist_t *, const char *, int32_t);
294*eda14cbcSMatt Macy void fnvlist_add_uint32(nvlist_t *, const char *, uint32_t);
295*eda14cbcSMatt Macy void fnvlist_add_int64(nvlist_t *, const char *, int64_t);
296*eda14cbcSMatt Macy void fnvlist_add_uint64(nvlist_t *, const char *, uint64_t);
297*eda14cbcSMatt Macy void fnvlist_add_string(nvlist_t *, const char *, const char *);
298*eda14cbcSMatt Macy void fnvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *);
299*eda14cbcSMatt Macy void fnvlist_add_nvpair(nvlist_t *, nvpair_t *);
300*eda14cbcSMatt Macy void fnvlist_add_boolean_array(nvlist_t *, const char *, boolean_t *, uint_t);
301*eda14cbcSMatt Macy void fnvlist_add_byte_array(nvlist_t *, const char *, uchar_t *, uint_t);
302*eda14cbcSMatt Macy void fnvlist_add_int8_array(nvlist_t *, const char *, int8_t *, uint_t);
303*eda14cbcSMatt Macy void fnvlist_add_uint8_array(nvlist_t *, const char *, uint8_t *, uint_t);
304*eda14cbcSMatt Macy void fnvlist_add_int16_array(nvlist_t *, const char *, int16_t *, uint_t);
305*eda14cbcSMatt Macy void fnvlist_add_uint16_array(nvlist_t *, const char *, uint16_t *, uint_t);
306*eda14cbcSMatt Macy void fnvlist_add_int32_array(nvlist_t *, const char *, int32_t *, uint_t);
307*eda14cbcSMatt Macy void fnvlist_add_uint32_array(nvlist_t *, const char *, uint32_t *, uint_t);
308*eda14cbcSMatt Macy void fnvlist_add_int64_array(nvlist_t *, const char *, int64_t *, uint_t);
309*eda14cbcSMatt Macy void fnvlist_add_uint64_array(nvlist_t *, const char *, uint64_t *, uint_t);
310*eda14cbcSMatt Macy void fnvlist_add_string_array(nvlist_t *, const char *, char * const *, uint_t);
311*eda14cbcSMatt Macy void fnvlist_add_nvlist_array(nvlist_t *, const char *, nvlist_t **, uint_t);
312*eda14cbcSMatt Macy 
313*eda14cbcSMatt Macy void fnvlist_remove(nvlist_t *, const char *);
314*eda14cbcSMatt Macy void fnvlist_remove_nvpair(nvlist_t *, nvpair_t *);
315*eda14cbcSMatt Macy 
316*eda14cbcSMatt Macy nvpair_t *fnvlist_lookup_nvpair(nvlist_t *, const char *);
317*eda14cbcSMatt Macy boolean_t fnvlist_lookup_boolean(nvlist_t *, const char *);
318*eda14cbcSMatt Macy boolean_t fnvlist_lookup_boolean_value(nvlist_t *, const char *);
319*eda14cbcSMatt Macy uchar_t fnvlist_lookup_byte(nvlist_t *, const char *);
320*eda14cbcSMatt Macy int8_t fnvlist_lookup_int8(nvlist_t *, const char *);
321*eda14cbcSMatt Macy int16_t fnvlist_lookup_int16(nvlist_t *, const char *);
322*eda14cbcSMatt Macy int32_t fnvlist_lookup_int32(nvlist_t *, const char *);
323*eda14cbcSMatt Macy int64_t fnvlist_lookup_int64(nvlist_t *, const char *);
324*eda14cbcSMatt Macy uint8_t fnvlist_lookup_uint8(nvlist_t *, const char *);
325*eda14cbcSMatt Macy uint16_t fnvlist_lookup_uint16(nvlist_t *, const char *);
326*eda14cbcSMatt Macy uint32_t fnvlist_lookup_uint32(nvlist_t *, const char *);
327*eda14cbcSMatt Macy uint64_t fnvlist_lookup_uint64(nvlist_t *, const char *);
328*eda14cbcSMatt Macy char *fnvlist_lookup_string(nvlist_t *, const char *);
329*eda14cbcSMatt Macy nvlist_t *fnvlist_lookup_nvlist(nvlist_t *, const char *);
330*eda14cbcSMatt Macy boolean_t *fnvlist_lookup_boolean_array(nvlist_t *, const char *, uint_t *);
331*eda14cbcSMatt Macy uchar_t *fnvlist_lookup_byte_array(nvlist_t *, const char *, uint_t *);
332*eda14cbcSMatt Macy int8_t *fnvlist_lookup_int8_array(nvlist_t *, const char *, uint_t *);
333*eda14cbcSMatt Macy uint8_t *fnvlist_lookup_uint8_array(nvlist_t *, const char *, uint_t *);
334*eda14cbcSMatt Macy int16_t *fnvlist_lookup_int16_array(nvlist_t *, const char *, uint_t *);
335*eda14cbcSMatt Macy uint16_t *fnvlist_lookup_uint16_array(nvlist_t *, const char *, uint_t *);
336*eda14cbcSMatt Macy int32_t *fnvlist_lookup_int32_array(nvlist_t *, const char *, uint_t *);
337*eda14cbcSMatt Macy uint32_t *fnvlist_lookup_uint32_array(nvlist_t *, const char *, uint_t *);
338*eda14cbcSMatt Macy int64_t *fnvlist_lookup_int64_array(nvlist_t *, const char *, uint_t *);
339*eda14cbcSMatt Macy uint64_t *fnvlist_lookup_uint64_array(nvlist_t *, const char *, uint_t *);
340*eda14cbcSMatt Macy 
341*eda14cbcSMatt Macy boolean_t fnvpair_value_boolean_value(nvpair_t *nvp);
342*eda14cbcSMatt Macy uchar_t fnvpair_value_byte(nvpair_t *nvp);
343*eda14cbcSMatt Macy int8_t fnvpair_value_int8(nvpair_t *nvp);
344*eda14cbcSMatt Macy int16_t fnvpair_value_int16(nvpair_t *nvp);
345*eda14cbcSMatt Macy int32_t fnvpair_value_int32(nvpair_t *nvp);
346*eda14cbcSMatt Macy int64_t fnvpair_value_int64(nvpair_t *nvp);
347*eda14cbcSMatt Macy uint8_t fnvpair_value_uint8(nvpair_t *nvp);
348*eda14cbcSMatt Macy uint16_t fnvpair_value_uint16(nvpair_t *nvp);
349*eda14cbcSMatt Macy uint32_t fnvpair_value_uint32(nvpair_t *nvp);
350*eda14cbcSMatt Macy uint64_t fnvpair_value_uint64(nvpair_t *nvp);
351*eda14cbcSMatt Macy char *fnvpair_value_string(nvpair_t *nvp);
352*eda14cbcSMatt Macy nvlist_t *fnvpair_value_nvlist(nvpair_t *nvp);
353*eda14cbcSMatt Macy 
354*eda14cbcSMatt Macy #ifdef	__cplusplus
355*eda14cbcSMatt Macy }
356*eda14cbcSMatt Macy #endif
357*eda14cbcSMatt Macy 
358*eda14cbcSMatt Macy #endif	/* _SYS_NVPAIR_H */
359