2 .\" Copyright (c) 2004, 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_NEXT_NVPAIR 3NVPAIR "Feb 2, 2004"
8 nvlist_next_nvpair, nvpair_name, nvpair_type \- return data regarding
13 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lnvpair\fR [ \fIlibrary\fR... ]
14 #include <libnvpair.h>
16 \fBnvpair_t *\fR\fBnvlist_next_nvpair\fR(\fBnvlist_t *\fR\fInvl\fR, \fBnvpair_t *\fR\fInvpair\fR);
21 \fBchar *\fR\fBnvpair_name\fR(\fBnvpair_t *\fR\fInvpair\fR);
26 \fBdata_type_t\fR \fBnvpair_type\fR(\fBnvpair_t *\fR\fInvpair\fR);
36 The \fBnvlist_t\fR to be processed.
45 Handle to a name-value pair.
51 The \fBnvlist_next_nvpair()\fR function returns a handle to the next
52 \fBnvpair\fR in the list following \fBnvpair\fR. If \fBnvpair\fR is \fINULL\fR,
53 the first pair is returned. If \fBnvpair\fR is the last pair in the
54 \fBnvlist\fR, \fINULL\fR is returned.
57 The \fBnvpair_name()\fR function returns a string containing the name of
61 The \fBnvpair_type()\fR function retrieves the value of the \fBnvpair\fR in the
62 form of enumerated type \fBdata_type_t\fR. This is used to determine the
63 appropriate \fBnvpair_*()\fR function to call for retrieving the value.
67 Upon successful completion, \fBnvpair_name()\fR returns a string containing the
68 name of the name-value pair.
71 Upon successful completion, \fBnvpair_type()\fR returns an enumerated data type
72 \fBdata_type_t\fR. Possible values for \fBdata_type_t\fR are as follows:
77 \fBDATA_TYPE_BOOLEAN\fR
83 \fBDATA_TYPE_BOOLEAN_VALUE\fR
101 \fBDATA_TYPE_UINT8\fR
107 \fBDATA_TYPE_INT16\fR
113 \fBDATA_TYPE_UINT16\fR
119 \fBDATA_TYPE_INT32\fR
125 \fBDATA_TYPE_UINT32\fR
131 \fBDATA_TYPE_INT64\fR
137 \fBDATA_TYPE_UINT64\fR
143 \fBDATA_TYPE_STRING\fR
149 \fBDATA_TYPE_NVLIST\fR
155 \fBDATA_TYPE_BOOLEAN_ARRAY\fR
161 \fBDATA_TYPE_BYTE_ARRAY\fR
167 \fBDATA_TYPE_INT8_ARRAY\fR
173 \fBDATA_TYPE_UINT8_ARRAY\fR
179 \fBDATA_TYPE_INT16_ARRAY\fR
185 \fBDATA_TYPE_UINT16_ARRAY\fR
191 \fBDATA_TYPE_INT32_ARRAY\fR
197 \fBDATA_TYPE_UINT32_ARRAY\fR
203 \fBDATA_TYPE_INT64_ARRAY\fR
209 \fBDATA_TYPE_UINT64_ARRAY\fR
215 \fBDATA_TYPE_STRING_ARRAY\fR
221 \fBDATA_TYPE_NVLIST_ARRAY\fR
225 Upon reaching the end of a list, \fBnvlist_next_pair()\fR returns \fINULL\fR.
226 Otherwise, the function returns a handle to next \fBnvpair\fR in the list.
229 These and other \fBlibnvpair\fR(3LIB) functions cannot manipulate nvpairs after
230 they have been removed from or replaced in an nvlist. Replacement can occur
231 during pair additions to nvlists created with \fBNV_UNIQUE_NAME_TYPE\fR and
232 \fBNV_UNIQUE_NAME\fR. See \fBnvlist_alloc\fR(3NVPAIR).
236 No errors are defined.
239 \fBExample 1 \fRExample of usage of \fBnvlist_next_nvpair()\fR.
244 * usage of nvlist_next_nvpair()
247 edit_nvl(nvlist_t *nvl)
249 nvpair_t *curr = nvlist_next_nvpair(nvl, NULL);
251 while (curr != NULL) {
253 nvpair_t *next = nvlist_next_nvpair(nvl, curr);
255 if (!nvl_check(curr))
256 if ((err = nvlist_remove(nvl, nvpair_name(curr),
257 nvpair_type(curr))) != 0)
270 See \fBattributes\fR(5) for descriptions of the following attributes:
278 ATTRIBUTE TYPE ATTRIBUTE VALUE
280 Interface Stability Evolving
288 \fBlibnvpair\fR(3LIB), \fBnvlist_alloc\fR(3NVPAIR), \fBattributes\fR(5)
292 The enumerated nvpair data types might not be an exhaustive list and new data
293 types can be added. An application using the data type enumeration,
294 \fBdata_type_t\fR, should be written to expect or ignore new data types.