xref: /trueos/sys/sys/nv.h (revision 40782981b22ef4e5389f32da5c91672c6e5e7429)
1 /*-
2  * Copyright (c) 2009-2013 The FreeBSD Foundation
3  * All rights reserved.
4  *
5  * This software was developed by Pawel Jakub Dawidek under sponsorship from
6  * the FreeBSD Foundation.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $FreeBSD$
30  */
31 
32 #ifndef	_NV_H_
33 #define	_NV_H_
34 
35 #include <sys/cdefs.h>
36 
37 #ifndef _KERNEL
38 #include <stdarg.h>
39 #include <stdbool.h>
40 #include <stdint.h>
41 #include <stdio.h>
42 #include <uuid.h>
43 #else
44 #include <sys/uuid.h>
45 #endif
46 
47 
48 
49 #ifndef	_NVLIST_T_DECLARED
50 #define	_NVLIST_T_DECLARED
51 struct nvlist;
52 
53 typedef struct nvlist nvlist_t;
54 #endif
55 
56 #define	NV_NAME_MAX	2048
57 
58 #define	NV_TYPE_NONE			0
59 
60 #define	NV_TYPE_NULL			1
61 #define	NV_TYPE_BOOL			2
62 #define	NV_TYPE_STRING			3
63 #define	NV_TYPE_DESCRIPTOR		4
64 #define	NV_TYPE_BINARY			5
65 
66 #define	NV_TYPE_NUMBER			6
67 #define	NV_TYPE_PTR			7
68 #define	NV_TYPE_UINT64			8
69 #define	NV_TYPE_INT64			9
70 #define	NV_TYPE_ENDPOINT		10
71 #define	NV_TYPE_DATE			11
72 #define	NV_TYPE_UUID			12
73 
74 #define	NV_TYPE_NVLIST			13
75 #define	NV_TYPE_NVLIST_ARRAY		14
76 #define	NV_TYPE_NVLIST_DICTIONARY	15
77 
78 
79 /*
80  * Perform case-insensitive lookups of provided names.
81  */
82 #define	NV_FLAG_IGNORE_CASE		0x01
83 
84 #if defined(_KERNEL) && defined(MALLOC_DECLARE)
85 MALLOC_DECLARE(M_NVLIST);
86 #endif
87 
88 __BEGIN_DECLS
89 
90 nvlist_t	*nvlist_create(int flags);
91 nvlist_t	*nvlist_create_array(int flags);
92 nvlist_t	*nvlist_create_dictionary(int flags);
93 void		 nvlist_destroy(nvlist_t *nvl);
94 int		 nvlist_error(const nvlist_t *nvl);
95 bool		 nvlist_empty(const nvlist_t *nvl);
96 int		 nvlist_type(const nvlist_t *nvl);
97 void		 nvlist_set_error(nvlist_t *nvl, int error);
98 
99 nvlist_t *nvlist_clone(const nvlist_t *nvl);
100 
101 #ifndef _KERNEL
102 void nvlist_dump(const nvlist_t *nvl, int fd);
103 void nvlist_fdump(const nvlist_t *nvl, FILE *fp);
104 #endif
105 
106 size_t		 nvlist_size(const nvlist_t *nvl);
107 void		*nvlist_pack(const nvlist_t *nvl, size_t *sizep);
108 void		*nvlist_pack_buffer(const nvlist_t *nvl, void *buf, size_t *sizep);
109 nvlist_t	*nvlist_unpack(const void *buf, size_t size);
110 
111 int nvlist_send(int sock, const nvlist_t *nvl);
112 nvlist_t *nvlist_recv(int sock);
113 nvlist_t *nvlist_xfer(int sock, nvlist_t *nvl);
114 
115 const char *nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep);
116 
117 const nvlist_t *nvlist_get_parent(const nvlist_t *nvl, void **cookiep);
118 
119 /*
120  * The nvlist_exists functions check if the given name (optionally of the given
121  * type) exists on nvlist.
122  */
123 
124 bool nvlist_exists(const nvlist_t *nvl, const char *name);
125 bool nvlist_exists_type(const nvlist_t *nvl, const char *name, int type);
126 
127 bool nvlist_exists_null(const nvlist_t *nvl, const char *name);
128 bool nvlist_exists_bool(const nvlist_t *nvl, const char *name);
129 bool nvlist_exists_number(const nvlist_t *nvl, const char *name);
130 bool nvlist_exists_ptr(const nvlist_t *nvl, const char *name);
131 bool nvlist_exists_uint64(const nvlist_t *nvl, const char *name);
132 bool nvlist_exists_int64(const nvlist_t *nvl, const char *name);
133 bool nvlist_exists_endpoint(const nvlist_t *nvl, const char *name);
134 bool nvlist_exists_date(const nvlist_t *nvl, const char *name);
135 bool nvlist_exists_string(const nvlist_t *nvl, const char *name);
136 bool nvlist_exists_nvlist(const nvlist_t *nvl, const char *name);
137 bool nvlist_exists_nvlist_dictionary(const nvlist_t *nvl, const char *name);
138 bool nvlist_exists_nvlist_array(const nvlist_t *nvl, const char *name);
139 #ifndef _KERNEL
140 bool nvlist_exists_descriptor(const nvlist_t *nvl, const char *name);
141 #endif
142 bool nvlist_exists_binary(const nvlist_t *nvl, const char *name);
143 bool nvlist_exists_uuid(const nvlist_t *nvl, const char *name);
144 
145 /*
146  * The nvlist_add functions add the given name/value pair.
147  * If a pointer is provided, nvlist_add will internally allocate memory for the
148  * given data (in other words it won't consume provided buffer).
149  */
150 
151 void nvlist_add_null(nvlist_t *nvl, const char *name);
152 void nvlist_add_bool(nvlist_t *nvl, const char *name, bool value);
153 void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value);
154 void nvlist_add_ptr(nvlist_t *nvl, const char *name, uintptr_t value);
155 void nvlist_add_int64(nvlist_t *nvl, const char *name, int64_t value);
156 void nvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t value);
157 void nvlist_add_endpoint(nvlist_t *nvl, const char *name, int value);
158 void nvlist_add_date(nvlist_t *nvl, const char *name, uint64_t value);
159 void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value);
160 void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4);
161 #ifdef _VA_LIST_DECLARED
162 void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0);
163 #endif
164 void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value);
165 void nvlist_add_nvlist_dictionary(nvlist_t *nvl, const char *name, const nvlist_t *value);
166 void nvlist_add_nvlist_array(nvlist_t *nvl, const char *name, const nvlist_t *value);
167 #ifndef _KERNEL
168 void nvlist_add_descriptor(nvlist_t *nvl, const char *name, int value);
169 #endif
170 void nvlist_add_binary(nvlist_t *nvl, const char *name, const void *value, size_t size);
171 void nvlist_add_uuid(nvlist_t *nvl, const char *name, const uuid_t *value);
172 
173 /*
174  * The nvlist_move functions add the given name/value pair.
175  * The functions consumes provided buffer.
176  */
177 
178 void nvlist_move_string(nvlist_t *nvl, const char *name, char *value);
179 void nvlist_move_nvlist(nvlist_t *nvl, const char *name, nvlist_t *value);
180 void nvlist_move_nvlist_array(nvlist_t *nvl, const char *name, nvlist_t *value);
181 void nvlist_move_nvlist_dictionary(nvlist_t *nvl, const char *name, nvlist_t *value);
182 #ifndef _KERNEL
183 void nvlist_move_descriptor(nvlist_t *nvl, const char *name, int value);
184 #endif
185 void nvlist_move_binary(nvlist_t *nvl, const char *name, void *value, size_t size);
186 void nvlist_move_uuid(nvlist_t *nvl, const char *name, uuid_t *value);
187 
188 /*
189  * The nvlist_get functions returns value associated with the given name.
190  * If it returns a pointer, the pointer represents internal buffer and should
191  * not be freed by the caller.
192  */
193 
194 bool		 nvlist_get_bool(const nvlist_t *nvl, const char *name);
195 uint64_t	 nvlist_get_number(const nvlist_t *nvl, const char *name);
196 uintptr_t	 nvlist_get_ptr(const nvlist_t *nvl, const char *name);
197 uint64_t	 nvlist_get_uint64(const nvlist_t *nvl, const char *name);
198 int64_t		 nvlist_get_int64(const nvlist_t *nvl, const char *name);
199 int		 nvlist_get_endpoint(const nvlist_t *nvl, const char *name);
200 uint64_t	 nvlist_get_date(const nvlist_t *nvl, const char *name);
201 
202 const char	*nvlist_get_string(const nvlist_t *nvl, const char *name);
203 const nvlist_t	*nvlist_get_nvlist(const nvlist_t *nvl, const char *name);
204 const nvlist_t	*nvlist_get_nvlist_array(const nvlist_t *nvl, const char *name);
205 const nvlist_t	*nvlist_get_nvlist_dictionary(const nvlist_t *nvl, const char *name);
206 #ifndef _KERNEL
207 int		 nvlist_get_descriptor(const nvlist_t *nvl, const char *name);
208 #endif
209 const void	*nvlist_get_binary(const nvlist_t *nvl, const char *name, size_t *sizep);
210 const uuid_t	*nvlist_get_uuid(const nvlist_t *nvl, const char *name);
211 
212 /*
213  * The nvlist_take functions returns value associated with the given name and
214  * remove the given entry from the nvlist.
215  * The caller is responsible for freeing received data.
216  */
217 
218 bool		 nvlist_take_bool(nvlist_t *nvl, const char *name);
219 uint64_t	 nvlist_take_number(nvlist_t *nvl, const char *name);
220 uintptr_t	 nvlist_take_ptr(nvlist_t *nvl, const char *name);
221 uint64_t	 nvlist_take_uint64(nvlist_t *nvl, const char *name);
222 int64_t		 nvlist_take_int64(nvlist_t *nvl, const char *name);
223 int		 nvlist_take_endpoint(nvlist_t *nvl, const char *name);
224 uint64_t	 nvlist_take_date(nvlist_t *nvl, const char *name);
225 char		*nvlist_take_string(nvlist_t *nvl, const char *name);
226 nvlist_t	*nvlist_take_nvlist(nvlist_t *nvl, const char *name);
227 nvlist_t	*nvlist_take_nvlist_array(nvlist_t *nvl, const char *name);
228 nvlist_t	*nvlist_take_nvlist_dictionary(nvlist_t *nvl, const char *name);
229 
230 #ifndef _KERNEL
231 int		 nvlist_take_descriptor(nvlist_t *nvl, const char *name);
232 #endif
233 void		*nvlist_take_binary(nvlist_t *nvl, const char *name, size_t *sizep);
234 uuid_t		*nvlist_take_uuid(nvlist_t *nvl, const char *name);
235 
236 /*
237  * The nvlist_free functions removes the given name/value pair from the nvlist
238  * and frees memory associated with it.
239  */
240 
241 void nvlist_free(nvlist_t *nvl, const char *name);
242 void nvlist_free_type(nvlist_t *nvl, const char *name, int type);
243 
244 void nvlist_free_null(nvlist_t *nvl, const char *name);
245 void nvlist_free_bool(nvlist_t *nvl, const char *name);
246 void nvlist_free_number(nvlist_t *nvl, const char *name);
247 void nvlist_free_ptr(nvlist_t *nvl, const char *name);
248 void nvlist_free_uint64(nvlist_t *nvl, const char *name);
249 void nvlist_free_int64(nvlist_t *nvl, const char *name);
250 void nvlist_free_endpoint(nvlist_t *nvl, const char *name);
251 void nvlist_free_date(nvlist_t *nvl, const char *name);
252 
253 void nvlist_free_string(nvlist_t *nvl, const char *name);
254 void nvlist_free_nvlist(nvlist_t *nvl, const char *name);
255 void nvlist_free_nvlist_array(nvlist_t *nvl, const char *name);
256 void nvlist_free_nvlist_dictionary(nvlist_t *nvl, const char *name);
257 #ifndef _KERNEL
258 void nvlist_free_descriptor(nvlist_t *nvl, const char *name);
259 #endif
260 void nvlist_free_binary(nvlist_t *nvl, const char *name);
261 void nvlist_free_uuid(nvlist_t *nvl, const char *name);
262 
263 /*
264  * Below are the same functions, but which operate on format strings and
265  * variable argument lists.
266  *
267  * Functions that are not inserting a new pair into the nvlist cannot handle
268  * a failure to allocate the memory to hold the new name.  Therefore these
269  * functions are not provided in the kernel.
270  */
271 
272 #ifndef _KERNEL
273 bool nvlist_existsf(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
274 bool nvlist_existsf_type(const nvlist_t *nvl, int type, const char *namefmt, ...) __printflike(3, 4);
275 
276 bool nvlist_existsf_null(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
277 bool nvlist_existsf_bool(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
278 bool nvlist_existsf_number(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
279 bool nvlist_existsf_ptr(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
280 bool nvlist_existsf_uint64(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
281 bool nvlist_existsf_int64(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
282 bool nvlist_existsf_endpoint(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
283 bool nvlist_existsf_date(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
284 bool nvlist_existsf_string(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
285 bool nvlist_existsf_nvlist(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
286 bool nvlist_existsf_nvlist_array(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
287 bool nvlist_existsf_nvlist_dictionary(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
288 bool nvlist_existsf_descriptor(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
289 bool nvlist_existsf_binary(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
290 bool nvlist_existsf_uuid(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
291 
292 bool nvlist_existsv(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
293 bool nvlist_existsv_type(const nvlist_t *nvl, int type, const char *namefmt, va_list nameap) __printflike(3, 0);
294 
295 bool nvlist_existsv_null(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
296 bool nvlist_existsv_bool(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
297 bool nvlist_existsv_number(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
298 bool nvlist_existsv_ptr(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
299 bool nvlist_existsv_uint64(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
300 bool nvlist_existsv_int64(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
301 bool nvlist_existsv_endpoint(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
302 bool nvlist_existsv_date(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
303 bool nvlist_existsv_string(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
304 bool nvlist_existsv_nvlist(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
305 bool nvlist_existsv_nvlist_array(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
306 bool nvlist_existsv_nvlist_dictionary(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
307 bool nvlist_existsv_descriptor(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
308 bool nvlist_existsv_binary(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
309 bool nvlist_existsv_uuid(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
310 #endif
311 
312 void nvlist_addf_null(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
313 void nvlist_addf_bool(nvlist_t *nvl, bool value, const char *namefmt, ...) __printflike(3, 4);
314 void nvlist_addf_number(nvlist_t *nvl, uint64_t value, const char *namefmt, ...) __printflike(3, 4);
315 void nvlist_addf_ptr(nvlist_t *nvl, uintptr_t value, const char *namefmt, ...) __printflike(3, 4);
316 void nvlist_addf_uint64(nvlist_t *nvl, uint64_t value, const char *namefmt, ...) __printflike(3, 4);
317 void nvlist_addf_int64(nvlist_t *nvl, int64_t value, const char *namefmt, ...) __printflike(3, 4);
318 void nvlist_addf_endpoint(nvlist_t *nvl, int value, const char *namefmt, ...) __printflike(3, 4);
319 void nvlist_addf_date(nvlist_t *nvl, uint64_t value, const char *namefmt, ...) __printflike(3, 4);
320 void nvlist_addf_string(nvlist_t *nvl, const char *value, const char *namefmt, ...) __printflike(3, 4);
321 void nvlist_addf_nvlist(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
322 void nvlist_addf_nvlist_array(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
323 void nvlist_addf_nvlist_dictionary(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
324 #ifndef _KERNEL
325 void nvlist_addf_descriptor(nvlist_t *nvl, int value, const char *namefmt, ...) __printflike(3, 4);
326 #endif
327 void nvlist_addf_binary(nvlist_t *nvl, const void *value, size_t size, const char *namefmt, ...) __printflike(4, 5);
328 void nvlist_addf_uuid(nvlist_t *nvl, const uuid_t *value, const char *namefmt, ...) __printflike(3, 4);
329 
330 #if !defined(_KERNEL) || defined(_VA_LIST_DECLARED)
331 void nvlist_addv_null(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
332 void nvlist_addv_bool(nvlist_t *nvl, bool value, const char *namefmt, va_list nameap) __printflike(3, 0);
333 void nvlist_addv_number(nvlist_t *nvl, uint64_t value, const char *namefmt, va_list nameap) __printflike(3, 0);
334 void nvlist_addv_ptr(nvlist_t *nvl, uintptr_t value, const char *namefmt, va_list nameap) __printflike(3, 0);
335 void nvlist_addv_uint64(nvlist_t *nvl, uint64_t value, const char *namefmt, va_list nameap) __printflike(3, 0);
336 void nvlist_addv_int64(nvlist_t *nvl, int64_t value, const char *namefmt, va_list nameap) __printflike(3, 0);
337 void nvlist_addv_endpoint(nvlist_t *nvl, int value, const char *namefmt, va_list nameap) __printflike(3, 0);
338 void nvlist_addv_date(nvlist_t *nvl, uint64_t value, const char *namefmt, va_list nameap) __printflike(3, 0);
339 void nvlist_addv_string(nvlist_t *nvl, const char *value, const char *namefmt, va_list nameap) __printflike(3, 0);
340 void nvlist_addv_nvlist(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
341 void nvlist_addv_nvlist_array(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
342 void nvlist_addv_nvlist_dictionary(nvlist_t *nvl, const nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
343 #ifndef _KERNEL
344 void nvlist_addv_descriptor(nvlist_t *nvl, int value, const char *namefmt, va_list nameap) __printflike(3, 0);
345 #endif
346 void nvlist_addv_binary(nvlist_t *nvl, const void *value, size_t size, const char *namefmt, va_list nameap) __printflike(4, 0);
347 void nvlist_addv_uuid(nvlist_t *nvl, const uuid_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
348 #endif
349 
350 void nvlist_movef_string(nvlist_t *nvl, char *value, const char *namefmt, ...) __printflike(3, 4);
351 void nvlist_movef_nvlist(nvlist_t *nvl, nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
352 void nvlist_movef_nvlist_array(nvlist_t *nvl, nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
353 void nvlist_movef_nvlist_dictionary(nvlist_t *nvl, nvlist_t *value, const char *namefmt, ...) __printflike(3, 4);
354 #ifndef _KERNEL
355 void nvlist_movef_descriptor(nvlist_t *nvl, int value, const char *namefmt, ...) __printflike(3, 4);
356 #endif
357 void nvlist_movef_binary(nvlist_t *nvl, void *value, size_t size, const char *namefmt, ...) __printflike(4, 5);
358 void nvlist_movef_uuid(nvlist_t *nvl, uuid_t *value, const char *namefmt, ...) __printflike(3, 4);
359 
360 #if !defined(_KERNEL) || defined(_VA_LIST_DECLARED)
361 void nvlist_movev_string(nvlist_t *nvl, char *value, const char *namefmt, va_list nameap) __printflike(3, 0);
362 void nvlist_movev_nvlist(nvlist_t *nvl, nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
363 void nvlist_movev_nvlist_array(nvlist_t *nvl, nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
364 void nvlist_movev_nvlist_dictionary(nvlist_t *nvl, nvlist_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
365 #ifndef _KERNEL
366 void nvlist_movev_descriptor(nvlist_t *nvl, int value, const char *namefmt, va_list nameap) __printflike(3, 0);
367 #endif
368 void nvlist_movev_binary(nvlist_t *nvl, void *value, size_t size, const char *namefmt, va_list nameap) __printflike(4, 0);
369 void nvlist_movev_uuid(nvlist_t *nvl, uuid_t *value, const char *namefmt, va_list nameap) __printflike(3, 0);
370 #endif
371 
372 #ifndef _KERNEL
373 bool		 nvlist_getf_bool(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
374 uint64_t	 nvlist_getf_number(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
375 uintptr_t	 nvlist_getf_ptr(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
376 uint64_t	 nvlist_getf_uint64(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
377 int64_t		 nvlist_getf_int64(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
378 int		 nvlist_getf_endpoint(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
379 uint64_t	 nvlist_getf_date(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
380 const char	*nvlist_getf_string(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
381 const nvlist_t	*nvlist_getf_nvlist(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
382 const nvlist_t	*nvlist_getf_nvlist_array(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
383 const nvlist_t	*nvlist_getf_nvlist_dictionary(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
384 int		 nvlist_getf_descriptor(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
385 const void	*nvlist_getf_binary(const nvlist_t *nvl, size_t *sizep, const char *namefmt, ...) __printflike(3, 4);
386 const uuid_t	*nvlist_getf_uuid(const nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
387 
388 bool		 nvlist_getv_bool(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
389 uint64_t	 nvlist_getv_number(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
390 uintptr_t	 nvlist_getv_ptr(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
391 uint64_t	 nvlist_getv_uint64(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
392 int64_t	 	 nvlist_getv_int64(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
393 int	 	 nvlist_getv_endpoint(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
394 uint64_t	 nvlist_getv_date(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
395 const char	*nvlist_getv_string(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
396 const nvlist_t	*nvlist_getv_nvlist(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
397 const nvlist_t	*nvlist_getv_nvlist_array(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
398 const nvlist_t	*nvlist_getv_nvlist_dictionary(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
399 int		 nvlist_getv_descriptor(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
400 const void	*nvlist_getv_binary(const nvlist_t *nvl, size_t *sizep, const char *namefmt, va_list nameap) __printflike(3, 0);
401 const uuid_t	*nvlist_getv_uuid(const nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
402 
403 bool		 nvlist_takef_bool(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
404 uint64_t	 nvlist_takef_number(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
405 uintptr_t	 nvlist_takef_ptr(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
406 uint64_t	 nvlist_takef_uint64(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
407 int64_t	 	 nvlist_takef_int64(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
408 int		 nvlist_takef_endpoint(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
409 uint64_t	 nvlist_takef_date(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
410 char		*nvlist_takef_string(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
411 nvlist_t	*nvlist_takef_nvlist(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
412 nvlist_t	*nvlist_takef_nvlist_array(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
413 nvlist_t	*nvlist_takef_nvlist_dictionary(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
414 int		 nvlist_takef_descriptor(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
415 void		*nvlist_takef_binary(nvlist_t *nvl, size_t *sizep, const char *namefmt, ...) __printflike(3, 4);
416 uuid_t		*nvlist_takef_uuid(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
417 
418 bool		 nvlist_takev_bool(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
419 uint64_t	 nvlist_takev_number(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
420 uintptr_t	 nvlist_takev_ptr(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
421 uint64_t	 nvlist_takev_uint64(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
422 int64_t		 nvlist_takev_int64(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
423 int		 nvlist_takev_endpoint(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
424 uint64_t	 nvlist_takev_date(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
425 char		*nvlist_takev_string(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
426 nvlist_t	*nvlist_takev_nvlist(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
427 nvlist_t	*nvlist_takev_nvlist_array(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
428 nvlist_t	*nvlist_takev_nvlist_dictionary(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
429 int		 nvlist_takev_descriptor(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
430 void		*nvlist_takev_binary(nvlist_t *nvl, size_t *sizep, const char *namefmt, va_list nameap) __printflike(3, 0);
431 uuid_t		*nvlist_takev_uuid(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
432 
433 void nvlist_freef(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
434 void nvlist_freef_type(nvlist_t *nvl, int type, const char *namefmt, ...) __printflike(3, 4);
435 
436 void nvlist_freef_null(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
437 void nvlist_freef_bool(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
438 void nvlist_freef_number(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
439 void nvlist_freef_ptr(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
440 void nvlist_freef_uint64(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
441 void nvlist_freef_int64(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
442 void nvlist_freef_endpoint(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
443 void nvlist_freef_date(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
444 void nvlist_freef_string(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
445 void nvlist_freef_nvlist(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
446 void nvlist_freef_nvlist_array(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
447 void nvlist_freef_nvlist_dictionary(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
448 void nvlist_freef_descriptor(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
449 void nvlist_freef_binary(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
450 void nvlist_freef_uuid(nvlist_t *nvl, const char *namefmt, ...) __printflike(2, 3);
451 
452 void nvlist_freev(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
453 void nvlist_freev_type(nvlist_t *nvl, int type, const char *namefmt, va_list nameap) __printflike(3, 0);
454 
455 void nvlist_freev_null(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
456 void nvlist_freev_bool(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
457 void nvlist_freev_number(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
458 void nvlist_freev_ptr(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
459 void nvlist_freev_uint64(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
460 void nvlist_freev_int64(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
461 void nvlist_freev_endpoint(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
462 void nvlist_freev_date(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
463 void nvlist_freev_string(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
464 void nvlist_freev_nvlist(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
465 void nvlist_freev_nvlist_array(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
466 void nvlist_freev_nvlist_dictionary(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
467 void nvlist_freev_descriptor(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
468 void nvlist_freev_binary(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
469 void nvlist_freev_uuid(nvlist_t *nvl, const char *namefmt, va_list nameap) __printflike(2, 0);
470 #endif /* _KERNEL */
471 
472 __END_DECLS
473 
474 #endif	/* !_NV_H_ */
475