8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / man / man9f / ddi_prop_exists.9f
blobf88fcfe9c5fc9150ef7a375bd13eccb5986c6687
1 '\" te
2 .\" Copyright (c) 1995, Sun Microsystems, Inc.
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 DDI_PROP_EXISTS 9F "May 22, 1995"
7 .SH NAME
8 ddi_prop_exists \- check for the existence of a property
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/ddi.h>
13 #include <sys/sunddi.h>
17 \fBint\fR \fBddi_prop_exists\fR(\fBdev_t\fR \fImatch_dev\fR, \fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIflags\fR,
18      \fBchar *\fR\fIname\fR);
19 .fi
21 .SH INTERFACE LEVEL
22 .sp
23 .LP
24 Solaris DDI specific (Solaris DDI).
25 .SH PARAMETERS
26 .sp
27 .ne 2
28 .na
29 \fB\fImatch_dev\fR \fR
30 .ad
31 .RS 14n
32 Device number associated with property or \fBDDI_DEV_T_ANY.\fR
33 .RE
35 .sp
36 .ne 2
37 .na
38 \fB\fIdip\fR \fR
39 .ad
40 .RS 14n
41 Pointer to the device info node of device whose property list should be
42 searched.
43 .RE
45 .sp
46 .ne 2
47 .na
48 \fB\fIflags\fR \fR
49 .ad
50 .RS 14n
51 Possible flag values are some combination of:
52 .sp
53 .ne 2
54 .na
55 \fB\fBDDI_PROP_DONTPASS\fR \fR
56 .ad
57 .RS 22n
58 Do not pass request to parent device information node if the property  is not
59 found.
60 .RE
62 .sp
63 .ne 2
64 .na
65 \fB\fBDDI_PROP_NOTPROM\fR \fR
66 .ad
67 .RS 22n
68 Do not look at  \fBPROM \fRproperties (ignored on platforms that do not support
69 \fBPROM \fRproperties).
70 .RE
72 .RE
74 .sp
75 .ne 2
76 .na
77 \fB\fIname\fR \fR
78 .ad
79 .RS 14n
80 String containing the name of the property.
81 .RE
83 .SH DESCRIPTION
84 .sp
85 .LP
86 \fBddi_prop_exists()\fR checks for the existence of a property regardless  of
87 the property value data type.
88 .sp
89 .LP
90 Properties are searched for based on the \fIdip\fR, \fIname\fR, and
91 \fImatch_dev\fR. The property search order is as follows:
92 .RS +4
93 .TP
95 Search software properties created by the driver.
96 .RE
97 .RS +4
98 .TP
100 Search the software properties created by the system (or nexus nodes in the
101 device info tree).
103 .RS +4
106 Search the driver global properties list.
108 .RS +4
111 If \fBDDI_PROP_NOTPROM\fR is not set, search the \fBPROM \fRproperties (if
112 they exist).
114 .RS +4
117 If \fBDDI_PROP_DONTPASS\fR is not set, pass this request to the parent
118 device information node.
120 .RS +4
123 Return \fB0\fR if not found and \fB1\fR if found.
127 Usually, the \fImatch_dev\fR argument should be set to the actual device number
128 that this property is associated with.  However, if the  \fImatch_dev\fR
129 argument is \fBDDI_DEV_T_ANY,\fR then  \fBddi_prop_exists()\fR will match the
130 request  regardless of the  \fImatch_dev\fR the property was created with.
131 That is the first property whose name matches \fIname\fR will be returned.  If
132 a property was created with  \fImatch_dev\fR set to  \fBDDI_DEV_T_NONE\fR then
133 the only way to look up this property is with a  \fImatch_dev\fR set to
134 \fBDDI_DEV_T_ANY.\fR \fBPROM \fRproperties are always created with
135 \fImatch_dev\fR set to \fBDDI_DEV_T_NONE.\fR
138 \fIname\fR must always be set to the name of the property being looked up.
139 .SH RETURN VALUES
142 \fBddi_prop_exists()\fR returns  \fB1\fR if the property exists and  \fB0\fR
143 otherwise.
144 .SH CONTEXT
147 These functions can be called from user or kernel context.
148 .SH EXAMPLES
150 \fBExample 1 \fR: Using \fBddi_prop_exists()\fR
153 The following example demonstrates the use of  \fBddi_prop_exists()\fR.
156 .in +2
159         * Enable "whizzy" mode if the "whizzy-mode" property exists
160         */
161         if (ddi_prop_exists(xx_dev, xx_dip, DDI_PROP_NOTPROM,
162                 "whizzy-mode") == 1) {
163               xx_enable_whizzy_mode(xx_dip);
164         } else {
165               xx_disable_whizzy_mode(xx_dip);
166         }
168 .in -2
170 .SH SEE ALSO
173 \fBddi_prop_get_int\fR(9F), \fBddi_prop_lookup\fR(9F),
174 \fBddi_prop_remove\fR(9F), \fBddi_prop_update\fR(9F)
177 \fIWriting Device Drivers\fR