The retrival function will not fail if no matching name-value pair is found.

Description

These functions find the nvpair that matches the name and type as
indicated by the interface name. If one is found, nelem and val
are modified to contain the number of elements in value and the
starting address of data, respectively.

These interfaces work for nvlist_t allocated with NV_UNIQUE_NAME or NV_UNIQUE_NAME_TYPE specified in
nvlist_alloc(). See nvlist_alloc(9F). If this is not the case, the interface will
return ENOTSUP because the list potentially contains multiple nvpairs with the same
name and type.

Multiple threads can simultaneously read the same nvlist_t but only one thread
should actively change a given nvlist_t at a time. The caller is
responsible for the synchronization.

All memory required for storing the array elements, including string values, are
managed by the library. References to such data remain valid until nvlist_free()
is called on nvl.

The nvlist_lookup_pairs() function retrieves a set of nvpairs. The arguments are a
null-terminated list of pairs (data type DATA_TYPE_BOOLEAN), triples (non-array data types) or
quads (array data types). As shown below, the interpretation of the arguments depends
on the value of type. See nvpair_type(9F).

name

Name of the name-value pair to search.

type

Data type.

val

Address to store the starting address of the value. When using data type DATA_TYPE_BOOLEAN, the val argument is ignored.

nelem

Address to store the number of elements in value. Non-array data types have only one argument and nelem is ignored.

The argument order is name, type, [val], [nelem].

When using NV_FLAG_NOENTOK and no matching name-value pair is found, the memory
pointed to by val and nelem is not touched.

These functions return 0 on success and an error value on failure.

Errors

These functions fail under the following conditions.

0

Success

EINVAL

Invalid argument

ENOENT

No matching name-value pair found

ENOTSUP

Encode/decode method not supported

Context

These functions can be called from user, interrupt, or kernel context.