⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c-filesys2.html

📁 this about vxworks operations systems
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<div class="CellBody"><a name="84943"> </a>0xFC&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84945"> </a>0xFF&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84947"> </a>0xFD&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84949"> </a>0xF9&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84951"> </a>0xF9&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84953"> </a>0xF0&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellHeading"><b><a name="84955"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">secPerFat</font></b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84957"> </a>1&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84959"> </a>2&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84961"> </a>1&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84963"> </a>2&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84965"> </a>7&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84967"> </a>3&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84969"> </a>9&nbsp;</div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellHeading"><b><a name="84971"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">nHidden</font></b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84973"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84975"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84977"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84979"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84981"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84983"> </a>0&nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84986"> </a>0<b><i></i></b>&nbsp;</div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84988">4.2.5  &nbsp;&nbsp;Changes In Volume Configuration</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84990"> </a>As mentioned previously, various disk configuration parameters are specified when the dosFs file system device is first initialized using <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b>. These parameters are kept in the volume descriptor, <b class="symbol_UC">DOS_VOL_DESC</b>, for the device. However, it is possible for a disk with different parameter values to be placed in a drive after the device is already initialized. If another disk is substituted for the one with the configuration parameters that were last entered into the volume descriptor, the configuration parameters of the new disk must be obtained before it can be used.</p><dd><p class="Body"><a name="84993"> </a>When a disk is mounted, the boot sector information is read from the disk. This data is used to update the configuration data in the volume descriptor. Note that this happens the first time the disk is accessed, and again after the volume is unmounted (using <b class="routine"><i class="routine">dosFsVolUnmount</i></b><b>(&nbsp;)</b>) or a ready-change operation is performed. For more information, see <a href="c-filesys2.html#85264"><i class="title">4.2.17&nbsp;Changing Disks</i></a>.</p><dd><p class="Body"><a name="84997"> </a>This automatic re-initialization of the configuration data has an important implication. The volume descriptor data is used when initializing a disk (with <b class="symbol_UC">FIODISKINIT</b>); thus, the disk is initialized with the configuration of the most recently mounted disk, regardless of the original specification during <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b>. Therefore, we recommend that you use <b class="symbol_UC">FIODISKINIT</b> immediately after <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b>, before any disk is mounted. (The device is opened in raw mode, the <b class="symbol_UC">FIODISKINIT</b><b class="routine"><i class="routine"> ioctl</i></b><b>(&nbsp;)</b> function is performed, and the device is closed.)</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85002">4.2.6  &nbsp;&nbsp;Using an Already Initialized Disk</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85003"> </a>If you are using a disk that is already initialized with an MS-DOS boot sector, FAT, and root directory (for example, by using the FORMAT utility in MS-DOS), it is not necessary to provide the volume configuration data during <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b>.</p><dd><p class="Body"><a name="85004"> </a>You can omit the MS-DOS configuration data by specifying a <b class="symbol_UC">NULL</b> pointer instead of the address of a <b class="symbol_UC">DOS_VOL_CONFIG</b> structure during <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b>. However, only use this method if you are sure that the first use of the volume is with a properly formatted and initialized disk. </p><dd><p class="Body"><a name="85005"> </a>When mounting an already initialized disk, all standard MS-DOS configuration values are obtained from the disk's boot sector. However, the options that are specific to dosFs must be determined differently.</p><dd><p class="Body"><a name="85006"> </a>Disks that are already initialized with the<b class="symbol_UC"> DOS_OPT_LONGNAMES</b> (case-sensitive file names not restricted to 8.3 convention) option are recognized automatically by a specific volume ID string that is placed in the boot sector.</p><dd><p class="Body"><a name="85007"> </a>The <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b>, <b class="symbol_UC">DOS_OPT_AUTOSYNC</b>, <b class="symbol_UC">DOS_OPT_LOWERCASE</b>, and <b class="symbol_UC">DOS_OPT_EXPORT</b> options are recorded only in memory, not on disk. Therefore they cannot be detected when you initialize a disk with <b class="symbol_UC">NULL</b> in place of the <b class="symbol_UC">DOS_VOL_CONFIG</b> structure pointer; you must re-enable them each time you mount a disk. You can set default values for these options with the <b class="routine"><i class="routine">dosFsDevInitOptionsSet</i></b><b>(&nbsp;)</b>routine: the defaults apply to any dosFs file systems you initialize with <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b> thereafter, unless you supply explicit <b class="symbol_UC">DOS_VOL_CONFIG</b> information. </p><dd><p class="Body"><a name="85008"> </a>You can also enable the <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> and <b class="symbol_UC">DOS_OPT_AUTOSYNC</b> options dynamically during disk operation, rather than during initialization, with the <b class="routine"><i class="routine">dosFsVolOptionsSet</i></b><b>(&nbsp;)</b> routine.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85010">4.2.7  &nbsp;&nbsp;Accessing Volume Configuration Information</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85019"> </a>Disk configuration information is available using <b class="routine"><i class="routine">dosFsConfigShow</i></b><b>(&nbsp;)</b><sup><a href="#foot"><b class="FootnoteMarker">2</b></a></sup> and <b class="routine"><i class="routine">dosFsConfigGet</i></b><b>(&nbsp;)</b> from the Tornado shell. See the <i class="title">Tornado User's Guide: Shell</i>.</p><dd><p class="Body"><a name="85020"> </a>Use <b class="routine"><i class="routine">dosFsConfigShow</i></b><b>(&nbsp;)</b> to display configuration information such as the largest contiguous area and the device name. For example:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="85021">    </b><tt class="output">-&gt;</tt><b> dosFsConfigShow "/RAM1/"     </b><tt class="output">value = 0 = 0x0</tt><b></a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="85023"> </a>The output is sent to the standard output device, and looks like the following:</p></dl><dl class="margin"><dd><pre class="Code"><b><a name="85024"></b><tt class="output">    device&nbsp;name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/RAM1/     total&nbsp;number&nbsp;of&nbsp;sectors:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;400     bytes&nbsp;per&nbsp;sector:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;512     media&nbsp;byte:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0xf0     #&nbsp;of&nbsp;sectors&nbsp;per&nbsp;cluster:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2     #&nbsp;of&nbsp;reserved&nbsp;sectors:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1     #&nbsp;of&nbsp;FAT&nbsp;tables:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2     #&nbsp;of&nbsp;sectors&nbsp;per&nbsp;FAT:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1      max&nbsp;#&nbsp;of&nbsp;root&nbsp;dir&nbsp;entries:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;112     #&nbsp;of&nbsp;hidden&nbsp;sectors:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0     removable&nbsp;medium:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FALSE     disk&nbsp;change&nbsp;w/out&nbsp;warning:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not enabled     auto-sync&nbsp;mode:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not enabled     long&nbsp;file&nbsp;names:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not enabled     exportable file system:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not enabled     volume&nbsp;mode:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;O_RDWR&nbsp;(read/write) </tt><b>    available space:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;199680 bytes     max avail. contig space:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;199680 bytes</a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="87070"> </a>The <b class="routine"><i class="routine">dosFsConfigGet</i></b><b>(&nbsp;)</b> routine stores the disk configuration information in a <b class="symbol_UC">DOS_VOL_CONFIG</b> structure. This can be useful if you have a pre-existing disk and want to initialize a new disk with the same parameters, or if you initialized the dosFs file system on the disk using <b class="routine"><i class="routine">dosFsMkfs</i></b><b>(&nbsp;)</b> and need to obtain the actual configuration values that were <b></b>calculated.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="87074">4.2.8  &nbsp;&nbsp;Mounting Volumes</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="87075"> </a>A disk volume is <i class="term">mounted</i> automatically, generally during the first <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b> or <b class="routine"><i class="routine">creat</i></b><b>(&nbsp;)</b> operation for a file or directory on the disk. (Certain <b class="routine"><i class="routine">ioctl</i></b><b>(&nbsp;)</b> calls also cause the disk to be mounted.) If a NULL pointer is specified instead of the address of a <b class="symbol_UC">DOS_VOL_CONFIG</b> structure during the <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b> call, the disk is mounted immediately to obtain the configuration values.</p><dd><p class="Body"><a name="85049"> </a>When a disk is mounted, the boot sector, FAT, and directory data are read from the disk. The volume descriptor, <b class="symbol_UC">DOS_VOL_DESC</b>, is updated to reflect the configuration of the newly mounted disk. </p><dd><p class="Body"><a name="85050"> </a>Automatic mounting occurs on the first file access following <b class="routine"><i class="routine">dosFsVolUnmount</i></b><b>(&nbsp;)</b>or a ready-change operation (see <a href="c-filesys2.html#85264"><i class="title">4.2.17&nbsp;Changing Disks</i></a>), or periodically if the disk is defined during the <b class="routine"><i class="routine">dosFsDevInit</i></b><b>(&nbsp;)</b> call with the option <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> set. Automatic mounting does not occur when a disk is opened in raw mode; see <a href="c-filesys2.html#85065"><i class="title">4.2.10&nbsp;Opening the Whole Device (Raw Mode)</i></a>.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="86867"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>Because device names are recognized by the I/O system using simple substring matching, file systems should not use a slash (<b>/</b>) alone as a name; unexpected results may occur. </div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="85058"> </a>It is possible to mount a volume with <b class="routine"><i class="routine">usrFdConfig</i></b><b>(&nbsp;)</b>, but this routine does not return the <b class="symbol_UC">DOS_VOL_DESC </b>structure. A volume mounted with <b class="routine"><i class="routine">usrFdConfig</i></b><b>(&nbsp;)</b> can not be operated on with most dosFs commands, including <b class="routine"><i class="routine">dosFsVolUnmount</i></b><b>(&nbsp;)</b>. However, the dosFs <b class="routine"><i class="routine">ioctl</i></b><b>(&nbsp;)</b> commands, including <b class="symbol_UC">FIOUNMOUNT</b>, access the volume information through the <i class="acronym_lc">fd</i>, so they can be used with <b class="routine"><i class="routine">usrFdConfig</i></b><b>(&nbsp;)</b>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="87023">4.2.9  &nbsp;&nbsp;File I/O</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85059"> </a>Files on a dosFs file system device are created, deleted, written, and read using the standard VxWorks I/O routines: <b class="routine"><i class="routine">creat</i></b><b>(&nbsp;)</b>, <b class="routine"><i class="routine">remove</i></b><b>(&nbsp;)</b>, <b class="routine"><i class="routine">write</i></b><b>(&nbsp;)</b>, and <b class="routine"><i class="routine">read</i></b><b>(&nbsp;)</b>. See <a href="c-iosys3.html#83659"><i class="title">3.3&nbsp;Basic I/O</i></a> for more information.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="85065">4.2.10  &nbsp;&nbsp;Opening the Whole Device (Raw Mode)</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85066"> </a>It is possible to open an entire dosFs volume. This is done by specifying only the device name during the <b class="routine"><i class="routine">open</i></b><b>(&nbsp;)</b> or <b class="routine"><i class="routine">creat</i></b><b>(&nbsp;)</b> call. A file descriptor is returned, as when a regular file is opened; however, operations on that file descriptor affect the en

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -