1nvlist_next_nvpair(3NVPANIaRm)e-value Pair Library Functnivolnisst_next_nvpair(3NVPAIR)
2
3
4

NAME

6       nvlist_next_nvpair,  nvpair_name,  nvpair_type  - return data regarding
7       name-value pairs
8

SYNOPSIS

10       cc [ flag... ] file... -lnvpair [ library... ]
11       #include <libnvpair.h>
12
13       nvpair_t *nvlist_next_nvpair(nvlist_t *nvl, nvpair_t *nvpair);
14
15
16       char *nvpair_name(nvpair_t *nvpair);
17
18
19       data_type_t nvpair_type(nvpair_t *nvpair);
20
21

PARAMETERS

23       nvl       The nvlist_t to be processed.
24
25
26       nvpair    Handle to a name-value pair.
27
28

DESCRIPTION

30       The nvlist_next_nvpair() function returns a handle to the  next  nvpair
31       in  the  list  following  nvpair.  If nvpair is NULL, the first pair is
32       returned. If nvpair is the last pair in the nvlist, NULL is returned.
33
34
35       The nvpair_name() function returns a  string  containing  the  name  of
36       nvpair.
37
38
39       The  nvpair_type()  function  retrieves  the value of the nvpair in the
40       form of enumerated type data_type_t. This  is  used  to  determine  the
41       appropriate nvpair_*() function to call for retrieving the value.
42

RETURN VALUES

44       Upon  successful  completion, nvpair_name() returns a string containing
45       the name of the name-value pair.
46
47
48       Upon successful completion, nvpair_type() returns  an  enumerated  data
49       type data_type_t. Possible values for data_type_t are as follows:
50
51           o      DATA_TYPE_BOOLEAN
52
53           o      DATA_TYPE_BOOLEAN_VALUE
54
55           o      DATA_TYPE_BYTE
56
57           o      DATA_TYPE_INT8
58
59           o      DATA_TYPE_UINT8
60
61           o      DATA_TYPE_INT16
62
63           o      DATA_TYPE_UINT16
64
65           o      DATA_TYPE_INT32
66
67           o      DATA_TYPE_UINT32
68
69           o      DATA_TYPE_INT64
70
71           o      DATA_TYPE_UINT64
72
73           o      DATA_TYPE_STRING
74
75           o      DATA_TYPE_NVLIST
76
77           o      DATA_TYPE_BOOLEAN_ARRAY
78
79           o      DATA_TYPE_BYTE_ARRAY
80
81           o      DATA_TYPE_INT8_ARRAY
82
83           o      DATA_TYPE_UINT8_ARRAY
84
85           o      DATA_TYPE_INT16_ARRAY
86
87           o      DATA_TYPE_UINT16_ARRAY
88
89           o      DATA_TYPE_INT32_ARRAY
90
91           o      DATA_TYPE_UINT32_ARRAY
92
93           o      DATA_TYPE_INT64_ARRAY
94
95           o      DATA_TYPE_UINT64_ARRAY
96
97           o      DATA_TYPE_STRING_ARRAY
98
99           o      DATA_TYPE_NVLIST_ARRAY
100
101
102       Upon  reaching the end of a list, nvlist_next_pair() returns NULL. Oth‐
103       erwise, the function returns a handle to next nvpair in the list.
104
105
106       These and other libnvpair(3LIB)  functions  cannot  manipulate  nvpairs
107       after they have been removed from or replaced in an nvlist. Replacement
108       can   occur   during   pair   additions   to   nvlists   created   with
109       NV_UNIQUE_NAME_TYPE and NV_UNIQUE_NAME. See nvlist_alloc(3NVPAIR).
110

ERRORS

112       No errors are defined.
113

EXAMPLES

115       Example 1 Example of usage of nvlist_next_nvpair().
116
117         /*
118          * usage of nvlist_next_nvpair()
119          */
120          static int
121          edit_nvl(nvlist_t *nvl)
122          {
123              nvpair_t *curr = nvlist_next_nvpair(nvl, NULL);
124
125              while (curr != NULL) {
126                  int err;
127                 nvpair_t *next = nvlist_next_nvpair(nvl, curr);
128
129                 if (!nvl_check(curr))
130                     if ((err = nvlist_remove(nvl, nvpair_name(curr),
131                         nvpair_type(curr))) != 0)
132                             return (err);
133
134                  curr = next;
135              }
136             return (0);
137          }
138
139

ATTRIBUTES

141       See attributes(5) for descriptions of the following attributes:
142
143
144
145
146       ┌────────────────────────────┬──────────────────────────────┐
147       │      ATTRIBUTE TYPE        │       ATTRIBUTE VALUE        │
148       ├────────────────────────────┼──────────────────────────────┤
149       │Interface Stability         │ Evolving                     │
150       ├────────────────────────────┼──────────────────────────────┤
151       │MT-Level                    │ MT-Safe                      │
152       └────────────────────────────┴──────────────────────────────┘
153

SEE ALSO

155       libnvpair(3LIB), nvlist_alloc(3NVPAIR), attributes(5)
156

NOTES

158       The  enumerated  nvpair  data types might not be an exhaustive list and
159       new data types can be added.  An application using the data  type  enu‐
160       meration,  data_type_t,  should be written to expect or ignore new data
161       types.
162
163
164
165SunOS 5.11                        2 Feb 2004       nvlist_next_nvpair(3NVPAIR)
Impressum