dosfslib.html

来自「vxworks相关论文」· HTML 代码 · 共 1,270 行 · 第 1/5 页

HTML
1,270
字号
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/dosFsLib.html - generated by refgen from dosFsLib.c --> <title> dosFsLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>dosFsLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>dosFsLib</strong> - MS-DOS media-compatible file system library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./dosFsLib.html#dosFsConfigGet">dosFsConfigGet</a></i>(&nbsp;)</b>  -  obtain dosFs volume configuration values<br><b><i><a href="./dosFsLib.html#dosFsConfigInit">dosFsConfigInit</a></i>(&nbsp;)</b>  -  initialize dosFs volume configuration structure<br><b><i><a href="./dosFsLib.html#dosFsConfigShow">dosFsConfigShow</a></i>(&nbsp;)</b>  -  display dosFs volume configuration data<br><b><i><a href="./dosFsLib.html#dosFsDateSet">dosFsDateSet</a></i>(&nbsp;)</b>  -  set the dosFs file system date<br><b><i><a href="./dosFsLib.html#dosFsDateTimeInstall">dosFsDateTimeInstall</a></i>(&nbsp;)</b>  -  install a user-supplied date/time function<br><b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>  -  associate a block device with dosFs file system functions<br><b><i><a href="./dosFsLib.html#dosFsDevInitOptionsSet">dosFsDevInitOptionsSet</a></i>(&nbsp;)</b>  -  specify volume options for <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b><br><b><i><a href="./dosFsLib.html#dosFsInit">dosFsInit</a></i>(&nbsp;)</b>  -  prepare to use the dosFs library<br><b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b>  -  initialize a device and create a dosFs file system<br><b><i><a href="./dosFsLib.html#dosFsMkfsOptionsSet">dosFsMkfsOptionsSet</a></i>(&nbsp;)</b>  -  specify volume options for <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b><br><b><i><a href="./dosFsLib.html#dosFsModeChange">dosFsModeChange</a></i>(&nbsp;)</b>  -  modify the mode of a dosFs volume<br><b><i><a href="./dosFsLib.html#dosFsReadyChange">dosFsReadyChange</a></i>(&nbsp;)</b>  -  notify dosFs of a change in ready status<br><b><i><a href="./dosFsLib.html#dosFsTimeSet">dosFsTimeSet</a></i>(&nbsp;)</b>  -  set the dosFs file system time<br><b><i><a href="./dosFsLib.html#dosFsVolOptionsGet">dosFsVolOptionsGet</a></i>(&nbsp;)</b>  -  get current dosFs volume options <br><b><i><a href="./dosFsLib.html#dosFsVolOptionsSet">dosFsVolOptionsSet</a></i>(&nbsp;)</b>  -  set dosFs volume options <br><b><i><a href="./dosFsLib.html#dosFsVolUnmount">dosFsVolUnmount</a></i>(&nbsp;)</b>  -  unmount a dosFs volume<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides services for file-oriented device drivers to use theMS-DOS&reg;  file standard.  This module takes care of all necessarybuffering, directory maintenance, and file system details.<p></blockquote><h4>USING THIS LIBRARY</h4><blockquote><p>The various routines provided by the VxWorks DOS file system (dosFs) may beseparated into three broad groups: general initialization, deviceinitialization, and file system operation.<p>The <b><i><a href="./dosFsLib.html#dosFsInit">dosFsInit</a></i>(&nbsp;)</b> routine is the principal initialization function; it needonly be called once, regardless of how many dosFs devices are to be used.  Inaddition, <b><i><a href="./dosFsLib.html#dosFsDateTimeInstall">dosFsDateTimeInstall</a></i>(&nbsp;)</b> (if used) will typically be called onlyonce, prior to performing any actual file operations, to install auser-supplied routine which provides the current date and time.<p>Other dosFs functions are used for device initialization.  For each dosFsdevice, either <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b> or <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b> must be called to install thedevice and define its configuration.  The <b><i><a href="./dosFsLib.html#dosFsConfigInit">dosFsConfigInit</a></i>(&nbsp;)</b> routine isprovided to easily initialize the data structure used during deviceinitialization; however, its use is optional.<p>Several routines are provided to inform the file system of changesin the system environment.  The <b><i><a href="./dosFsLib.html#dosFsDateSet">dosFsDateSet</a></i>(&nbsp;)</b> and <b><i><a href="./dosFsLib.html#dosFsTimeSet">dosFsTimeSet</a></i>(&nbsp;)</b> routinesare used to set the current date and time; these are normally used only ifno user routine has been installed via <b><i><a href="./dosFsLib.html#dosFsDateTimeInstall">dosFsDateTimeInstall</a></i>(&nbsp;)</b>.  The<b><i><a href="./dosFsLib.html#dosFsModeChange">dosFsModeChange</a></i>(&nbsp;)</b> call may be used to modify the readability orwritability of a particular device.  The <b><i><a href="./dosFsLib.html#dosFsReadyChange">dosFsReadyChange</a></i>(&nbsp;)</b> routine isused to inform the file system that a disk may have been swapped, and thatthe next disk operation should first remount the disk.  Finally,<b><i><a href="./dosFsLib.html#dosFsVolUnmount">dosFsVolUnmount</a></i>(&nbsp;)</b> informs the file system that a particular device shouldbe synchronized and unmounted, generally in preparation for a diskchange.<p>More detailed information on all of these routines is discussed in thefollowing sections.<p></blockquote><h4>INITIALIZING DOSFSLIB</h4><blockquote><p>Before any other routines in <b><a href="./dosFsLib.html#top">dosFsLib</a></b> can be used, the routine <b><i><a href="./dosFsLib.html#dosFsInit">dosFsInit</a></i>(&nbsp;)</b> mustbe called to initialize this library.  This call specifies themaximum number of dosFs files that can be open simultaneously.Attempts to open more dosFs files than the specified maximum will resultin errors from <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> and <b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b>.<p>This initialization is enabled when the configuration macro <b>INCLUDE_DOSFS</b> isdefined; <b><i><a href="./dosFsLib.html#dosFsInit">dosFsInit</a></i>(&nbsp;)</b> is then called from the root task, <b><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>(&nbsp;)</b>,in <b>usrConfig.c</b>.<p></blockquote><h4>DEFINING A DOSFS DEVICE</h4><blockquote><p>To use this library for a particular device, the device descriptorstructure used by the device driver must contain, as the very first item,a block device description structure (<b>BLK_DEV</b>).  This must be initializedbefore calling <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.  In the <b>BLK_DEV</b> structure, the driverincludes the addresses of five routines which it must supply:  one thatreads one or more sectors, one that writes one or more sectors, one thatperforms I/O control on the device (using <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>(&nbsp;)</b>), one that checks thestatus of the device, and one that resets the device.  These routines aredescribed below.  The <b>BLK_DEV</b> structure also contains fields whichdescribe the physical configuration of the device.  For more informationabout defining block devices, see the <i>VxWorks Programmer's Guide: I/O System. </i><p>The <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b> routine associates a device with the <b><a href="./dosFsLib.html#top">dosFsLib</a></b>functions.  It expects three parameters:<dl><dt>(1)<dd>A pointer to a name string, to be used to identify the device.This will be part of the pathname for I/O operations which operate on thedevice.  This name will appear in the I/O system device table, which may bedisplayed using the <b><i><a href="./iosShow.html#iosDevShow">iosDevShow</a></i>(&nbsp;)</b> routine.<p><dt>(2)<dd>A pointer to the <b>BLK_DEV</b> structure which describes the device and contains theaddresses of the five required functions.  The fields in this structuremust have been initialized before the call to <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.<p><dt>(3)<dd>A pointer to a volume configuration structure (<b>DOS_VOL_CONFIG</b>).  Thisstructure contains configuration data for the volume which are specific tothe dosFs file system.  (See "Changes in Volume Configuration", below, for moreinformation.)  The fields in this structure must have been initialized beforethe call to <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.  The <b>DOS_VOL_CONFIG</b> structure may be initializedby using the <b><i><a href="./dosFsLib.html#dosFsConfigInit">dosFsConfigInit</a></i>(&nbsp;)</b> routine. </dl><p>As an example:<pre>    dosFsDevInit        (        char            *volName,     /* name to be used for volume   */        BLK_DEV         *pBlkDev,     /* pointer to device descriptor */        DOS_VOL_CONFIG  *pVolConfig   /* pointer to vol config data   */        )</pre>Once <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b> has been called, when <b><a href="./dosFsLib.html#top">dosFsLib</a></b> receives a requestfrom the I/O system, it calls the device driver routines (whose addresseswere passed in the <b>BLK_DEV</b> structure) to access the device.<p>The <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b> routine is an alternative to using <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.  The<b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b> routine always initializes a new dosFs file system on thedisk; thus, it is unsuitable for disks containing data that should bepreserved.  Default configuration parameters are supplied by <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b>,since no <b>DOS_VOL_CONFIG</b> structure is used.<p>See "Network File System (NFS) Support", below, for additional NFS-relatedparameters you can set before calling <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.<p></blockquote><h4>MULTIPLE LOGICAL DEVICES</h4><blockquote><p>The sector number passed to the driver's sector read and write routines isan absolute number, starting from sector 0 at the beginning of the device.If desired, the driver may add an offset from the beginning of the physicaldevice before the start of the logical device.  This can be done bykeeping an offset parameter in the driver device structure, and addingthe offset to the sector number passed by the file system's read and writeroutines.<p></blockquote><h4>ACCESSING THE RAW DISK</h4><blockquote><p>As a special case in <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> and <b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b> calls, the dosFs file systemrecognizes a null filename as indicating access to the entire "raw" diskrather than to an individual file on the disk.  (To open a devicein raw mode, specify only the device name -- no filename -- during the <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b>or <b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b> call.)<p>Raw mode is the only means of accessing a disk that has no file system.For example, to initialize a new file system on the disk,first the raw disk is opened and the returned file descriptor is usedfor an <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>(&nbsp;)</b> call with FIODISKINIT.Opening the disk in raw mode is also a common operation when doing other<b><i><a href="./ioLib.html#ioctl">ioctl</a></i>(&nbsp;)</b> functions which do not involve a particular file(e.g., FIONFREE, FIOLABELGET).<p>To read the root directory of a disk on which no file names are known,specify the device name when calling <b><i><a href="./dirLib.html#opendir">opendir</a></i>(&nbsp;)</b>.  Subsequent <b><i><a href="./dirLib.html#readdir">readdir</a></i>(&nbsp;)</b>calls will return the names of files and subdirectories in theroot directory.<p>Data written to the disk in raw mode uses the same area on the disk asnormal dosFs files and subdirectories.  Raw I/O does not use the disksectors used for the boot sector, root directory, or File AllocationTable (FAT).  For more information about raw disk I/O using the entiredisk, see the manual entry for rawFsLib.<p></blockquote><h4>DEVICE AND PATH NAMES</h4><blockquote><p>On true MS-DOS machines, disk device names are typically of the form "A:",that is, a single letter designator followed by a colon.  Such names may beused with the VxWorks dosFs file system.  However, it is possible (anddesirable) to use longer, more mnemonic device names, such as "DOS1:",or "/floppy0/".  The name is specified during the <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b> or <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b>call.<p>The pathnames used to specify dosFs files and directories may use eitherforward slashes ("/") or backslashes ("o effect on the directory data written to the disk.  (Note, however, thatforward slashes are not allowed within VxWorks dosFs filenames, althoughthey are normally legal for pure MS-DOS implementations.)<p>When using the VxWorks shell to make calls specifying dosFs pathnames,you must allow for the C-style interpretation which is performed.  Incases where the file name is enclosed in quote marks, any backslashesmust be "escaped" by a second, preceding backslash.  For example:<pre>    -&gt; copy ("DOS1:\\subdir\\file1", "file2")</pre>However, shell commands which use pathnames without enclosing quotes donot require the second backslash.  For example:<pre>    -&gt; copy &lt; DOS1:\subdir\file1</pre>Forward slashes do not present these inconsistencies, and may therefore bepreferable for use within the shell.<p>The leading slash of a dosFs pathname following the device name isoptional.  For example, both "DOS1:newfile.new" and "DOS1:/newfile.new"refer to the same file.<p></blockquote><h4>USING EXTENDED FILE NAMES</h4><blockquote><p>The MS-DOS standard only allows for file names which fit the restrictionsof eight upper-case characters optionally followed by a three-characterextension.  This may not be convenient if you are transferring files to orfrom a remote system, or if your application requires particular filenaming conventions.<p>To provide additional flexibility, the dosFs file system provides anoption to use longer, less restricted file names.  When this option isenabled, file names may consist of any sequence of up to 40 ASCIIcharacters.  No case conversion is performed and no characters have anyspecial significance.<p></blockquote><h4>NOTE</h4><blockquote><p>Because special directory entries are used on the disk, disks which use the extended names are <i>not</i> compatible with true MS-DOS systems and cannot be read on MS-DOS machines.  Disks which use the extended name option must be initialized by the VxWorks dosFs file system (using FIODISKINIT); disks which have been initialized (software-formatted) on MS-DOS systems cannot be used.<p>To enable the extended file names, set the <b>DOS_OPT_LONGNAMES</b> bit in the <b>dosvc_options</b> field in the <b>DOS_VOL_CONFIG</b> structure when calling <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b>.  (The <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b> routine may also be used to enable extendedfile names; however, the <b>DOS_OPT_LONGNAMES</b> option must already have been specified in a previous call to <b><i><a href="./dosFsLib.html#dosFsMkfsOptionsSet">dosFsMkfsOptionsSet</a></i>(&nbsp;)</b>.)<p></blockquote><h4>NETWORK FILE SYSTEM (NFS) SUPPORT</h4><blockquote><p>To enable the export of a file system, the <b>DOS_OPT_EXPORT</b> option must beset when initializing the device via <b><i><a href="./dosFsLib.html#dosFsDevInit">dosFsDevInit</a></i>(&nbsp;)</b> or <b><i><a href="./dosFsLib.html#dosFsMkfs">dosFsMkfs</a></i>(&nbsp;)</b>.This option may also be made the default for use with disks when noexplicit configuration is given.  See the manual entry for <b><i><a href="./dosFsLib.html#dosFsDevInitOptionsSet">dosFsDevInitOptionsSet</a></i>(&nbsp;)</b>.<p>If the remote client that will be mounting the dosFs volume is a

⌨️ 快捷键说明

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