Current File : //usr/man/man9s/cb_ops.9s
'\" te
.\" Copyright (c) 2009, Sun Microsystems, Inc., All Rights Reserved
.TH cb_ops 9S "24 Apr 2008" "SunOS 5.11" "Data Structures for Drivers"
.SH NAME
cb_ops \- character/block entry points structure
.SH SYNOPSIS
.LP
.nf
#include <sys/conf.h> 
#include <sys/ddi.h>
#include <sys/sunddi.h> 
.fi

.SH INTERFACE LEVEL
.sp
.LP
Solaris DDI specific (Solaris DDI)
.SH DESCRIPTION
.sp
.LP
The \fBcb_ops\fR 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 \fBcb_ops\fR structure.
.sp
.LP
All drivers that safely allow multiple threads of execution in the driver at the same time must set the \fBD_MP\fR flag in the \fBcb_flag\fR field. See \fBopen\fR(9E).
.sp
.LP
If the driver properly handles 64-bit offsets, it should also set the \fBD_64BIT\fR flag in the \fBcb_flag\fR field. This specifies that the driver will use the \fBuio_loffset\fR field of the \fBuio\fR(9S) structure.
.sp
.LP
If the driver returns \fBEINTR\fR from \fBopen\fR(9E), it should also set the \fBD_OPEN_RETURNS_EINTR\fR flag in the \fBcb_flag\fR field. This lets the framework know that it is safe for the driver to return \fBEINTR\fR when waiting, to provide exclusion for a last-reference \fBclose\fR(9E) call to complete before calling \fBopen\fR(9E).
.sp
.LP
The \fBmt-streams\fR(9F) function describes other flags that can be set in the \fBcb_flag\fR field.
.sp
.LP
The \fBcb_rev\fR is the \fBcb_ops\fR structure revision number. This field must be set to \fBCB_REV\fR.
.sp
.LP
Non-\fBSTREAMS\fR drivers should set \fBcb_str\fR to \fINULL\fR.
.sp
.LP
The following \fBDDI\fR/\fBDKI\fR or \fBDKI\fR-only or \fBDDI\fR-only functions are provided in the character/block driver operations structure.
.sp

.sp
.TS
tab();
cw(1.17i) cw(1.36i) cw(1.25i) cw(1.72i) 
lw(1.17i) lw(1.36i) lw(1.25i) lw(1.72i) 
.
block/charFunctionDescription
_
b/cXXopen\fBDDI\fR/\fBDKI\fR
b/cXXclose\fBDDI\fR/\fBDKI\fR
bXXstrategyDDI/DKI
bXXprintDDI/DKI
bXXdumpDDI(Sun)
cXXreadDDI/DKI
cXXwriteDDI/DKI
cXXioctlDDI/DKI
cXXdevmapDDI(Sun)
cXXmmapDKI
cXXsegmapDKI
cXXchpollDDI/DKI
cXXprop_opDDI(Sun)
cXXareadDDI(Sun)
cXXawriteDDI(Sun)
.TE

.SH STRUCTURE MEMBERS
.sp
.in +2
.nf
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);
.fi
.in -2

.SH SEE ALSO
.sp
.LP
\fBaread\fR(9E), \fBawrite\fR(9E), \fBchpoll\fR(9E), \fBclose\fR(9E), \fBdump\fR(9E), \fBioctl\fR(9E), \fBmmap\fR(9E), \fBopen\fR(9E), \fBprint\fR(9E), \fBprop_op\fR(9E), \fBread\fR(9E), \fBsegmap\fR(9E), \fBstrategy\fR(9E), \fBwrite\fR(9E), \fBnochpoll\fR(9F), \fBnodev\fR(9F), \fBnulldev\fR(9F), \fBdev_ops\fR(9S), \fBqinit\fR(9S)
.sp
.LP
\fIWriting Device Drivers for Oracle Solaris 11.2\fR
.sp
.LP
\fISTREAMS Programming Guide\fR