#include <sys/conf.h> #include <sys/ddi.h> #include <sys/sunddi.h>
int ddi_prop_create(dev_t dev, dev_info_t *dip, int flags, char *name, caddr_t valuep, int length);
int ddi_prop_undefine(dev_t dev, dev_info_t *dip, int flags, char *name);
int ddi_prop_modify(dev_t dev, dev_info_t *dip, int flags, char *name, caddr_t valuep, int length);
int ddi_prop_remove(dev_t dev, dev_info_t *dip, char *name);
void ddi_prop_remove_all(dev_info_t *dip);
Solaris DDI specific (Solaris DDI).
DDI_PROP_CANSLEEP: Memory allocation may sleep.
DDI_PROP_CANSLEEP: Memory allocation may sleep.
DDI_PROP_CANSLEEP: Memory allocation may sleep.
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 ddi_getproplen(9F) to query whether or not a specific property exists.
Property creation is done by creating a new property definition 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 definition will be found and its value will be return to the caller.
ddi_prop_create() adds a property to the device’s property list. If the property is not associated with any particular dev but is associated with the physical device itself, then the argument dev should be the special device DDI_DEV_T_NONE. 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 DDI_MAJOR_T_UNKNOWN . ddi_prop_create() will then make the correct dev for your device.
For boolean properties, you must set length to 0. For all other properties, 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 and the property value. If flags does not contain DDI_PROP_CANSLEEP, ddi_prop_create() returns DDI_PROP_NO_MEMORY on memory allocation failure or DDI_SUCCESS if the allocation succeeded. If DDI_PROP_CANSLEEP was set, the caller may sleep until memory becomes available.
Note that undefining properties does involve memory allocation, and therefore, is subject to the same memory allocation constraints as ddi_prop_create().
Note that modifying properties does involve memory allocation, and therefore, is subject to the same memory allocation constraints as ddi_prop_create().
If DDI_PROP_CANSLEEP
is set, these functions can only be called from user context; otherwise,
they can be called from interrupt or user context.
Create a property called nblocks for each partition on a disk.