JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Driver Entry Points     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

Introduction

Driver Entry Points

aread(9E)

attach(9E)

audio_engine_channels(9E)

audio_engine_chinfo(9E)

audio_engine_close(9E)

audio_engine_count(9E)

audio_engine_format(9E)

audio_engine_open(9E)

audio_engine_playahead(9E)

audio_engine_qlen(9E)

audio_engine_rate(9E)

audio_engine_start(9E)

audio_engine_stop(9E)

audio_engine_sync(9E)

awrite(9E)

chpoll(9E)

close(9E)

csx_event_handler(9E)

detach(9E)

devmap(9E)

devmap_access(9E)

devmap_contextmgt(9E)

devmap_dup(9E)

devmap_map(9E)

devmap_unmap(9E)

dump(9E)

_fini(9E)

getinfo(9E)

gld(9E)

gldm_get_stats(9E)

gldm_intr(9E)

gldm_ioctl(9E)

gldm_reset(9E)

gldm_send(9E)

gldm_set_mac_addr(9E)

gldm_set_multicast(9E)

gldm_set_promiscuous(9E)

gldm_start(9E)

gldm_stop(9E)

identify(9E)

_info(9E)

_init(9E)

ioctl(9E)

ks_snapshot(9E)

ks_update(9E)

mac(9E)

mc_getcapab(9E)

mc_getprop(9E)

mc_getstat(9E)

mc_ioctl(9E)

mc_multicst(9E)

mc_propinfo(9E)

mc_setpromisc(9E)

mc_setprop(9E)

mc_start(9E)

mc_stop(9E)

mc_tx(9E)

mc_unicst(9E)

mmap(9E)

open(9E)

power(9E)

print(9E)

probe(9E)

prop_op(9E)

put(9E)

quiesce(9E)

read(9E)

segmap(9E)

srv(9E)

strategy(9E)

tran_abort(9E)

tran_bus_reset(9E)

tran_destroy_pkt(9E)

tran_dmafree(9E)

tran_getcap(9E)

tran_init_pkt(9E)

tran_pkt_constructor(9E)

tran_pkt_destructor(9E)

tran_quiesce(9E)

tran_reset(9E)

tran_reset_notify(9E)

tran_setcap(9E)

tran_setup_pkt(9E)

tran_start(9E)

tran_sync_pkt(9E)

tran_teardown_pkt(9E)

tran_tgt_free(9E)

tran_tgt_init(9E)

tran_tgt_probe(9E)

tran_unquiesce(9E)

write(9E)

prop_op

- report driver property information

Synopsis

#include <sys/types.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>



int prefixprop_op(dev_t dev, dev_info_t *dip, 
     ddi_prop_op_t prop_op, int flags, char *name, caddr_t valuep, 
     int *lengthp);

Interface Level

Solaris DDI specific (Solaris DDI). This entry point is required, but it can be ddi_prop_op(9F).

ARGUMENTS

dev

Device number associated with this device.

dip

A pointer to the device information structure for this device.

prop_op

Property operator. Valid operators are:

PROP_LEN

Get property length only. (valuep unaffected).

PROP_LEN_AND_VAL_BUF

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

PROP_LEN_AND_VAL_ALLOC

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

flags

The only possible flag value is:

DDI_PROP_DONTPASS

Do not pass request to parent if property not found.

name

Pointer to name of property to be interrogated.

valuep

If prop_op is PROP_LEN_AND_VAL_BUF, this should be a pointer to the user's buffer. If prop_op is PROP_LEN_AND_VAL_ALLOC, this should be the address of a pointer.

lengthp

On exit, *lengthp will contain the property length. If prop_op is PROP_LEN_AND_VAL_BUF then lengthp should point to an int that contains the length of caller's buffer, before calling prop_op().

Description

prop_op() is an entry point which reports the values of certain properties of the driver or device to the system. Each driver must have a prefix prop_op entry point, but most drivers that do not need to create or manage their own properties can use ddi_prop_op() for this entry point. Then the driver can use ddi_prop_update(9F) to create properties for its device.

Return Values

prop_op() should return:

DDI_PROP_SUCCESS

Property found and returned.

DDI_PROP_NOT_FOUND

Property not found.

DDI_PROP_UNDEFINED

Prop explicitly undefined.

DDI_PROP_NO_MEMORY

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

DDI_PROP_BUF_TOO_SMALL

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

Examples

Example 1 Using prop_op() to Report Property Information

In the following example, prop_op() intercepts requests for the temperature property. The driver tracks changes to temperature using a variable in the state structure in order to avoid frequent calls to ddi_prop_update(9F). The temperature property is only updated when a request is made for this property. It then uses the system routine ddi_prop_op(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 parameter is equal to DDI_DEV_T_ANY.

int temperature;    /* current device temperature */
 .
 .
 .
static int
xxprop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op,
     int flags, char *name, caddr_t valuep, int *lengthp)
{
            int  instance;
            struct xxstate *xsp;
     if (dev == DDI_DEV_T_ANY)
                goto skip;
     instance = getminor(dev);
     xsp = ddi_get_soft_state(statep, instance);
     if (xsp == NULL)
                return (DDI_PROP_NOT_FOUND);
     if (strcmp(name, "temperature") == 0) {
                ddi_prop_update_int(dev, dip,\
           "temperature", temperature);
     }
               /*    other cases...    */
     skip:
     return (ddi_prop_op(dev, dip, prop_op, flags,\ 
             name, valuep, lengthp));
}

See Also

Intro(9E), ddi_prop_op(9F), ddi_prop_update(9F)

Writing Device Drivers