📄 unixdrv.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/unixDrv.html - generated by refgen from unixDrv.c --> <title> unixDrv </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>unixDrv</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>unixDrv</strong> - UNIX-file disk driver (VxSim for Solaris and VxSim for HP) </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./unixDrv.html#unixDrv">unixDrv</a>( )</b> - install UNIX disk driver<br><b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> - create a UNIX disk device<br><b><a href="./unixDrv.html#unixDiskInit">unixDiskInit</a>( )</b> - initialize a dosFs disk on top of UNIX<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This driver emulates a VxWorks disk driver, but actually uses the UNIXfile system to store the data. The VxWorks disk appears underUNIX as a single file.The UNIX file name, and the size of the disk, may be specified during the <b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> call.<p></blockquote><h4>USER-CALLABLE ROUTINES</h4><blockquote><p>Most of the routines in this driver are accessible only through the I/Osystem. The routine <b><a href="./unixDrv.html#unixDrv">unixDrv</a>( )</b> must be called to initialize the driver andthe <b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> routine is used to create devices.<p></blockquote><h4>CREATING UNIX DISKS</h4><blockquote><p>Before a UNIX disk can be used, it must be created. This is donewith the <b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> call. The format of this call is:<p><pre> BLK_DEV *unixDiskDevCreate ( char *unixFile, /* name of the UNIX file to use */ int bytesPerBlk, /* number of bytes per block */ int blksPerTrack, /* number of blocks per track */ int nBlocks /* number of blocks on this device */ )</pre>The UNIX file must be pre-allocated separately. Thiscan be done using the UNIX mkfile(8) command. Note that you have tocreate an appropriately sized file. For example, to create a UNIXfile system that is used as a common floppy dosFs file system, youwould issue the comand:<pre> mkfile 1440k /tmp/floppy.dos</pre>This will create space for a 1.44 Meg DOS floppy (1474560 bytes,or 2880 512-byte blocks).<p>The <i>bytesPerBlk</i> parameter specifies the size of each logical blockon the disk. If <i>bytesPerBlk</i> is zero, 512 is the default.<p>The <i>blksPerTrack</i> parameter specifies the number of blocks on eachlogical track of the UNIX disk. If <i>blksPerTrack</i> is zero, the count ofblocks per track will be set to <i>nBlocks</i> (i.e., the disk will be defined as having only one track). UNIX disk devices typically are specifiedwith only one track.<p>The <i>nBlocks</i> parameter specifies the size of the disk, in blocks.If <i>nBlocks</i> is zero the size of the UNIX file specified, divided bythe number of bytes per block, is used.<p>The formatting parameters (<i>bytesPerBlk</i>, <i>blksPerTrack</i>, and <i>nBlocks</i>)are critical only if the UNIX disk already contains the contentsof a disk created elsewhere. In that case, the formatting parameters must be identical to those used when the image was created. Otherwise, they may be any convenient number.<p>Once the device has been created it still does not have a name orfile system associated with it. This must be done by using the file system's device initialization routine (e.g., <b>dosFsDevInit( )</b>). ThedosFs and rt11Fs file systems also provide make-file-system routines(<b>dosFsMkfs( )</b> and <b><a href="./rt11FsLib.html#rt11FsMkfs">rt11FsMkfs</a>( )</b>), which may be used to associate a nameand file system with the block device and initialize that file systemon the device using default configuration parameters.<p>The <b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> call returns a pointer to a block devicestructure (<b>BLK_DEV</b>). This structure contains fields that describe the physical properties of a disk device and specify the addresses of routines within the UNIX disk driver.The <b>BLK_DEV</b> structure address must be passed to the desired file system (dosFs, rt11Fs, or rawFs) during the file system's device initialization or make-file-system routine. Only then is a name and file system associated with the device, making it available for use.<p>As an example, to create a 200KB disk, 512-byte blocks, and only one track,the proper call would be:<pre> BLK_DEV *pBlkDev; pBlkDev = unixDiskDevCreate ("/tmp/filesys1", 512, 400, 400, 0);</pre>This will attach the UNIX file /tmp/filesys1 as a block device.<p>A convenience routine, <b><a href="./unixDrv.html#unixDiskInit">unixDiskInit</a>( )</b>, is provided to do the<b><a href="./unixDrv.html#unixDiskDevCreate">unixDiskDevCreate</a>( )</b> followed by either a <b>dosFsMkFs( )</b> or <b>dosFsDevInit( )</b>,whichever is appropriate. <p>The format of this call is:<p><pre> BLK_DEV *unixDiskInit ( char * unixFile, /* name of the UNIX file to use */ char * volName, /* name of the dosFs volume to use */ int nBytes /* number of bytes in dosFs volume */ )</pre>This call will create the UNIX disk if required.<p></blockquote><h4>IOCTL</h4><blockquote><p>Only the FIODISKFORMAT request is supported; all other ioctl requestsreturn an error, and set the task's errno to <b>S_ioLib_UNKNOWN_REQUEST</b>.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><p><b>dosFsDevInit( )</b>, <b>dosFsMkfs( )</b>, <b><a href="./rt11FsLib.html#rt11FsDevInit">rt11FsDevInit</a>( )</b>, <b><a href="./rt11FsLib.html#rt11FsMkfs">rt11FsMkfs</a>( )</b>, <b><a href="./rawFsLib.html#rawFsDevInit">rawFsDevInit</a>( )</b>,<i>VxWorks Programmer's Guide: I/O System, Local File Systems </i><p></blockquote><h4>LINTLIBRARY</h4><blockquote><p><hr><a name="unixDrv"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>unixDrv( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>unixDrv( )</strong> - install UNIX disk driver</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS unixDrv (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>Used in <b>usrConfig.c</b> to cause the UNIX disk driver to be linked inwhen building VxWorks. Otherwise, it is not necessary to call thisroutine before using the UNIX disk driver.<p>This routine is only applicable to VxSim for Solaris and VxSim for HP.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK (always).</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./unixDrv.html#top">unixDrv</a></b><hr><a name="unixDiskDevCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>unixDiskDevCreate( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>unixDiskDevCreate( )</strong> - create a UNIX disk device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>BLK_DEV *unixDiskDevCreate ( char * unixFile, /* name of the UNIX file */ int bytesPerBlk, /* number of bytes per block */ int blksPerTrack, /* number of blocks per track */ int nBlocks /* number of blocks on this device */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a UNIX disk device.<p>The <i>unixFile</i> parameter specifies the name of the UNIX file to usefor the disk device.<p>The <i>bytesPerBlk</i> parameter specifies the size of each logical blockon the disk. If <i>bytesPerBlk</i> is zero, 512 is the default.<p>The <i>blksPerTrack</i> parameter specifies the number of blocks on eachlogical track of the disk. If <i>blksPerTrack</i> is zero, the count ofblocks per track is set to <i>nBlocks</i> (i.e., the disk is defined as having only one track).<p>The <i>nBlocks</i> parameter specifies the size of the disk, in blocks.If <i>nBlocks</i> is zero, a default size is used. The default is calculatedas the size of the UNIX disk divided by the number of bytes per block.<p>This routine is only applicable to VxSim for Solaris and VxSim for HP.<p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to block device (<b>BLK_DEV</b>) structure,or NULL, if unable to open the UNIX disk.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./unixDrv.html#top">unixDrv</a></b><hr><a name="unixDiskInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>unixDiskInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>unixDiskInit( )</strong> - initialize a dosFs disk on top of UNIX</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void unixDiskInit ( char * unixFile, /* UNIX file name */ char * volName, /* dosFs name */ int diskSize /* number of bytes */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine provides some convenience for a user wanting to createa UNIX disk-based dosFs file system under VxWorks. The user onlyspecifes the UNIX file to use, the dosFs volume name, and thesize of the volume in bytes, if the UNIX file needs to be created.<p>This routine is only applicable to VxSim for Solaris and VxSim for HP.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./unixDrv.html#top">unixDrv</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -