1ddi_prop_exists(9F)      Kernel Functions for Drivers      ddi_prop_exists(9F)
2
3
4

NAME

6       ddi_prop_exists - check for the existence of a property
7

SYNOPSIS

9       #include <sys/ddi.h>
10       #include <sys/sunddi.h>
11
12
13
14       int ddi_prop_exists(dev_t match_dev, dev_info_t *dip, uint_t flags,
15            char *name);
16
17

INTERFACE LEVEL

19       Solaris DDI specific (Solaris DDI).
20

PARAMETERS

22       match_dev     Device number associated with property or DDI_DEV_T_ANY.
23
24
25       dip           Pointer  to the device info node of device whose property
26                     list should be searched.
27
28
29       flags         Possible flag values are some combination of:
30
31                     DDI_PROP_DONTPASS     Do  not  pass  request  to   parent
32                                           device   information  node  if  the
33                                           property  is not found.
34
35
36                     DDI_PROP_NOTPROM      Do not  look  at   PROM  properties
37                                           (ignored  on  platforms that do not
38                                           support  PROM properties).
39
40
41
42       name          String containing the name of the property.
43
44

DESCRIPTION

46       ddi_prop_exists() checks for the existence of a property regardless  of
47       the property value data type.
48
49
50       Properties are searched for based on the dip, name, and  match_dev. The
51       property search order is as follows:
52
53           1.     Search software properties created by the driver.
54
55           2.     Search the software properties created  by  the  system  (or
56                  nexus nodes in the device info tree).
57
58           3.     Search the driver global properties list.
59
60           4.     If  DDI_PROP_NOTPROM  is not set, search the PROM properties
61                  (if they exist).
62
63           5.     If DDI_PROP_DONTPASS is not set, pass this  request  to  the
64                  parent device information node.
65
66           6.     Return 0 if not found and 1 if found.
67
68
69       Usually, the match_dev argument should be set to the actual device num‐
70       ber that this property is associated with.  However, if the   match_dev
71       argument  is  DDI_DEV_T_ANY,  then   ddi_prop_exists()  will  match the
72       request  regardless of the  match_dev the property  was  created  with.
73       That  is  the  first property whose name matches name will be returned.
74       If a property was created with  match_dev set to   DDI_DEV_T_NONE  then
75       the  only  way  to  look  up  this property is with a  match_dev set to
76       DDI_DEV_T_ANY. PROM properties are always created with match_dev set to
77       DDI_DEV_T_NONE.
78
79
80       name must always be set to the name of the property being looked up.
81

RETURN VALUES

83       ddi_prop_exists() returns  1 if the property exists and  0 otherwise.
84

CONTEXT

86       These functions can be called from user or kernel context.
87

EXAMPLES

89       Example 1 : Using ddi_prop_exists()
90
91
92       The following example demonstrates the use of  ddi_prop_exists().
93
94
95         /*
96              * Enable "whizzy" mode if the "whizzy-mode" property exists
97              */
98              if (ddi_prop_exists(xx_dev, xx_dip, DDI_PROP_NOTPROM,
99                      "whizzy-mode") == 1) {
100                    xx_enable_whizzy_mode(xx_dip);
101              } else {
102                    xx_disable_whizzy_mode(xx_dip);
103              }
104
105

SEE ALSO

107       ddi_prop_get_int(9F),     ddi_prop_lookup(9F),     ddi_prop_remove(9F),
108       ddi_prop_update(9F)
109
110
111       Writing Device Drivers
112
113
114
115SunOS 5.11                        22 May 1995              ddi_prop_exists(9F)
Impressum