Skip to content

Commit ae1cc41

Browse files
committed
nv.9: Editorial pass
Various rewording tweaks and clarifications to some behavior (e.g. nvlist_size doesn't require calling nvlist_pack first). Reviewed by: pjd Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D48256
1 parent 826509a commit ae1cc41

File tree

3 files changed

+330
-214
lines changed

3 files changed

+330
-214
lines changed

share/man/man9/cnv.9

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2424
.\" SUCH DAMAGE.
2525
.\"
26-
.Dd June 18, 2018
26+
.Dd January 3, 2025
2727
.Dt CNV 9
2828
.Os
2929
.Sh NAME
3030
.Nm cnvlist_get ,
3131
.Nm cnvlist_take ,
3232
.Nm cnvlist_free
33-
.Nd "API for managing name/value pairs by cookie."
33+
.Nd "API for managing name/value pairs by cookie"
3434
.Sh LIBRARY
3535
.Lb libnv
3636
.Sh SYNOPSIS
@@ -115,7 +115,7 @@ The
115115
.Nm libnv
116116
library permits easy management of name/value pairs and can send and receive
117117
them over sockets.
118-
For more information, also see
118+
For more information, see
119119
.Xr nv 9 .
120120
.Pp
121121
The concept of cookies is explained in
@@ -128,44 +128,50 @@ from
128128
.Pp
129129
The
130130
.Fn cnvlist_name
131-
function returns the name of an element associated with the given cookie.
131+
function returns the name of an element associated with
132+
.Fa cookie .
132133
.Pp
133134
The
134135
.Fn cnvlist_type
135-
function returns the type of an element associated with the given cookie.
136+
function returns the type of an element associated with
137+
.Fa cookie .
136138
Types which can be returned are described in
137139
.Xr nv 9 .
138140
.Pp
139141
The
140142
.Nm cnvlist_get
141-
family of functions obtains the value associated with the given cookie.
143+
functions return the value associated with
144+
.Fa cookie .
142145
Returned strings, nvlists, descriptors, binaries, or arrays must not be modified
143-
by the user, since they still belong to the nvlist.
146+
by the user since they still belong to the nvlist.
144147
The nvlist must not be in an error state.
145148
.Pp
146149
The
147150
.Nm cnvlist_take
148-
family of functions returns the value associated with the given cookie and
149-
removes the element from the nvlist.
151+
functions return the value associated with the given cookie and
152+
remove the element from the nvlist.
150153
When the value is a string, binary, or array value, the caller is responsible
151154
for freeing the returned memory with
152155
.Fn free 3 .
153156
When the value is an nvlist, the caller is responsible for destroying the
154157
returned nvlist with
155158
.Fn nvlist_destroy .
156159
When the value is a descriptor, the caller is responsible for closing the
157-
returned descriptor with the
160+
returned descriptor with
158161
.Fn close 2 .
159162
.Pp
160163
The
161164
.Nm cnvlist_free
162-
family of functions removes an element of the supplied cookie and frees all
163-
resources.
164-
If an element of the given cookie has the wrong type or does not exist, the
165+
functions remove the element identified by
166+
.Fa cookie
167+
and free any associated resources.
168+
If the element identified by
169+
.Fa cookie
170+
has the wrong type or does not exist, the
165171
program
166-
is aborted.
172+
aborts.
167173
.Sh EXAMPLES
168-
The following example demonstrates how to deal with cnvlist API.
174+
The following example demonstrates how to deal with the cnvlist API.
169175
.Bd -literal
170176
int type;
171177
void *cookie, *scookie, *bcookie;

share/man/man9/dnv.9

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2424
.\" SUCH DAMAGE.
2525
.\"
26-
.Dd July 26, 2016
26+
.Dd January 3, 2025
2727
.Dt DNV 9
2828
.Os
2929
.Sh NAME
3030
.Nm dnvlist_get ,
3131
.Nm dnvlist_take
32-
.Nd "API for getting name/value pairs. Nonexistent pairs do not raise an error."
32+
.Nd "API for getting name/value pairs with a default value"
3333
.Sh LIBRARY
3434
.Lb libnv
3535
.Sh SYNOPSIS
@@ -63,26 +63,32 @@ The
6363
.Nm libnv
6464
library permits easy management of name/value pairs and can send and receive
6565
them over sockets.
66-
For more information, also see
66+
For more information, see
6767
.Xr nv 9 .
6868
.Pp
6969
The
7070
.Nm dnvlist_get
71-
family of functions returns the value associated with the specified name.
72-
If an element of the specified name does not exist, the function returns the
71+
functions return the value associated with
72+
.Fa name .
73+
If an element named
74+
.Fa name
75+
does not exist, the function returns the
7376
value provided in
7477
.Fa defval .
7578
Returned strings, nvlists, descriptors, binaries, or arrays must not be modified
76-
by the user.
77-
They still belong to the nvlist.
79+
by the user since they still belong to the nvlist.
7880
If the nvlist is in an error state, attempts to use any of these functions will
7981
cause the program to abort.
8082
.Pp
8183
The
8284
.Nm dnvlist_take
83-
family of functions returns the value associated with the specified name and
84-
removes the element from the nvlist.
85-
If an element of the supplied name does not exist, the value provided in
85+
functions return the value associated with
86+
.Fa name
87+
and removes the associated element from
88+
.Fa nvl .
89+
If an element named
90+
.Fa name
91+
does not exist, the value provided in
8692
.Nm defval
8793
is returned.
8894
When the value is a string, binary, or array value, the caller is

0 commit comments

Comments
 (0)