📄 c-filesys2.html
字号:
<div class="CellHeading"><b><a name="84665"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Option</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeadingC" align="center"><a name="84667"> </a><b><font face="Helvetica, sans-serif" size="-1" class="sans">Hex Value</font></b></div></th><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84669"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Description</font></b></div></th></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84672"> </a><b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> </div></td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84674"> </a>0x1</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84676"> </a>Disk may be changed without warning. </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84679"> </a><b class="symbol_UC">DOS_OPT_AUTOSYNC</b> </div></td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84681"> </a>0x2</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84683"> </a>Synchronize disk during I/O. </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84686"> </a><b class="symbol_UC">DOS_OPT_LONGNAMES</b> </div></td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84688"> </a>0x4</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84690"> </a>Use case-sensitive file names not restricted to 8.3 convention. </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84693"> </a><b class="symbol_UC">DOS_OPT_EXPORT</b> </div></td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84695"> </a>0x8</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84697"> </a>Allow exporting using NFS. </div></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84700"> </a><b class="symbol_UC">DOS_OPT_LOWERCASE</b> </div></td><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84702"> </a>0x40</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84704"> </a>Use lower case filenames on disk. </div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p><dd><p class="Body"><a name="84705"> </a>The first two options specify the action used to synchronize the disk buffers with the physical device. The remaining options involve extensions to dosFs capabilities. </p></dl><dl class="margin"><dd><div class="Item"><a name="84707"> </a><b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84708"> </a>Set this option if the device is a disk that can be replaced without being unmounted or having its change in ready-status declared. In this situation, check the disk regularly to determine whether it has changed. This causes significant overhead; thus, we recommend that you provide a mechanism that always synchronizes and unmounts a disk before it is removed, or at least announces a change in ready-status. If such a mechanism is in place, or if the disk is not removable, do not set this option. Auto-sync mode is enabled automatically when <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> is set (see the description for <b class="symbol_UC">DOS_OPT_AUTOSYNC</b>, next). For more information on <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b>, see <a href="c-filesys2.html#85264"><i class="title">4.2.17 Changing Disks</i></a>.</div><br></dl></dl><dd><div class="Item"><a name="84713"> </a><b class="symbol_UC">DOS_OPT_AUTOSYNC</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84714"> </a>Set this option to assure that directory and FAT data in the disk's buffers are written to the physical device as soon as possible after modification, rather than only when the file is closed. This can be desirable in situations where it is important that data be stored on the physical medium as soon as possible so as to avoid loss in the event of a system crash. There is a significant performance penalty incurred when using auto-sync mode; limit its use, therefore, to circumstances where there is a threat to data integrity. </div><br><dd><div class="Indent2"><a name="84715"> </a>However, <b class="symbol_UC">DOS_OPT_AUTOSYNC</b> does not make dosFs automatically write data to disk immediately after every <b class="routine"><i class="routine">write</i></b><b>( )</b>; doing so implies an extreme performance penalty. If your application requires this effect, use the <b class="routine"><i class="routine">ioctl</i></b><b>( )</b>function <b class="symbol_UC">FIOFLUSH</b> after every call to <b class="routine"><i class="routine">write</i></b><b>( )</b>.</div><br><dd><div class="Indent2"><a name="84716"> </a>Note that auto-sync mode is automatically enabled whenever <b class="symbol_UC">DOS_OPT_CHANGENOWARN</b> is set. For more information on auto-sync mode, see <a href="c-filesys2.html#85264"><i class="title">4.2.17 Changing Disks</i></a>.</div><br></dl></dl><dd><div class="Item"><a name="84721"> </a><b class="symbol_UC">DOS_OPT_LONGNAMES</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84722"> </a>Set this option to allow the use of case-sensitive file names, with name lengths not restricted to MS-DOS's 8.3 convention. For more information on this option, see <a href="c-filesys2.html#85344"><i class="title">4.2.18 Long Name Support</i></a>.</div><br></dl></dl><dd><div class="Item"><a name="84727"> </a><b class="symbol_UC">DOS_OPT_EXPORT </b></div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84728"> </a>Set this option to initialize file systems that you intend to export using NFS. With this option, dosFs initialization creates additional in-memory data structures that are required to support the NFS protocol. While this option is necessary to initialize a file system that can be exported, it does not actually export the file system. See <i class="title">VxWorks Network Programmer's Guide: File Access Applications</i>.</div><br></dl></dl><dd><div class="Item"><a name="84730"> </a><b class="symbol_UC">DOS_OPT_LOWERCASE</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84731"> </a>Set this option to force filenames created by dosFs to use lowercase alphabetical characters. (Normally, filenames are created using uppercase characters, unless the <b class="symbol_UC">DOS_OPT_LONGNAMES</b> option is enabled.) This option may be required if the dosFs volume is mounted by a PC-based NFS client. This option has no effect if <b class="symbol_UC">DOS_OPT_LONGNAMES</b> is also specified.</div><br></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84733">Calculating Configuration Values</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84734"> </a>The values for <b class="symbol_lc">dosvc_secPerClust</b> and <b class="symbol_lc">dosvc_secPerFat</b> in the <b class="symbol_UC">DOS_VOL_CONFIG </b>structure must be calculated based on the particular device being used.</p></dl><dl class="margin"><dd><div class="Item"><a name="84736"> </a><b class="symbol_lc">dosvc_secPerClust</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84737"> </a>This field specifies how many contiguous disk sectors make up a single cluster. Because a cluster is the smallest amount of disk space that can be allocated at a time, the size of a cluster determines how finely the disk allocation can be controlled. A large number of sectors per cluster causes more sectors to be allocated at a time and reduces the overall efficiency of disk space usage. For this reason, it is generally preferable to use the smallest possible number of sectors per cluster, although having less than two sectors per cluster is generally not necessary.</div><br><dd><div class="Indent2"><a name="84738"> </a>The maximum size of a FAT entry is 16 bits; thus, there is a maximum of 65,536 (64KB, or 0x10000) clusters that can be described. This is therefore the maximum number of clusters for a device. To determine the appropriate number of sectors per cluster, divide the total number of sectors on the disk (the <b class="symbol_lc">bd_nBlocks</b> field in the device's <b class="symbol_UC">BLK_DEV</b> structure) by 0x10000 (64KB). Round up the resulting value to the next whole number. The final result is the number of sectors per cluster; place this value in the <b class="symbol_lc">dosvc_secPerClust</b> field in the <b class="symbol_UC">DOS_VOL_CONFIG</b> structure.</div><br></dl></dl><dd><div class="Item"><a name="84741"> </a><b class="symbol_lc">dosvc_secPerFat</b> </div><dl class="margin"><dl class="margin"><dd><div class="Indent2"><a name="84742"> </a>This field specifies the number of sectors required on the disk for each copy of the FAT. To calculate this value, first determine the total number of clusters on the disk. The total number of clusters is equal to the total number of sectors (<b class="symbol_lc">bd_nBlocks</b> in the <b class="symbol_UC">BLK_DEV</b> structure) divided by the number of sectors per cluster. As mentioned previously, the maximum number of clusters on a disk is 64KB.</div><br><dd><div class="Indent2"><a name="84743"> </a>The cluster count must then be multiplied by the size of each FAT entry: if the total number of clusters is 4085 or less, each FAT entry requires 12 bits (11\xda 2 bytes); if the number of clusters is greater than 4085, each FAT entry requires 16 bits (2 bytes). The result of this multiplication is the total number of bytes required by each copy of the FAT. This byte count is then divided by the size of each sector (the <b class="symbol_lc">bd_bytesPerBlk</b> field in the <b class="symbol_UC">BLK_DEV</b> structure) to determine the number of sectors required for each FAT copy; if there is any remainder, add one (1) to the result. Place this final value in the <b class="symbol_lc">dosvc_secPerFat</b> field.</div><br><dd><div class="Indent2"><a name="84744"> </a>Assuming 512-byte sectors, the largest possible FAT (with entries describing 64KB clusters) occupies 256 sectors per copy, calculated as follows:<img class="figure" border="0" src="images/c-filesysa2.gif"></div><br></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="84754">Standard Disk Configurations</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84755"> </a>For floppy disks, a number of standard disk configurations are used in MS-DOS systems. In general, these are uniquely identified by the media-descriptor byte value (at least for a given size of floppy disk), although some manufacturers have used duplicate values for different formats. Some widely used configurations are summarized in <a href="c-filesys2.html#84763">Table 4-3</a>.</p><dd><p class="Body"><a name="84759"> </a>Fixed disks do not use standard disk configurations because they are rarely attached to a foreign system. Usually fixed disks use a media format byte of 0xF8.<p class="table"><h4 class="EntityTitle"><a name="84763"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 4-3: MS-DOS Floppy Disk Configurations</font></a></h4><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellHeading"><b><a name="84779"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Capacity</font></b></div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84781"> </a>160KB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84783"> </a>180KB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84785"> </a>320KB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84787"> </a>360KB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84789"> </a>1.2MB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84791"> </a>720KB </div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="84793"> </a>1.44MB </div></td></tr><tr valign="top">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -