2 .\" Copyright (c) 2009, Sun Microsystems, Inc., All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH CB_OPS 9S "Apr 24, 2008"
8 cb_ops \- character/block entry points structure
14 #include <sys/sunddi.h>
20 Solaris DDI specific (Solaris DDI)
24 The \fBcb_ops\fR structure contains all entry points for drivers that support
25 both character and block entry points. All leaf device drivers that support
26 direct user process access to a device should declare a \fBcb_ops\fR structure.
29 All drivers that safely allow multiple threads of execution in the driver at
30 the same time must set the \fBD_MP\fR flag in the \fBcb_flag\fR field. See
34 If the driver properly handles 64-bit offsets, it should also set the
35 \fBD_64BIT\fR flag in the \fBcb_flag\fR field. This specifies that the driver
36 will use the \fBuio_loffset\fR field of the \fBuio\fR(9S) structure.
39 If the driver returns \fBEINTR\fR from \fBopen\fR(9E), it should also set the
40 \fBD_OPEN_RETURNS_EINTR\fR flag in the \fBcb_flag\fR field. This lets the
41 framework know that it is safe for the driver to return \fBEINTR\fR when
42 waiting, to provide exclusion for a last-reference \fBclose\fR(9E) call to
43 complete before calling \fBopen\fR(9E).
46 The \fBmt-streams\fR(9F) function describes other flags that can be set in the
50 The \fBcb_rev\fR is the \fBcb_ops\fR structure revision number. This field must
51 be set to \fBCB_REV\fR.
54 Non-\fBSTREAMS\fR drivers should set \fBcb_str\fR to \fINULL\fR.
57 The following \fBDDI\fR/\fBDKI\fR or \fBDKI\fR-only or \fBDDI\fR-only functions
58 are provided in the character/block driver operations structure.
65 block/char Function Description
67 b/c XXopen \fBDDI\fR/\fBDKI\fR
68 b/c XXclose \fBDDI\fR/\fBDKI\fR
88 int (*cb_open)(dev_t *devp, int flag, int otyp, cred_t *credp);
89 int (*cb_close)(dev_t dev, int flag, int otyp, cred_t *credp);
90 int (*cb_strategy)(struct buf *bp);
91 int (*cb_print)(dev_t dev, char *str);
92 int (*cb_dump)(dev_t dev, caddr_t addr, daddr_t blkno, int nblk);
93 int (*cb_read)(dev_t dev, struct uio *uiop, cred_t *credp);
94 int (*cb_write)(dev_t dev, struct uio *uiop, cred_t *credp);
95 int (*cb_ioctl)(dev_t dev, int cmd, intptr_t arg, int mode,
96 cred_t *credp, int *rvalp);
97 int (*cb_devmap)(dev_t dev, devmap_cookie_t dhp, offset_t off,
98 size_t len, size_t *maplen, uint_t model);
99 int (*cb_mmap)(dev_t dev, off_t off, int prot);
100 int (*cb_segmap)(dev_t dev, off_t off, struct as *asp,
101 caddr_t *addrp, off_t len, unsigned int prot,
102 unsigned int maxprot, unsigned int flags, cred_t *credp);
103 int (*cb_chpoll)(dev_t dev, short events, int anyyet,
104 short *reventsp, struct pollhead **phpp);
105 int (*cb_prop_op)(dev_t dev, dev_info_t *dip,
106 ddi_prop_op_t prop_op, int mod_flags,
107 char *name, caddr_t valuep, int *length);
108 struct streamtab *cb_str; /* streams information */
111 int (*cb_aread)(dev_t dev, struct aio_req *aio, cred_t *credp);
112 int (*cb_awrite)(dev_t dev, struct aio_req *aio, cred_t *credp);
119 \fBaread\fR(9E), \fBawrite\fR(9E), \fBchpoll\fR(9E), \fBclose\fR(9E),
120 \fBdump\fR(9E), \fBioctl\fR(9E), \fBmmap\fR(9E), \fBopen\fR(9E),
121 \fBprint\fR(9E), \fBprop_op\fR(9E), \fBread\fR(9E), \fBsegmap\fR(9E),
122 \fBstrategy\fR(9E), \fBwrite\fR(9E), \fBnochpoll\fR(9F), \fBnodev\fR(9F),
123 \fBnulldev\fR(9F), \fBdev_ops\fR(9S), \fBqinit\fR(9S)
126 \fIWriting Device Drivers\fR
129 \fISTREAMS Programming Guide\fR