MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers                  ddipropupdate(9F)



NAME
     ddipropupdate,                  ddipropupdateintarray,
     ddipropupdateint,           ddipropupdatestringarray,
     ddipropupdateint64,          ddipropupdateint64array,
     ddipropupdatestring,  ddipropupdatebytearray - update
     properties

SYNOPSIS
     #include 
     #include 



     int ddipropupdateintarray(devt dev, devinfot *dip,
          char *name, int *data, uintt nelements);


     int ddipropupdateint(devt dev, devinfot *dip, char *name,
          int data);


     int ddipropupdateint64array(devt dev, devinfot *dip, char *name,
          int64t *data, uintt nelements);


     int ddipropupdateint64(devt dev, devinfot *dip, char *name,
          int64t data);


     int ddipropupdatestringarray(devt dev, devinfot *dip, char *name,
          char **data, uintt nelements);


     int ddipropupdatestring(devt dev, devinfot *dip, char *name,
          char *data);


     int ddipropupdatebytearray(devt dev, devinfot *dip, char *name,
          uchart *data, uintt nelements);


PARAMETERS
     dev           Device number associated with the device.


     dip           Pointer to the  device  info  node  of  device
                   whose property list should be updated.


     name          String containing the name of the property  to
                   be updated.




SunOS 5.11          Last change: 28 Aug 2001                    1






Kernel Functions for Drivers                  ddipropupdate(9F)



     nelements     The number of elements contained in the memory
                   pointed at by data.



     ddipropupdateintarray()

     data     A pointer an integer array with which to update the
              property.



     ddipropupdateint()

     data     An integer value with which to update the property.



     ddipropupdateint64array()

     data     An pointer to a 64-bit integer array with which  to
              update the property.



     ddipropupdateint64()

     data     A 64-bit integer value with  which  to  update  the
              property.



     ddipropupdatestringarray()

     data     A pointer to a string array with  which  to  update
              the  property. The array of strings is formatted as
              an array of pointers to  NUL  terminated  strings,
              much like the argv argument to execve(2).



     ddipropupdatestring()

     data     A pointer to a string value with  which  to  update
              the property.



     ddipropupdatebytearray()

     data     A pointer to a byte array with which to update  the
              property.



SunOS 5.11          Last change: 28 Aug 2001                    2






Kernel Functions for Drivers                  ddipropupdate(9F)



INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

DESCRIPTION
     The property update  routines  search  for  and,  if  found,
     modify  the  value  of  a  given  property.  Properties  are
     searched for based on the dip, name, dev, and  the  type  of
     the  data  (integer,  string,  or byte). The driver software
     properties list is searched. If the property is found, it is
     updated  with  the  supplied  value.  If the property is not
     found on this list, a new property is created with the value
     supplied.  For  example,  if a driver attempts to update the
     "foo" property, a property named "foo" is  searched  for  on
     the  driver's software property list. If "foo" is found, the
     value is updated. If "foo" is  not  found,  a  new  property
     named  "foo"  is  created  on the driver's software property
     list with the supplied value even if a "foo" property exists
     on another property list (such as a PROM property list).


     Every property value has a data  type  associated  with  it:
     byte, integer, or string. A property should be updated using
     a function with the same corresponding data type as the pro-
     perty  value.  For  example,  an  integer  property  must be
     updated   using   either   ddipropupdateintarray()    or
     ddipropupdateint().  For  a  64-bit integer, you must use
     ddipropupdateint64array()  or   ddipropupdateint64().
     Attempts  to update a property with a function that does not
     correspond to the property data type that was used to create
     it results in an undefined state.


     Usually, the dev argument should be set to the actual device
     number  that  this  property is associated with. If the pro-
     perty is not associated with any particular  dev,  then  the
     argument  dev should be set to DIDEVTNONE. This property
     will then match a look up request (see  ddiproplookup(9F))
     with  the matchdev argument set to DIDEVTANY. If no dev
     is available for the device (for example  during  attach(9E)
     time),  one can be created using makedevice(9F) with a major
     number of DIMAJORTUNKNOWN. The update routines will then
     generate  the correct dev when creating or updating the pro-
     perty.


     name must always be set to the name of  the  property  being
     updated.


     For      the      routines      ddipropupdateintarray(),
     ddiproplookupint64array(),
     ddipropupdatestringarray(),    ddipropupdatestring(),



SunOS 5.11          Last change: 28 Aug 2001                    3






Kernel Functions for Drivers                  ddipropupdate(9F)



     and  ddipropupdatebytearray(),  data  is a pointer which
     points to memory containing the value of  the  property.  In
     each  case  *data  points  to  a  different type of property
     value. See the individual descriptions of the routines below
     for details concerning the different values. nelements is an
     unsigned integer  which  contains  the  number  of  integer,
     string, or byte elements accounted for in the memory pointed
     at by *data.


     For     the     routines      ddipropupdateint()      and
     ddipropupdateint64(),  data  is the new value of the pro-
     perty.


     ddipropupdateintarray()


     Updates or creates an array of integer property  values.  An
     array  of integers is defined to be nelements of 4 byte long
     integer elements. data must be a pointer to an integer array
     with which to update the property.


     ddipropupdateint()


     Update or creates a single integer value of a property. data
     must be an integer value with which to update the property.


     ddipropupdateint64array()


     Updates or creates  an  array  of  64-bit  integer  property
     values.  An  array of integers is defined to be nelements of
     int64t integer elements. data must be a pointer to a 64-bit
     integer array with which to update the property.


     ddipropupdateint64()


     Updates or creates a single 64-bit integer value of  a  pro-
     perty.  data  must  be an int64t value with which to update
     the property.


     ddipropupdatestringarray()






SunOS 5.11          Last change: 28 Aug 2001                    4






Kernel Functions for Drivers                  ddipropupdate(9F)



     Updates or creates a property that is an array  of  strings.
     data  must  be  a  pointer  to  a string array with which to
     update the property. The array of strings is formatted as an
     array  of  pointers to NULterminated strings, much like the
     argv argument to execve(2).


     ddipropupdatestring()


     Updates or creates a property that is a single string value.
     data  must be a pointer to a string with which to update the
     property.


     ddipropupdatebytearray()


     Updates or creates a property that is  an  array  of  bytes.
     data  should  be  a  pointer  to  a byte array with which to
     update the property.


     The property update routines may block  to  allocate  memory
     needed to hold the value of the property.

RETURN VALUES
     All of the property update routines return:

     DIPROPSUCES           On success.


     DIPROPINVALARG         If an attempt is made to update a
                                property with name set to NUL or
                                name set to the null string.


     DIPROPCANOTENCODE     If the bytes of the property can-
                                not be encoded.


CONTEXT
     These functions can only be called from user or kernel  con-
     text.

EXAMPLES
     Example 1 Updating Properties


     The   following   example   demonstrates    the    use    of
     ddipropupdateintarray().




SunOS 5.11          Last change: 28 Aug 2001                    5






Kernel Functions for Drivers                  ddipropupdate(9F)



       int  options[4];

            /*
             * Create the "options" integer array with
             * our default values for these parameters
             */
            options[0] = XOPTIONS0;
            options[1] = XOPTIONS1;
            options[2] = XOPTIONS2;
            options[3] = XOPTIONS3;
            i = ddipropupdateintarray(xxdev, xxdip, "options",
                 &options, sizeof (options) / sizeof (int));


SEE ALSO
     execve(2),         attach(9E),          ddiproplookup(9F),
     ddipropremove(9F), makedevice(9F)


     Writing Device Drivers



































SunOS 5.11          Last change: 28 Aug 2001                    6



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™