static struct cb_ops xx_cb_ops = { xxopen, /* open(9E) */ xxclose, /* close(9E) */ xxstrategy, /* strategy(9E) */ xxprint, /* print(9E) */ xxdump, /* dump(9E) */ xxread, /* read(9E) */ xxwrite, /* write(9E) */ xxioctl, /* ioctl(9E) */ xxdevmap, /* devmap(9E) */ nodev, /* mmap(9E) */ xxsegmap, /* segmap(9E) */ xxchpoll, /* chpoll(9E) */ xxprop_op, /* prop_op(9E) */ NULL, /* streamtab(9S) */ D_MP | D_64BIT, /* cb_flag */ CB_REV, /* cb_rev */ xxaread, /* aread(9E) */ xxawrite /* awrite(9E) */ };
The cb_ops(9S) structure contains the entry points for the character and block operations of the device driver. Any entry points the driver does not support should be initialized to nodev(9F). For example, character device drivers should set all the block-only fields, such as cb_stategy, to nodev(9F). Note that the mmap(9E) entry point is maintained for compatibility with previous releases, and drivers should use the devmap(9E) entry point for device memory mapping. If devmap(9E) is supported, set mmap(9E) to nodev(9F).
The streamtab field indicates whether this is a STREAMS-based driver. The device drivers discussed in this book (with the exception of Chapter 16, Drivers for Network Devices) are not STREAMS based. For a non-STREAMS-based driver, the streamtab field must be set to NULL.
The cb_flag member contains the following flags:
The D_MP flag indicates that the driver is safe for multi-threading. Solaris 9 operating environment only supports thread safe drivers, so, D_MP must be set.
If the driver properly handles 64-bit offsets, it should set the D_64BIT flag in the cb_flag field. This specifies that the driver will use the uio_loffset field of the uio(9S) structure.
If the driver supports the devmap(9E) entry point, it should set the D_DEVMAP flag. For information on devmap(9E), see Chapter 12, Mapping Device and Kernel Memory.
cb_rev is the cb_ops(9S) structure revision number. This field must be set to CB_REV.