MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Driver Entry Points                                   propop(9E)



NAME
     propop - report driver property information

SYNOPSIS
     #include 
     #include 
     #include 



     int prefixpropop(devt dev, devinfot *dip,
          ddipropopt propop, int flags, char *name, caddrt valuep,
          int *lengthp);


INTERFACE LEVEL
     Solaris DI specific (Solaris  DI).  This  entry  point  is
     required, but it can be ddipropop(9F).

ARGUMENTS
     dev         Device number associated with this device.


     dip         A pointer to the  device  information  structure
                 for this device.


     propop     Property operator. Valid operators are:

                 PROPLEN                  Get  property   length
                                           only.   (valuep  unaf-
                                           fected).


                 PROPLENANDVALBUF      Get length  and  value
                                           into  caller's buffer.
                                           (valuep    used     as
                                           input).


                 PROPLENANDVALALOC    Get length  and  value
                                           into allocated buffer.
                                           (valuep  returned   as
                                           pointer  to pointer to
                                           allocated buffer).



     flags       The only possible flag value is:

                 DIPROPDONTPAS    Do  not  pass  request   to
                                      parent   if   property  not



SunOS 5.11           Last change: 8 Jul 1996                    1






Driver Entry Points                                   propop(9E)



                                      found.



     name        Pointer to name of property to be interrogated.


     valuep      If   propop  is    PROPLENANDVALBUF,   this
                 should  be  a  pointer to the user's buffer.  If
                 propop is PROPLENANDVALALOC,  this  should
                 be the address of a pointer.


     lengthp     On exit,  *lengthp  will  contain  the  property
                 length.   If  propop  is   PROPLENANDVALBUF
                 then lengthp should point to an  int  that  con-
                 tains  the  length  of  caller's buffer,  before
                 calling propop().


DESCRIPTION
     propop() is an entry point which reports the values of cer-
     tain  properties of the driver or device to the system. Each
     driver must have a prefix  propop  entry  point,  but  most
     drivers  that do not need to create or manage their own pro-
     perties can use ddipropop() for this  entry  point.   Then
     the  driver can use ddipropupdate(9F) to create properties
     for its device.

RETURN VALUES
     propop() should return:

     DIPROPSUCES           Property found and returned.


     DIPROPNOTFOUND         Property not found.


     DIPROPUNDEFINED         Prop explicitly undefined.


     DIPROPNOMEMORY         Property  found,  but  unable  to
                                allocate  memory. lengthp has the
                                correct property length.


     DIPROPBUFTOSMAL     Property found, but the  supplied
                                buffer  is too small. lengthp has
                                the correct property length.






SunOS 5.11           Last change: 8 Jul 1996                    2






Driver Entry Points                                   propop(9E)



EXAMPLES
     Example 1 Using propop() to Report Property Information


     In the following example, propop() intercepts requests  for
     the  temperature property. The driver tracks changes to tem-
     perature using a variable in the state structure in order to
     avoid frequent calls to ddipropupdate(9F). The temperature
     property is only updated when a request  is  made  for  this
     property.   It  then uses the system routine ddipropop(9F)
     to process the property request.  If the property request is
     not  specific to a device, the driver does not intercept the
     request. This is indicated when the value of the  dev param-
     eter is equal to DIDEVTANY.


       int temperature;    /* current device temperature */
        .
        .
        .
       static int
       xxpropop(devt dev, devinfot *dip, ddipropopt propop,
            int flags, char *name, caddrt valuep, int *lengthp)
       {
                      int  instance;
                      struct xxstate *xsp;
            if (dev == DIDEVTANY)
                           goto skip;
            instance = getminor(dev);
            xsp = ddigetsoftstate(statep, instance);
            if (xsp == NUL)
                           return (DIPROPNOTFOUND);
            if (strcmp(name, "temperature") == 0) {
                           ddipropupdateint(dev, dip,\
                  "temperature", temperature);
            }
                        /* other cases... */
            skip:
            return (ddipropop(dev, dip, propop, flags,\
                    name, valuep, lengthp));
       }


SEE ALSO
     Intro(9E), ddipropop(9F), ddipropupdate(9F)


     Writing Device Drivers







SunOS 5.11           Last change: 8 Jul 1996                    3



OpenSolaris man pages main menu

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