Data Structures for Drivers cbops(9S)
NAME
cbops - character/block entry points structure
SYNOPSIS
#include
#include
#include
INTERFACE LEVEL
Solaris DI specific (Solaris DI)
DESCRIPTION
The cbops 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 cbops structure.
All drivers that safely allow multiple threads of execution
in the driver at the same time must set the DMP flag in the
cbflag field. See open(9E).
If the driver properly handles 64-bit offsets, it should
also set the D64BIT flag in the cbflag field. This speci-
fies that the driver will use the uioloffset field of the
uio(9S) structure.
If the driver returns EINTR from open(9E), it should also
set the DOPENRETURNSEINTR flag in the cbflag 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 cbflag field.
The cbrev is the cbops structure revision number. This
field must be set to CBREV.
Non-STREAMS drivers should set cbstr to NUL.
The following DI/DKI or DKI-only or DI-only functions are
provided in the character/block driver operations structure.
SunOS 5.11 Last change: 24 Apr 2008 1
Data Structures for Drivers cbops(9S)
block/char Function Description
b/c Xopen DI/DKI
b/c Xclose DI/DKI
b Xstrategy DI/DKI
b Xprint DI/DKI
b Xdump DI(Sun)
c Xread DI/DKI
c Xwrite DI/DKI
c Xioctl DI/DKI
c Xdevmap DI(Sun)
c Xmmap DKI
c Xsegmap DKI
c Xchpoll DI/DKI
c Xpropop DI(Sun)
c Xaread DI(Sun)
c Xawrite DI(Sun)
STRUCTURE MEMBERS
int (*cbopen)(devt *devp, int flag, int otyp, credt *credp);
int (*cbclose)(devt dev, int flag, int otyp, credt *credp);
int (*cbstrategy)(struct buf *bp);int(*cbprint)(devt dev, char *str);
int (*cbdump)(devt dev, caddrt addr, daddrt blkno, int nblk);
int (*cbread)(devt dev, struct uio *uiop, credt *credp);
int (*cbwrite)(devt dev, struct uio *uiop, credt *credp);
int (*cbioctl)(devt dev, int cmd, intptrt arg, int mode,
credt *credp, int *rvalp);
int (*cbdevmap)(devt dev, devmapcookiet dhp, offsett off,
sizet len, sizet *maplen, uintt model);
int (*cbmmap)(devt dev, offt off, int prot);
int (*cbsegmap)(devt dev, offt off, struct as *asp,
caddrt *addrp, offt len, unsigned int prot,
unsigned int maxprot, unsigned int flags, credt *credp);
int (*cbchpoll)(devt dev, short events, int anyyet,
short *reventsp, struct pollhead **phpp);
int (*cbpropop)(devt dev, devinfot *dip,
ddipropopt propop, int modflags,
char *name, caddrt valuep, int *length);
struct streamtab *cbstr; /* streams information */
int cbflag;
int cbrev;
int (*cbaread)(devt dev, struct aioreq *aio, credt *credp);
int (*cbawrite)(devt dev, struct aioreq *aio, credt *credp);
SEE ALSO
aread(9E), awrite(9E), chpoll(9E), close(9E), dump(9E),
ioctl(9E), mmap(9E), open(9E), print(9E), propop(9E),
read(9E), segmap(9E), strategy(9E), write(9E), nochpoll(9F),
nodev(9F), nulldev(9F), devops(9S), qinit(9S)
SunOS 5.11 Last change: 24 Apr 2008 2
Data Structures for Drivers cbops(9S)
Writing Device Drivers
STREAMS Programming Guide
SunOS 5.11 Last change: 24 Apr 2008 3
|