12061 Convert cb_ops(9S) to mandoc

   1 CB_OPS(9S)                Data Structures for Drivers               CB_OPS(9S)
   2 
   3 
   4 
   5 NAME
   6        cb_ops - character/block entry points structure
   7 
   8 SYNOPSIS
   9        #include <sys/conf.h>
  10        #include <sys/ddi.h>
  11        #include <sys/sunddi.h>
  12 
  13 
  14 INTERFACE LEVEL
  15        Solaris DDI specific (Solaris DDI)
  16 
  17 DESCRIPTION
  18        The cb_ops structure contains all entry points for drivers that support
  19        both character and block entry points. All leaf device drivers that
  20        support direct user process access to a device should declare a cb_ops
  21        structure.
  22 



  23 
  24        All drivers that safely allow multiple threads of execution in the
  25        driver at the same time must set the D_MP flag in the cb_flag field.
  26        See open(9E).
  27 
  28 
  29        If the driver properly handles 64-bit offsets, it should also set the
  30        D_64BIT flag in the cb_flag field. This specifies that the driver will
  31        use the uio_loffset field of the uio(9S) structure.
  32 
  33 
  34        If the driver returns EINTR from open(9E), it should also set the
  35        D_OPEN_RETURNS_EINTR flag in the cb_flag field. This lets the framework
  36        know that it is safe for the driver to return EINTR when waiting, to
  37        provide exclusion for a last-reference close(9E) call to complete
  38        before calling open(9E).
  39 


  40 
  41        The mt-streams(9F) function describes other flags that can be set in
  42        the cb_flag field.
  43 
  44 
  45        The cb_rev is the cb_ops structure revision number. This field must be
  46        set to CB_REV.
  47 
  48 
  49        Non-STREAMS drivers should set cb_str to NULL.
  50 
  51 
  52        The following DDI/DKI or DKI-only or DDI-only functions are provided in
  53        the character/block driver operations structure.
  54 
  55 
  56 
  57 
  58        block/char    Function    Description
  59        ----------------------------------------
  60        b/c          XXopen       DDI/DKI
  61        b/c          XXclose      DDI/DKI
  62        b            XXstrategy   DDI/DKI
  63        b            XXprint      DDI/DKI
  64        b            XXdump       DDI(Sun)
  65        c            XXread       DDI/DKI
  66        c            XXwrite      DDI/DKI
  67        c            XXioctl      DDI/DKI
  68        c            XXdevmap     DDI(Sun)
  69        c            XXmmap       DKI
  70        c            XXsegmap     DKI
  71        c            XXchpoll     DDI/DKI
  72        c            XXprop_op    DDI(Sun)
  73        c            XXaread      DDI(Sun)
  74        c            XXawrite     DDI(Sun)
  75 
  76 
  77 STRUCTURE MEMBERS
  78          int  (*cb_open)(dev_t *devp, int flag, int otyp, cred_t *credp);
  79          int  (*cb_close)(dev_t dev, int flag, int otyp, cred_t *credp);
  80          int  (*cb_strategy)(struct buf *bp);
  81          int  (*cb_print)(dev_t dev, char *str);
  82          int  (*cb_dump)(dev_t dev, caddr_t addr, daddr_t blkno, int nblk);
  83          int  (*cb_read)(dev_t dev, struct uio *uiop, cred_t *credp);
  84          int  (*cb_write)(dev_t dev, struct uio *uiop, cred_t *credp);
  85          int  (*cb_ioctl)(dev_t dev, int cmd, intptr_t arg, int mode,
  86                  cred_t *credp, int *rvalp);
  87          int  (*cb_devmap)(dev_t dev, devmap_cookie_t dhp, offset_t off,
  88                  size_t len, size_t *maplen, uint_t model);
  89          int  (*cb_mmap)(dev_t dev, off_t off, int prot);
  90          int  (*cb_segmap)(dev_t dev, off_t off, struct as *asp,
  91                  caddr_t *addrp, off_t len, unsigned int prot,
  92                  unsigned int maxprot, unsigned int flags, cred_t *credp);
  93          int  (*cb_chpoll)(dev_t dev, short events, int anyyet,
  94                  short *reventsp, struct pollhead **phpp);
  95          int  (*cb_prop_op)(dev_t dev, dev_info_t *dip,
  96                  ddi_prop_op_t prop_op, int mod_flags,
  97                  char *name, caddr_t valuep, int *length);
  98          struct streamtab *cb_str;   /* streams information */
  99          int  cb_flag;
 100          int  cb_rev;
 101          int  (*cb_aread)(dev_t dev, struct aio_req *aio, cred_t *credp);
 102          int  (*cb_awrite)(dev_t dev, struct aio_req *aio, cred_t *credp);
 103 
 104 
 105 SEE ALSO
 106        aread(9E), awrite(9E), chpoll(9E), close(9E), dump(9E), ioctl(9E),
 107        mmap(9E), open(9E), print(9E), prop_op(9E), read(9E), segmap(9E),
 108        strategy(9E), write(9E), nochpoll(9F), nodev(9F), nulldev(9F),
 109        dev_ops(9S), qinit(9S)
 110 

 111 
 112        Writing Device Drivers
 113 
 114 
 115        STREAMS Programming Guide
 116 
 117 
 118 
 119                                 April 24, 2008                      CB_OPS(9S)
--- EOF ---