📄 cbiolib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/cbioLib.html - generated by refgen from cbioLib.c --> <title> cbioLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>cbioLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cbioLib</strong> - Cached Block I/O library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./cbioLib.html#cbioLibInit">cbioLibInit</a>( )</b> - Initialize CBIO Library<br><b><a href="./cbioLib.html#cbioBlkRW">cbioBlkRW</a>( )</b> - transfer blocks to or from memory<br><b><a href="./cbioLib.html#cbioBytesRW">cbioBytesRW</a>( )</b> - transfer bytes to or from memory<br><b><a href="./cbioLib.html#cbioBlkCopy">cbioBlkCopy</a>( )</b> - block to block (sector to sector) tranfer routine<br><b><a href="./cbioLib.html#cbioIoctl">cbioIoctl</a>( )</b> - perform ioctl operation on device<br><b><a href="./cbioLib.html#cbioModeGet">cbioModeGet</a>( )</b> - return the mode setting for CBIO device<br><b><a href="./cbioLib.html#cbioModeSet">cbioModeSet</a>( )</b> - set mode for CBIO device<br><b><a href="./cbioLib.html#cbioRdyChgdGet">cbioRdyChgdGet</a>( )</b> - determine ready status of CBIO device<br><b><a href="./cbioLib.html#cbioRdyChgdSet">cbioRdyChgdSet</a>( )</b> - force a change in ready status of CBIO device<br><b><a href="./cbioLib.html#cbioLock">cbioLock</a>( )</b> - obtain CBIO device semaphore.<br><b><a href="./cbioLib.html#cbioUnlock">cbioUnlock</a>( )</b> - release CBIO device semaphore.<br><b><a href="./cbioLib.html#cbioParamsGet">cbioParamsGet</a>( )</b> - fill in <b>CBIO_PARAMS</b> structure with CBIO device parameters<br><b><a href="./cbioLib.html#cbioShow">cbioShow</a>( )</b> - print information about a CBIO device<br><b><a href="./cbioLib.html#cbioDevVerify">cbioDevVerify</a>( )</b> - verify <b>CBIO_DEV_ID</b> <br><b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> - create CBIO wrapper atop a <b>BLK_DEV</b> device<br><b><a href="./cbioLib.html#cbioDevCreate">cbioDevCreate</a>( )</b> - Initialize a CBIO device (Generic)<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p><p>This library provides the Cached Block Input Output Application Programmers Interface (CBIO API). Libraries such as <b><a href="./dosFsLib.html#top">dosFsLib</a></b>, <b><a href="./rawFsLib.html#top">rawFsLib</a></b>, and <b><a href="./usrFdiskPartLib.html#top">usrFdiskPartLib</a></b> use the CBIO API for I/O operations to underlying devices.<p>This library also provides generic services for CBIO modules. The libraries dpartCbio, dcacheCbio, and ramDiskCbio are examples of CBIO modules that make use of these generic services.<p>This library also provides a CBIO module that converts blkIo driver <b>BLK_DEV</b> (<b>blkIo.h</b>) interface into CBIO API compliant interface usingminimal memory overhead. This lean module is known as the basic <b>BLK_DEV</b> to CBIO wrapper module. <p></blockquote><h4>CBIO MODULES AND DEVICES</h4><blockquote><p><p>A CBIO module contains code for supporting CBIO devices. The libraries <b><a href="./cbioLib.html#top">cbioLib</a></b>, dcacheCbio, dpartCbio, and ramDiskCbio are examples of CBIO modules. <p>A CBIO device is a software layer that provide its master controlof I/O to it subordinate. CBIO device layers typicaly reside logically below a file system and above a storage device. CBIO devices conform to the CBIO API on their master (upper) interface.<p>CBIO modules provide a CBIO device creation routine used to instantiate a CBIO device. The CBIO modules device creation routine returns a <b>CBIO_DEV_ID</b> handle. The <b>CBIO_DEV_ID</b> handle is used to uniquely identify the CBIO device layer instance. The user of the CBIO device passes this handle to the CBIO API routines when accessing the device.<p>The libraries <b><a href="./dosFsLib.html#top">dosFsLib</a></b>, <b><a href="./rawFsLib.html#top">rawFsLib</a></b>, and <b><a href="./usrFdiskPartLib.html#top">usrFdiskPartLib</a></b> are considered users of CBIO devices because they use the CBIO API on their subordinate(lower) interface. They do not conform to the CBIO API on their master interface, therefore they are not CBIO modules. They are users of CBIO devices and always reside above CBIO devices in the logical stack.<p></blockquote><h4>TYPES OF CBIO DEVICES </h4><blockquote><p><p>A "CBIO to CBIO device" uses the CBIO API for both its master and its subordinate interface. Typically, some type of module specific I/O processing occurs during the interface between the master and subordinatelayers. The libraries dpartCbio and dcacheCbio are examples of CBIO to CBIO devices. CBIO to CBIO device layers are stackable. Care should be taken to assemble the stack properly. Refer to each modules reference manual entry for recommendations about the optimum stacking order. <p>A "CBIO API device driver" is a device driver which provides the CBIOAPI as the interface between the hardware and its upper layer. The <b>ramDiskCbio.c</b> RAM DISK driver is an example of a simple CBIO API device driver.<p>A "basic <b>BLK_DEV</b> to CBIO wrapper device" wraps a subordinate <b>BLK_DEV</b> layer with a CBIO API compatible layer. The wrapper is provided via the <b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> function.<p>The logical layers of a typical system using a CBIO RAM DISK appear:<p><pre> +--------------------+ | Application module | +--------------------+ <-- read(), write(), ioctl() | +--------------------+ | VxWorks I/O System | +--------------------+ <-- IOS layer iosRead,Write,ioctl | (iosDrvInstall rtns from dosFsLib) +--------------- -----------+ | File System (DOSFS/RAWFS) | +---------------------------+ <-- CBIO API (cbioBlkRW, cbioIoctl, etc.) |+----------------------------------------------+| CBIO API device driver module (ramDiskCbio.c)|+----------------------------------------------+ | +----------+ | Hardware | +----------+</pre><p>The logical layers of a typical system with a fixed diskusing CBIO partitioning layer and a CBIO caching layer appears:<p><pre> +--------------------+ | Application module | +--------------------+ <-- read(), write(), ioctl() | +-------------------+ | VxWorks IO System | +-------------------+ <-- IOS layer Read,Write, ioctl | (iosDrvInstall rtns from dosFsLib) +---------------------------+ | File System (DOSFS/RAWFS) | +---------------------------+ <-- CBIO API RTNS (cbioLib.h) | +---------------------------------+ | CBIO to CBIO device (dpartCbio) | +---------------------------------+ <-- CBIO API RTNS | +----------------------------------+ | CBIO to CBIO device (dcacheCbio) | +----------------------------------+ <-- CBIO API RTNS | +------------------------------------------------+ | basic CBIO to BLK_DEV wrapper device (cbioLib) | +------------------------------------------------+ <-- BLK_DEV (blkIo.h) |+-------------------------------------------------------+| BLK_DEV API device driver. scsiLib, ataDrv, fdDrv,etc | +-------------------------------------------------------+ | +-------------------------+ | Storage Device Hardware | +-------------------------+</pre><p></blockquote><h4>PUBLIC CBIO API</h4><blockquote><p><p>The CBIO API provides user access to CBIO devices. Users of CBIO devices are typically either file systems or other CBIO devices. <p>The CBIO API is exposed via <b>cbioLib.h</b>. Users of CBIO modules include the <b>cbioLib.h</b> header file. The libraries <b><a href="./dosFsLib.html#top">dosFsLib</a></b>, dosFsFat, <b>dosVDirLib</b>, <b>dosDirOldLib</b>, <b><a href="./usrFdiskPartLib.html#top">usrFdiskPartLib</a></b>, and <b><a href="./rawFsLib.html#top">rawFsLib</a></b> all use the CBIO API to access CBIO modules beneath them. <p>The following functions make up the public CBIO API:<ul><li></li><b><a href="./cbioLib.html#cbioLibInit">cbioLibInit</a>( )</b> - Library initialization routine <li></li><b><a href="./cbioLib.html#cbioBlkRW">cbioBlkRW</a>( )</b> - Transfer blocks (sectors) from/to a memory buffer<li></li><b><a href="./cbioLib.html#cbioBytesRW">cbioBytesRW</a>( )</b> - Transfer bytes from/to a memory buffer<li></li><b><a href="./cbioLib.html#cbioBlkCopy">cbioBlkCopy</a>( )</b> - Copy directly from block to block (sector to sector)<li></li><b><a href="./cbioLib.html#cbioIoctl">cbioIoctl</a>( )</b> - Perform I/O control operations on the CBIO device<li></li><b><a href="./cbioLib.html#cbioModeGet">cbioModeGet</a>( )</b> - Get the CBIO device mode (<b>O_RDONLY</b>, <b>O_WRONLY</b>, or <b>O_RDWR</b>)<li></li><b><a href="./cbioLib.html#cbioModeSet">cbioModeSet</a>( )</b> - Set the CBIO device mode (<b>O_RDONLY</b>, <b>O_WRONLY</b>, or <b>O_RDWR</b>)<li></li><b><a href="./cbioLib.html#cbioRdyChgdGet">cbioRdyChgdGet</a>( )</b> - Determine the CBIO device ready status state<li></li><b><a href="./cbioLib.html#cbioRdyChgdSet">cbioRdyChgdSet</a>( )</b> - Force a change in the CBIO device ready status state <li></li><b><a href="./cbioLib.html#cbioLock">cbioLock</a>( )</b> - Obtain exclusive ownership of the CBIO device <li></li><b><a href="./cbioLib.html#cbioUnlock">cbioUnlock</a>( )</b> - Release exclusive ownership of the CBIO device <li></li><b><a href="./cbioLib.html#cbioParamsGet">cbioParamsGet</a>( )</b> - Fill a <b>CBIO_PARAMS</b> structure with data from the CBIO device<li></li><b><a href="./cbioLib.html#cbioDevVerify">cbioDevVerify</a>( )</b> - Verify valid CBIO device <li></li><b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> - Create CBIO wrapper atop a <b>BLK_DEV</b> <li></li><b><a href="./cbioLib.html#cbioShow">cbioShow</a>( )</b> - Display information about a CBIO device</ul><p>These CBIO API functions (except <b><a href="./cbioLib.html#cbioLibInit">cbioLibInit</a>( )</b>) are passed a <b>CBIO_DEV_ID</b> handle in the first argument. This handle (obtained from the subordinate CBIO modules device creation routine) is used by the routine to verify thethe CBIO device is valid and then to perform the requested operationon the specific CBIO device.<p>When the <b>CBIO_DEV_ID</b> passed to the CBIO API routine is not a valid CBIO handle, ERROR will be returned with the errno set to <b>S_cbioLib_INVALID_CBIO_DEV_ID</b> (<b>cbioLib.h</b>). <p>Refer to the individual manual entries for each function for a complete description.<p><p>THE BASIC CBIO TO <b>BLK_DEV</b> WRAPPER MODULE<p>The basic CBIO to <b>BLK_DEV</b> wrapper is a minimized disk cache using simplified algorithms. It is used to convert a legacy <b>BLK_DEV</b> device into as CBIO device. It may be used standalone with solid state disks which do not have mechanical seek and rotational latency delays, such flash cards. It may also be used in conjunction withthe dpartCbio and dcacheCbio libraries. The DOS file system dosFsDevCreate routine will call <b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> internally, so the file system may be installed directly on top of a block driver <b>BLK_DEV</b>or it can be used with cache and partitioning support. <p>The function <b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> is used to create the CBIO wrapper atopa <b>BLK_DEV</b> device.<p>The functions dcacheDevCreate and dpartDevCreate also both interally use <b><a href="./cbioLib.html#cbioDevVerify">cbioDevVerify</a>( )</b> and <b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> to either stack the new CBIO device atop a validated CBIO device or to create a basic CBIO to <b>BLK_DEV</b> wrapper as needed. The user typically never needs to manually invoke the <b><a href="./cbioLib.html#cbioWrapBlkDev">cbioWrapBlkDev</a>( )</b> or <b><a href="./cbioLib.html#cbioDevVerify">cbioDevVerify</a>( )</b> functions.<p>Please note that the basic CBIO <b>BLK_DEV</b> wrapper is inappropriate for rotational media without the disk caching layer. The services provided by the dcacheCbio module are more appropriate for use on rotational disk devices and will yeild superior performancewhen used.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><i>VxWorks Programmers Guide: I/O System </i><p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>cbioLib.h</b><p><hr><a name="cbioLibInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>cbioLibInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cbioLibInit( )</strong> - Initialize CBIO Library</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -