2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH NVLIST_LOOKUP_BOOLEAN 9F "May 20, 2006"
8 nvlist_lookup_boolean, nvlist_lookup_boolean_value, nvlist_lookup_byte,
9 nvlist_lookup_int8, nvlist_lookup_int16, nvlist_lookup_int32,
10 nvlist_lookup_int64, nvlist_lookup_uint8, nvlist_lookup_uint16,
11 nvlist_lookup_uint32, nvlist_lookup_uint64, nvlist_lookup_string,
12 nvlist_lookup_nvlist, nvlist_lookup_boolean_array, nvlist_lookup_byte_array,
13 nvlist_lookup_int8_array, nvlist_lookup_int16_array, nvlist_lookup_int32_array,
14 nvlist_lookup_int64_array, nvlist_lookup_uint8_array,
15 nvlist_lookup_uint16_array, nvlist_lookup_uint32_array,
16 nvlist_lookup_uint64_array, nvlist_lookup_string_array,
17 nvlist_lookup_nvlist_array, nvlist_lookup_pairs \- match name and type
18 indicated by the interface name and retrieve data value
22 #include <sys/nvpair.h>
24 \fBint\fR \fBnvlist_lookup_boolean\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR);
29 \fBint\fR \fBnvlist_lookup_boolean_value\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
30 \fBboolean_t *\fR\fIval\fR);
35 \fBint\fR \fBnvlist_lookup_byte\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
36 \fBuchar_t *\fR\fIval\fR);
41 \fBint\fR \fBnvlist_lookup_int8\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
42 \fBint8_t *\fR\fIval\fR);
47 \fBint\fR \fBnvlist_lookup_uint8\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
48 \fBuint8_t *\fR\fIval\fR);
53 \fBint\fR \fBnvlist_lookup_int16\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
54 \fBint16_t *\fR\fIval\fR);
59 \fBint\fR \fBnvlist_lookup_uint16\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
60 \fBuint16_t *\fR\fIval\fR);
65 \fBint\fR \fBnvlist_lookup_int32\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
66 \fBint32_t *\fR\fIval\fR);
71 \fBint\fR \fBnvlist_lookup_uint32\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
72 \fBuint32_t *\fR\fIval\fR);
77 \fBint\fR \fBnvlist_lookup_int64\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
78 \fBint64_t *\fR\fIval\fR);
83 \fBint\fR \fBnvlist_lookup_uint64\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
84 \fBuint64_t *\fR\fIval\fR);
89 \fBint\fR \fBnvlist_lookup_string\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
90 \fBchar **\fR\fIval\fR);
95 \fBint\fR \fBnvlist_lookup_nvlist\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
96 \fBnvlist_t **\fR\fIval\fR);
101 \fBint\fR \fBnvlist_lookup_boolean_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
102 \fBboolean_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
107 \fBint\fR \fBnvlist_lookup_byte_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
108 \fBuchar_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
113 \fBint\fR \fBnvlist_lookup_int8_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
114 \fBint8_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
119 \fBint\fR \fBnvlist_lookup_uint8_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
120 \fBuint8_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
125 \fBint\fR \fBnvlist_lookup_int16_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
126 \fBint16_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
131 \fBint\fR \fBnvlist_lookup_uint16_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
132 \fBuint16_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
137 \fBint\fR \fBnvlist_lookup_int32_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
138 \fBint32_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
143 \fBint\fR \fBnvlist_lookup_uint32_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
144 \fBuint32_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
149 \fBint\fR \fBnvlist_lookup_int64_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
150 \fBint64_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
155 \fBint\fR \fBnvlist_lookup_uint64_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
156 \fBuint64_t **\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
161 \fBint\fR \fBnvlist_lookup_string_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
162 \fBchar ***\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
167 \fBint\fR \fBnvlist_lookup_nvlist_array\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
168 \fBnvlist_t ***\fR\fIval\fR, \fBuint_t *\fR\fInelem\fR);
173 \fBint\fR \fBnvlist_lookup_pairs\fR(\fBnvlist_t *\fR\fInvl\fR, \fBint\fR \fIflag, ...\fR);
179 Solaris DDI specific (Solaris DDI)
187 The list of name-value pairs (\fBnvlist_t\fR) to be processed.
196 Name of the name-value pair (\fBnvpair\fR) to search.
205 Address to store the number of elements in value.
214 Address to store the value or starting address of the array value.
223 Specify bit fields defining lookup behavior:
227 \fBNV_FLAG_NOENTOK\fR
230 The retrival function will not fail if no matching name-value pair is found.
238 These functions find the \fBnvpair\fR that matches the name and type as
239 indicated by the interface name. If one is found, \fInelem\fR and \fIval\fR are
240 modified to contain the number of elements in value and the starting address of
244 These interfaces work for \fBnvlist_t\fR allocated with \fBNV_UNIQUE_NAME\fR or
245 \fBNV_UNIQUE_NAME_TYPE\fR specified in \fBnvlist_alloc()\fR. See
246 \fBnvlist_alloc\fR(9F). If this is not the case, the interface will return
247 \fBENOTSUP\fR because the list potentially contains multiple \fBnvpair\fRs with
248 the same name and type.
251 Multiple threads can simultaneously read the same \fBnvlist_t\fR but only one
252 thread should actively change a given \fBnvlist_t\fR at a time. The caller is
253 responsible for the synchronization.
256 All memory required for storing the array elements, including string values,
257 are managed by the library. References to such data remain valid until
258 \fBnvlist_free()\fR is called on \fInvl\fR.
261 The \fBnvlist_lookup_pairs()\fR function retrieves a set of \fBnvpair\fRs. The
262 arguments are a null-terminated list of pairs (data type
263 \fBDATA_TYPE_BOOLEAN\fR), triples (non-array data types) or quads (array data
264 types). As shown below, the interpretation of the arguments depends on the
265 value of \fItype\fR. See \fBnvpair_type\fR(9F).
272 Name of the name-value pair to search.
290 Address to store the starting address of the value. When using data type
291 \fBDATA_TYPE_BOOLEAN\fR, the \fIval\fR argument is ignored.
300 Address to store the number of elements in value. Non-array data types have
301 only one argument and \fInelem\fR is ignored.
306 The argument order is \fIname\fR, \fItype\fR, [\fIval\fR], [\fInelem\fR].
309 When using \fBNV_FLAG_NOENTOK\fR and no matching name-value pair is found, the
310 memory pointed to by \fIval\fR and \fInelem\fR is not touched.
313 These functions return \fB0\fR on success and an error value on failure.
317 These functions fail under the following conditions.
342 No matching name-value pair found
351 Encode/decode method not supported
357 These functions can be called from user, interrupt, or kernel context.
361 See \fBattributes\fR(5) for descriptions of the following attributes:
369 ATTRIBUTE TYPE ATTRIBUTE VALUE
371 Interface Stability Committed
377 \fBnvlist_alloc\fR(9F), \fBnvpair_type\fR(9F)
380 \fIWriting Device Drivers\fR
383 \fISTREAMS Programming Guide\fR