12061 Convert cb_ops(9S) to mandoc

   1 '\" te
   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"
   7 .SH NAME
   8 cb_ops \- character/block entry points structure
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 #include <sys/conf.h>
  13 #include <sys/ddi.h>
  14 #include <sys/sunddi.h>
  15 .fi
  16 
  17 .SH INTERFACE LEVEL
  18 .sp
  19 .LP









  20 Solaris DDI specific (Solaris DDI)
  21 .SH DESCRIPTION
  22 .sp
  23 .LP
  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.
  27 .sp
  28 .LP


  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
  31 \fBopen\fR(9E).
  32 .sp
  33 .LP




  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.
  37 .sp
  38 .LP
  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).
  44 .sp
  45 .LP
  46 The \fBmt-streams\fR(9F) function describes other flags that can be set in the
  47 \fBcb_flag\fR field.
  48 .sp
  49 .LP
  50 The \fBcb_rev\fR is the \fBcb_ops\fR structure revision number. This field must
  51 be set to \fBCB_REV\fR.
  52 .sp
  53 .LP
  54 Non-\fBSTREAMS\fR drivers should set \fBcb_str\fR to \fINULL\fR.
  55 .sp
  56 .LP
  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.
  59 .sp
  60 
  61 .sp
  62 .TS
  63 c c c c
  64 l l l l .
  65 block/char      Function        Description     
  66 _
  67 b/c     XXopen  \fBDDI\fR/\fBDKI\fR     
  68 b/c     XXclose \fBDDI\fR/\fBDKI\fR     
  69 b       XXstrategy      DDI/DKI 
  70 b       XXprint DDI/DKI 
  71 b       XXdump  DDI(Sun)        
  72 c       XXread  DDI/DKI 
  73 c       XXwrite DDI/DKI 
  74 c       XXioctl DDI/DKI 
  75 c       XXdevmap        DDI(Sun)        
  76 c       XXmmap  DKI     
  77 c       XXsegmap        DKI     
  78 c       XXchpoll        DDI/DKI 
  79 c       XXprop_op       DDI(Sun)        
  80 c       XXaread DDI(Sun)        
  81 c       XXawrite        DDI(Sun)        
  82 .TE
  83 
  84 .SH STRUCTURE MEMBERS
  85 .sp
  86 .in +2
  87 .nf























  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 */
 109 int  cb_flag;
 110 int  cb_rev;
 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);
 113 .fi
 114 .in -2
 115 
 116 .SH SEE ALSO
 117 .sp
 118 .LP
 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)
 124 .sp
 125 .LP
 126 \fIWriting Device Drivers\fR
 127 .sp
 128 .LP
 129 \fISTREAMS Programming Guide\fR










--- EOF ---