Kernel Functions for Drivers ddipropexists(9F)
NAME
ddipropexists - check for the existence of a property
SYNOPSIS
#include
#include
int ddipropexists(devt matchdev, devinfot *dip, uintt flags,
char *name);
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
PARAMETERS
matchdev Device number associated with property or
DIDEVTANY.
dip Pointer to the device info node of device
whose property list should be searched.
flags Possible flag values are some combination of:
DIPROPDONTPAS Do not pass request to
parent device informa-
tion node if the pro-
perty is not found.
DIPROPNOTPROM Do not look at PROM
properties (ignored on
platforms that do not
support PROM proper-
ties).
name String containing the name of the property.
DESCRIPTION
ddipropexists() checks for the existence of a property
regardless of the property value data type.
Properties are searched for based on the dip, name, and
matchdev. The property search order is as follows:
SunOS 5.11 Last change: 22 May 1995 1
Kernel Functions for Drivers ddipropexists(9F)
1. Search software properties created by the driver.
2. Search the software properties created by the sys-
tem (or nexus nodes in the device info tree).
3. Search the driver global properties list.
4. If DIPROPNOTPROM is not set, search the PROM
properties (if they exist).
5. If DIPROPDONTPAS is not set, pass this request
to the parent device information node.
6. Return 0 if not found and 1 if found.
Usually, the matchdev argument should be set to the actual
device number that this property is associated with. How-
ever, if the matchdev argument is DIDEVTANY, then
ddipropexists() will match the request regardless of the
matchdev the property was created with. That is the first
property whose name matches name will be returned. If a
property was created with matchdev set to DIDEVTNONE
then the only way to look up this property is with a
matchdev set to DIDEVTANY. PROM properties are always
created with matchdev set to DIDEVTNONE.
name must always be set to the name of the property being
looked up.
RETURN VALUES
ddipropexists() returns 1 if the property exists and 0
otherwise.
CONTEXT
These functions can be called from user or kernel context.
EXAMPLES
Example 1 : Using ddipropexists()
The following example demonstrates the use of
ddipropexists().
/*
* Enable "whizzy" mode if the "whizzy-mode" property exists
*/
if (ddipropexists(xxdev, xxdip, DIPROPNOTPROM,
"whizzy-mode") == 1) {
xxenablewhizzymode(xxdip);
SunOS 5.11 Last change: 22 May 1995 2
Kernel Functions for Drivers ddipropexists(9F)
} else {
xxdisablewhizzymode(xxdip);
}
SEE ALSO
ddipropgetint(9F), ddiproplookup(9F),
ddipropremove(9F), ddipropupdate(9F)
Writing Device Drivers
SunOS 5.11 Last change: 22 May 1995 3
|