JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Properties and Data Structures     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Data Structures for Drivers

aio_req(9S)

audio_engine_ops(9S)

blksize(9P)

buf(9S)

cb_ops(9S)

copyreq(9S)

copyresp(9S)

datab(9S)

dblk(9S)

ddi_device_acc_attr(9S)

ddi_dma_attr(9S)

ddi_dma_cookie(9S)

ddi_dmae_req(9S)

ddi_dma_lim(9S)

ddi_dma_lim_sparc(9S)

ddi_dma_lim_x86(9S)

ddi_dma_req(9S)

ddi_fm_error(9S)

ddi-forceattach(9P)

ddi_idevice_cookie(9S)

ddi-no-autodetach(9P)

ddi-no-modunload(9P)

device-blksize(9P)

device-nblocks(9P)

device-pblksize(9P)

devmap_callback_ctl(9S)

dev_ops(9S)

fmodsw(9S)

free_rtn(9S)

gld_mac_info(9S)

gld_stats(9S)

hook_nic_event(9S)

hook_pkt_event(9S)

hook_t(9S)

inquiry-device-type(9P)

inquiry-product-id(9P)

inquiry-revision-id(9P)

inquiry-serial-no(9P)

inquiry-vendor-id(9P)

iocblk(9S)

iovec(9S)

kstat(9S)

kstat_intr(9S)

kstat_io(9S)

kstat_named(9S)

linkblk(9S)

lso_basic_tcp_ipv4(9S)

mac_callbacks(9S)

mac_capab_lso(9S)

mac_capab_rings(9S)

mac_group_info(9S)

mac_register(9S)

mac_ring_info(9S)

mblk(9S)

modldrv(9S)

modlinkage(9S)

modlmisc(9S)

modlstrmod(9S)

module_info(9S)

msgb(9S)

Nblock(9P)

net_inject_t(9S)

net_instance_t(9S)

no-involuntary-power-cycles(9P)

pblksize(9P)

pm(9P)

pm-components(9P)

qband(9S)

qinit(9S)

queclass(9S)

queue(9S)

removable-media(9P)

scsi_address(9S)

scsi_arq_status(9S)

scsi_asc_key_strings(9S)

scsi_device(9S)

scsi_extended_sense(9S)

scsi_hba_tran(9S)

scsi_inquiry(9S)

scsi_pkt(9S)

scsi_status(9S)

size(9P)

sof_ops(9S)

streamtab(9S)

stroptions(9S)

tuple(9S)

uio(9S)

usb_bulk_request(9S)

usb_callback_flags(9S)

usb_cfg_descr(9S)

usb_client_dev_data(9S)

usb_completion_reason(9S)

usb_ctrl_request(9S)

usb_dev_descr(9S)

usb_dev_qlf_descr(9S)

usb_ep_descr(9S)

usb_if_descr(9S)

usb_intr_request(9S)

usb_isoc_request(9S)

usb_other_speed_cfg_descr(9S)

usb_request_attributes(9S)

usb_string_descr(9S)

cb_ops

- character/block entry points structure

Synopsis

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

Interface Level

Solaris DDI specific (Solaris DDI)

Description

The cb_ops structure contains all entry points for drivers that support both character and block entry points. All leaf device drivers that support direct user process access to a device should declare a cb_ops structure.

All drivers that safely allow multiple threads of execution in the driver at the same time must set the D_MP flag in the cb_flag field. See open(9E).

If the driver properly handles 64-bit offsets, it should also set the D_64BIT flag in the cb_flag field. This specifies that the driver will use the uio_loffset field of the uio(9S) structure.

If the driver returns EINTR from open(9E), it should also set the D_OPEN_RETURNS_EINTR flag in the cb_flag field. This lets the framework know that it is safe for the driver to return EINTR when waiting, to provide exclusion for a last-reference close(9E) call to complete before calling open(9E).

The mt-streams(9F) function describes other flags that can be set in the cb_flag field.

The cb_rev is the cb_ops structure revision number. This field must be set to CB_REV.

Non-STREAMS drivers should set cb_str to NULL.

The following DDI/DKI or DKI-only or DDI-only functions are provided in the character/block driver operations structure.

block/char
Function
Description
b/c
XXopen
DDI/DKI
b/c
XXclose
DDI/DKI
b
XXstrategy
DDI/DKI
b
XXprint
DDI/DKI
b
XXdump
DDI(Sun)
c
XXread
DDI/DKI
c
XXwrite
DDI/DKI
c
XXioctl
DDI/DKI
c
XXdevmap
DDI(Sun)
c
XXmmap
DKI
c
XXsegmap
DKI
c
XXchpoll
DDI/DKI
c
XXprop_op
DDI(Sun)
c
XXaread
DDI(Sun)
c
XXawrite
DDI(Sun)

Structure Members

int  (*cb_open)(dev_t *devp, int flag, int otyp, cred_t *credp);
int  (*cb_close)(dev_t dev, int flag, int otyp, cred_t *credp);
int  (*cb_strategy)(struct buf *bp);
int  (*cb_print)(dev_t dev, char *str);
int  (*cb_dump)(dev_t dev, caddr_t addr, daddr_t blkno, int nblk);
int  (*cb_read)(dev_t dev, struct uio *uiop, cred_t *credp);
int  (*cb_write)(dev_t dev, struct uio *uiop, cred_t *credp);
int  (*cb_ioctl)(dev_t dev, int cmd, intptr_t arg, int mode,      
        cred_t *credp, int *rvalp);
int  (*cb_devmap)(dev_t dev, devmap_cookie_t dhp, offset_t off,    
        size_t len, size_t *maplen, uint_t model);
int  (*cb_mmap)(dev_t dev, off_t off, int prot);
int  (*cb_segmap)(dev_t dev, off_t off, struct as *asp,     
        caddr_t *addrp, off_t len, unsigned int prot,     
        unsigned int maxprot, unsigned int flags, cred_t *credp);
int  (*cb_chpoll)(dev_t dev, short events, int anyyet,     
        short *reventsp, struct pollhead **phpp);
int  (*cb_prop_op)(dev_t dev, dev_info_t *dip,     
        ddi_prop_op_t prop_op, int mod_flags,     
        char *name, caddr_t valuep, int *length);
struct streamtab *cb_str;   /* streams information */
int  cb_flag;
int  cb_rev;
int  (*cb_aread)(dev_t dev, struct aio_req *aio, cred_t *credp);
int  (*cb_awrite)(dev_t dev, struct aio_req *aio, cred_t *credp);

See Also

aread(9E), awrite(9E), chpoll(9E), close(9E), dump(9E), ioctl(9E), mmap(9E), open(9E), print(9E), prop_op(9E), read(9E), segmap(9E), strategy(9E), write(9E), nochpoll(9F), nodev(9F), nulldev(9F), dev_ops(9S), qinit(9S)

Writing Device Drivers

STREAMS Programming Guide