8559 Add EFI utility functions to libefi
[unleashed.git] / share / man / man3nvpair / nvlist_lookup_nvpair.3nvpair
blob05799bf2a202ee8dbdac75589a366da1dd3c5eb4
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems Inc. All Rights Reserved.
3 .\" Copyright 2016 Joyent, Inc.
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH NVLIST_LOOKUP_NVPAIR 3NVPAIR "Mar 13, 2016"
8 .SH NAME
9 nvlist_lookup_nvpair, nvlist_exists, nvlist_empty \- lookup named pairs
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... -\fBlnvpair\fR [ \fIlibrary\fR... ]
14 #include <libnvpair.h>
16 \fBint\fR \fBnvlist_lookup_nvpair\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR,
17      nvpair_t **\fInvp\fR);
18 .fi
20 .LP
21 .nf
22 \fBboolean_t\fR \fBnvlist_exists\fR(\fBnvlist_t *\fR\fInvl\fR, \fBconst char *\fR\fIname\fR);
23 .fi
25 .LP
26 .nf
27 \fBboolean_t\fR \fBnvlist_empty\fR(\fBnvlist_t *\fR\fInvl\fR);
28 .fi
30 .SH DESCRIPTION
31 .LP
32 The \fBnvlist_lookup_nvpair()\fR function returns the nvpair with the matching
33 name, regardless of type. It is valid only for lists allocated with
34 \fBNV_UNIQUE_NAME\fR. See \fBnvlist_alloc\fR(3NVPAIR).
35 .sp
36 .LP
37 The \fBnvlist_exists()\fR function returns success if any nvpair exists with
38 the given name. It is valid for all types of lists.
39 .sp
40 .LP
41 The \fBnvlist_empty()\fR function returns success if the list \fInvl\fR
42 contains no nvpairs. It is valid for all types of lists.
43 .SH RETURN VALUES
44 .LP
45 The \fBnvlist_lookup_nvpair()\fR function returns 0 on success and an error
46 value on failure.
47 .sp
48 .LP
49 The \fBnvlist_exists()\fR function returns \fBB_TRUE\fR if an nvpair with the
50 given name exists and \fBB_FALSE\fR otherwise.
51 .sp
52 .LP
53 The \fBnvlist_empty()\fR function returns \fBB_TRUE\fR if the given
54 list, \fInvl\fR, contains no nvpairs and \fBB_FALSE\fR otherwise.
55 .SH ERRORS
56 .LP
57 The \fBnvlist_lookup_nvpair()\fR function will fail if:
58 .sp
59 .ne 2
60 .na
61 \fB\fBEINVAL\fR\fR
62 .ad
63 .RS 11n
64 There is an invalid argument.
65 .RE
67 .sp
68 .ne 2
69 .na
70 \fB\fBENOENT\fR\fR
71 .ad
72 .RS 11n
73 No matching name-value pair is found.
74 .RE
76 .sp
77 .ne 2
78 .na
79 \fB\fBENOTSUP\fR\fR
80 .ad
81 .RS 11n
82 The list was not allocated with \fBNV_UNIQUE_NAME\fR.
83 .RE
85 .SH ATTRIBUTES
86 .LP
87 See \fBattributes\fR(5) for descriptions of the following attributes:
88 .sp
90 .sp
91 .TS
92 box;
93 c | c
94 l | l .
95 ATTRIBUTE TYPE  ATTRIBUTE VALUE
97 Interface Stability     Committed
99 MT-Level        MT-Safe
102 .SH SEE ALSO
104 \fBlibnvpair\fR(3LIB), \fBnvlist_alloc\fR(3NVPAIR), \fBattributes\fR(5),
105 \fBnvlist_lookup_nvpair\fR(9F)