Kernel Functions for Drivers ddipropcreate(9F)
NAME
ddipropcreate, ddipropmodify, ddipropremove,
ddipropremoveall, ddipropundefine - create, remove, or
modify properties for leaf device drivers
SYNOPSIS
#include
#include
#include
int ddipropcreate(devt dev, devinfot *dip, int flags,
char *name, caddrt valuep, int length);
int ddipropundefine(devt dev, devinfot *dip, int flags,
char *name);
int ddipropmodify(devt dev, devinfot *dip, int flags,
char *name, caddrt valuep, int length);
int ddipropremove(devt dev, devinfot *dip, char *name);
void ddipropremoveall(devinfot *dip);
INTERFACE LEVEL
Solaris DI specific (Solaris DI). The ddipropcreate()
and ddipropmodify() functions are obsolete. Use
ddipropupdate(9F) instead of these functions.
PARAMETERS
ddipropcreate()
dev devt of the device.
dip devinfot pointer of the device.
flags flag modifiers. The only possible flag value is
DIPROPCANSLEP: Memory allocation may sleep.
name name of property.
valuep pointer to property value.
SunOS 5.11 Last change: 16 Jan 2006 1
Kernel Functions for Drivers ddipropcreate(9F)
length property length.
ddipropundefine()
dev devt of the device.
dip devinfot pointer of the device.
flags flag modifiers. The only possible flag value is
DIPROPCANSLEP: Memory allocation may sleep.
name name of property.
ddipropmodify()
dev devt of the device.
dip devinfot pointer of the device.
flags flag modifiers. The only possible flag value is
DIPROPCANSLEP: Memory allocation may sleep.
name name of property.
valuep pointer to property value.
length property length.
ddipropremove()
dev devt of the device.
dip devinfot pointer of the device.
name name of property.
SunOS 5.11 Last change: 16 Jan 2006 2
Kernel Functions for Drivers ddipropcreate(9F)
ddipropremoveall()
dip devinfot pointer of the device.
DESCRIPTION
Device drivers have the ability to create and manage their
own properties as well as gain access to properties that the
system creates on behalf of the driver. A driver uses
ddigetproplen(9F) to query whether or not a specific pro-
perty exists.
Property creation is done by creating a new property defini-
tion in the driver's property list associated with dip.
Property definitions are stacked; they are added to the
beginning of the driver's property list when created. Thus,
when searched for, the most recent matching property defini-
tion will be found and its value will be return to the
caller.
The individual functions are described as follows:
ddipropcreate() ddipropcreate() adds a property
to the device's property list. If
the property is not associated with
any particular dev but is associ-
ated with the physical device
itself, then the argument dev
should be the special device
DIDEVTNONE. If you do not have
a dev for your device (for example
during attach(9E) time), you can
create one using makedevice(9F)
with a major number of
DIMAJORTUNKNOWN.
ddipropcreate() will then make
the correct dev for your device.
For boolean properties, you must
set length to 0. For all other pro-
perties, the length argument must
be set to the number of bytes used
by the data structure representing
the property being created.
Note that creating a property
involves allocating memory for the
property list, the property name
SunOS 5.11 Last change: 16 Jan 2006 3
Kernel Functions for Drivers ddipropcreate(9F)
and the property value. If flags
does not contain DIPROPCANSLEP,
ddipropcreate() returns
DIPROPNOMEMORY on memory allo-
cation failure or DIPROPSUCES
if the allocation succeeded. If
DIPROPCANSLEP was set, the
caller may sleep until memory
becomes available.
ddipropundefine() ddipropundefine() is a special
case of property creation where the
value of the property is set to
undefined. This property has the
effect of terminating a property
search at the current devinfo node,
rather than allowing the search to
proceed up to ancestor devinfo
nodes. However, ddipropundefine()
will not terminate a search when
the ddipropgetint(9F) or
ddiproplookup(9F) routines are
used for lookup of 64-bit property
value. See ddipropop(9F).
Note that undefining properties
does involve memory allocation, and
therefore, is subject to the same
memory allocation constraints as
ddipropcreate().
ddipropmodify() ddipropmodify() modifies the
length and the value of a property.
If ddipropmodify() finds the pro-
perty in the driver's property
list, allocates memory for the pro-
perty value and returns
DIPROPSUCES. If the property
was not found, the function returns
DIPROPNOTFOUND.
Note that modifying properties does
involve memory allocation, and
therefore, is subject to the same
memory allocation constraints as
ddipropcreate().
ddipropremove() ddipropremove() unlinks a pro-
perty from the device's property
SunOS 5.11 Last change: 16 Jan 2006 4
Kernel Functions for Drivers ddipropcreate(9F)
list. If ddipropremove() finds
the property (an exact match of
both nameand dev), it unlinks the
property, frees its memory, and
returns DIPROPSUCES, other-
wise, it returns
DIPROPNOTFOUND.
ddipropremoveall() ddipropremoveall() removes the
properties of all the devt's asso-
ciated with the dip. It is called
before unloading a driver.
RETURN VALUES
The ddipropcreate() function returns the following values:
DIPROPSUCES On success.
DIPROPNOMEMORY On memory allocation failure.
DIPROPINVALARG If an attempt is made to create a pro-
perty with dev equal to DIDEVTANY
or if name is NUL or name is the NUL
string.
The ddiprop undefine() function returns the following
values:
DIPROPSUCES On success.
DIPROPNOMEMORY On memory allocation failure.
DIPROPINVALARG If an attempt is made to create a pro-
perty with dev DIDEVTANY or if
name is NUL or name is the NUL
string.
The ddipropmodify() function returns the following values:
DIPROPSUCES On success.
SunOS 5.11 Last change: 16 Jan 2006 5
Kernel Functions for Drivers ddipropcreate(9F)
DIPROPNOMEMORY On memory allocation failure.
DIPROPINVALARG If an attempt is made to create a pro-
perty with dev equal to DIDEVTANY
or if name is NUL or name is the NUL
string.
DIPROPNOTFOUND On property search failure.
The ddipropremove() function returns the following values:
DIPROPSUCES On success.
DIPROPINVALARG If an attempt is made to create a pro-
perty with dev equal to DIDEVTANY
or if name is NUL or name is the NUL
string.
DIPROPNOTFOUND On property search failure.
CONTEXT
If DIPROPCANSLEP is set, these functions can cannot be
called from interrupt context. Otherwise, they can be called
from user, interrupt, or kernel context.
EXAMPLES
Example 1 Creating a Property
The following example creates a property called nblocks for
each partition on a disk.
int propval = 8192;
for (minor = 0; minor < 8; minor ]) {
(void) ddipropcreate(makedevice(DIMAJORTUNKNOWN, minor),
dev, DIPROPCANSLEP, "nblocks", (caddrt) &propval,
sizeof (int));
...
}
ATRIBUTES
SunOS 5.11 Last change: 16 Jan 2006 6
Kernel Functions for Drivers ddipropcreate(9F)
See attributes(5) for a description of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Stability Level ddipropcreate() and
ddipropmodify() are
Obsolete
SEE ALSO
driver.conf(4), attributes(5), attach(9E),
ddigetproplen(9F), ddipropop(9F), ddipropupdate(9F),
makedevice(9F)
Writing Device Drivers
SunOS 5.11 Last change: 16 Jan 2006 7
|