📄 cdromfslib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/cdromFsLib.html - generated by refgen from cdromFsLib.c --> <title> cdromFsLib </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>cdromFsLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cdromFsLib</strong> - ISO 9660 CD-ROM read-only file system library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./cdromFsLib.html#cdromFsInit">cdromFsInit</a>( )</b> - initialize <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b><br><b><a href="./cdromFsLib.html#cdromFsVolConfigShow">cdromFsVolConfigShow</a>( )</b> - show the volume configuration information<br><b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b> - create a <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> device<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library defines <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>, a utility that lets you use standard POSIX I/O calls to read data from a CD-ROM formatted according to the ISO 9660 standard file system.<p>It provides access to CD-ROM file systems using any standard<b>BLOCK_DEV</b> structure (that is, a disk-type driver). <p>The basic initialization sequence is similar to installing a DOS file systemon a SCSI device.<p>1. Initialize the cdrom file system library(preferably in <b><a href="./sysLib.html#sysScsiConfig">sysScsiConfig</a>( )</b> in <b>sysScsi.c</b>):<pre> cdromFsInit ();</pre> 2. Locate and create a SCSI physical device:<pre> pPhysDev=scsiPhysDevCreate(pSysScsiCtrl,0,0,0,NONE,1,0,0);</pre> 3. Create a SCSI block device on the physical device:<pre> pBlkDev = (SCSI_BLK_DEV *) scsiBlkDevCreate (pPhysDev, 0, 0);</pre> 4. Create a CD-ROM file system on the block device:<pre> cdVolDesc = cdromFsDevCreate ("cdrom:", (BLK_DEV *) pBlkDev);</pre> Call <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b> once for each CD-ROM drive attached to your target.After the successful completion of <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b>, the CD-ROM file system will be available like any DOS file system, and you can access data on the named CD-ROM device using <b><a href="./ioLib.html#open">open</a>( )</b>, <b><a href="./ioLib.html#close">close</a>( )</b>, <b><a href="./ioLib.html#read">read</a>( )</b>, <b><a href="./ioLib.html#ioctl">ioctl</a>( )</b>, <b><a href="./dirLib.html#readdir">readdir</a>( )</b>, and <b><a href="./dirLib.html#stat">stat</a>( )</b>. A <b><a href="./ioLib.html#write">write</a>( )</b> always returns an error. <p>The <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> utility supports multiple drives, concurrent access from multiple tasks, and multiple open files.<p></blockquote><h4>FILE AND DIRECTORY NAMING</h4><blockquote><p>The strict ISO 9660 specification allows only uppercase file names consisting of 8 characters plus a 3 character suffix. To support multipleversions of the same file, the ISO 9660 specification also supports versionnumbers. When specifying a file name in an <b><a href="./ioLib.html#open">open</a>( )</b> call, you can select thefile version by appending the file name with a semicolon (;) followed by a decimal number indicating the file version. If you omit the version number,<b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> opens the latest version of the file.<p>To accommodate users familiar with MS-DOS, <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> lets you use lowercase name arguments to access files with names consisting entirely of uppercase characters. Mixed-case file and directory names are accessible only if youspecify their exact case-correct names. <p>For the time being, <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> further accommodates MS-DOS users by allowing "of the backslash is discouraged because it may not be supported infuture versions of <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>.<p>Finally, <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> uses an 8-bit clean implementation of ISO 9660. Thus, <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> is compatible with CD-ROMs using either Latin or Asian characters in the file names.<p></blockquote><h4>IOCTL CODES SUPPORTED</h4><blockquote><p><dl><dt><b>FIOGETNAME</b><dd>Returns the file name for a specific file descriptor.<dt><b>FIOLABELGET</b><dd>Retrieves the volume label. This code can be used to verify that a particular volume has been inserted into the drive.<dt><b>FIOWHERE</b><dd>Determines the current file position.<dt><b>FIOSEEK</b><dd>Changes the current file position.<dt><b>FIONREAD</b><dd>Tells you the number of bytes between the current location and the end of this file.<dt><b>FIOREADDIR</b><dd>Reads the next directory entry.<dt><b>FIODISKCHANGE</b><dd>Announces that a disk has been replaced (in case the block driver isnot able to provide this indication).<dt><b>FIOUNMOUNT</b><dd>Announces that the a disk has been removed (all currently open file descriptors are invalidated).<dt><b>FIOFSTATGET</b><dd>Gets the file status information (directory entry data).<br> </dl></blockquote><h4>MODIFYING A BSP TO USE CDROMFS</h4><blockquote><p>The following example describes mounting cdromFS on a SCSI device.<p>Edit your BSP's <b>config.h</b> to make the following changes:<table></tr><tr valign=top><td>1.<td>Insert the following macro definition: <pre> #define INCLUDE_CDROMFS</pre></tr><tr valign=top><td>2.<td>Change FALSE to TRUE in the section under the following comment:<pre> /* change FALSE to TRUE for SCSI interface */</pre></table>Make the following changes in <b>sysScsi.c</b>(or <b>sysLib.c</b> if your BSP has no <b>sysScsi.c</b>):<table></tr><tr valign=top><td>1.<td>Add the following declaration to the top of the file: <pre> #ifdef INCLUDE_CDROMFS #include "cdromFsLib.h" STATUS cdromFsInit (void); #endif</pre></tr><tr valign=top><td>2.<td>Modify the definition of <b><a href="./sysLib.html#sysScsiInit">sysScsiInit</a>( )</b> to include the following:<pre> #ifdef INCLUDE_CDROMFS cdromFsInit(); #endif</pre>The call to <b><a href="./cdromFsLib.html#cdromFsInit">cdromFsInit</a>( )</b> initializes cdromFS. This call mustbe made only once and must complete successfully before you cancall any other <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> routines, such as <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b>.Typically, you make the <b>cdromFSInit( )</b> call at system startup.Because cdromFS is used with SCSI CD-ROM devices, it is naturalto call <b>cdromFSInit( )</b> from within <b><a href="./sysLib.html#sysScsiInit">sysScsiInit</a>( )</b>.</tr><tr valign=top><td>3.<td>Modify the definition of <b><a href="./sysLib.html#sysScsiConfig">sysScsiConfig</a>( )</b> (if included in your BSP)to include the following: <pre>/* configure a SCSI CDROM at busId 6, LUN = 0 */#ifdef INCLUDE_CDROMFSif ((pSpd60 = scsiPhysDevCreate (pSysScsiCtrl, 6, 0, 0, NONE, 0, 0, 0)) == (SCSI_PHYS_DEV *) NULL) { SCSI_DEBUG_MSG ("sysScsiConfig: scsiPhysDevCreate failed for CDROM.\n", 0, 0, 0, 0, 0, 0); return (ERROR); }else if ((pSbdCd = scsiBlkDevCreate (pSpd60, 0, 0) ) == NULL) { SCSI_DEBUG_MSG ("sysScsiConfig: scsiBlkDevCreate failed for CDROM.\n", 0, 0, 0, 0, 0, 0); return (ERROR); }/* * Create an instance of a CD-ROM device in the I/O system. * A block device must already have been created. Internally, * cdromFsDevCreate() calls iosDrvInstall(), which enters the * appropriate driver routines in the I/O driver table. */if ((cdVolDesc = cdromFsDevCreate ("cdrom:", (BLK_DEV *) pSbdCd )) == NULL) { return (ERROR); }#endif /* end of #ifdef INCLUDE_CDROMFS */</pre></tr><tr valign=top><td>4.<td>Before the definition of <b><a href="./sysLib.html#sysScsiConfig">sysScsiConfig</a>( )</b>, declare the followingglobal variables used in the above code fragment:<pre> SCSI_PHYS_DEV *pSpd60; BLK_DEV *pSbdCd; CDROM_VOL_DESC_ID cdVolDesc;</pre></table>The main goal of the above code fragment is to call <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b>.As input, <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b> expects a pointer to a block device.In the example above, the <b><a href="./scsiLib.html#scsiPhysDevCreate">scsiPhysDevCreate</a>( )</b> and <b><a href="./scsiLib.html#scsiBlkDevCreate">scsiBlkDevCreate</a>( )</b>calls set up a block device interface for a SCSI CD-ROM device. <p>After the successful completion of <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b>, the device called "cdrom" is accessible using the standard <b><a href="./ioLib.html#open">open</a>( )</b>, <b><a href="./ioLib.html#close">close</a>( )</b>, <b><a href="./ioLib.html#read">read</a>( )</b>, <b><a href="./ioLib.html#ioctl">ioctl</a>( )</b>,<b><a href="./dirLib.html#readdir">readdir</a>( )</b>, and <b><a href="./dirLib.html#stat">stat</a>( )</b> calls.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>cdromFsLib.h</b><p></blockquote><h4>CAVEATS</h4><blockquote><p>The <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> utility does not support CD sets containing multiple disks.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, ISO 9660 Specification<hr><a name="cdromFsInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>cdromFsInit( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cdromFsInit( )</strong> - initialize <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b></p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS cdromFsInit (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>. It must be called exactlyonce before calling any other routine in <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>. <p></blockquote><h4>ERRNO</h4><blockquote><p><b>S_cdromFsLib_ALREADY_INIT</b><p></blockquote><h4>RETURNS</h4><blockquote><p>OK or ERROR, if <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> has already been initialized.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>, <b><a href="./cdromFsLib.html#cdromFsDevCreate">cdromFsDevCreate</a>( )</b>, <b>iosLib.h</b><hr><a name="cdromFsVolConfigShow"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>cdromFsVolConfigShow( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cdromFsVolConfigShow( )</strong> - show the volume configuration information</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>VOID cdromFsVolConfigShow ( void * arg /* device name or CDROM_VOL_DESC * */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine retrieves the volume configuration for the named <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>device and prints it to standard output. The information displayed is retrieved from the <b>BLK_DEV</b> structure for the specified device.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./cdromFsLib.html#top">cdromFsLib</a></b><hr><a name="cdromFsDevCreate"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>cdromFsDevCreate( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>cdromFsDevCreate( )</strong> - create a <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> device</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>CDROM_VOL_DESC_ID cdromFsDevCreate ( char * devName, /* device name */ BLK_DEV * pBlkDev /* ptr to block device */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates an instance of a <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> device in the I/O system.As input, this function requires a pointer to a <b>BLK_DEV</b> structure for the CD-ROM drive on which you want to create a <b><a href="./cdromFsLib.html#top">cdromFsLib</a></b> device. Thus,you should already have called <b><a href="./scsiLib.html#scsiBlkDevCreate">scsiBlkDevCreate</a>( )</b> prior to calling<b>cdfromFsDevCreate( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><b>CDROM_VOL_DESC_ID</b>, or NULL if error.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./cdromFsLib.html#top">cdromFsLib</a></b>, <b><a href="./cdromFsLib.html#cdromFsInit">cdromFsInit</a>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -