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

📄 dosfslib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<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.htm"><i>VxWorks API Reference :  OS 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><a href="./dosFsLib.html#dosSetVolCaseSens">dosSetVolCaseSens</a>(&nbsp;)</b>  -  set case sensitivity of volume<br><b><a href="./dosFsLib.html#dosFsVolDescGet">dosFsVolDescGet</a>(&nbsp;)</b>  -  convert a device name into a DOS volume descriptor pointer.<br><b><a href="./dosFsLib.html#dosFsChkDsk">dosFsChkDsk</a>(&nbsp;)</b>  -  make volume integrity checking.<br><b><a href="./dosFsLib.html#dosFsLastAccessDateEnable">dosFsLastAccessDateEnable</a>(&nbsp;)</b>  -  enable last access date updating for this volume<br><b><a href="./dosFsLib.html#dosFsLibInit">dosFsLibInit</a>(&nbsp;)</b>  -  prepare to use the dosFs library<br><b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b>  -  create file system device.<br><b><a href="./dosFsLib.html#dosFsShow">dosFsShow</a>(&nbsp;)</b>  -  display dosFs volume configuration data.<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library implements the MS-DOS compatible file system.This is a multi-module library, which depends on sub-modules toperform certain parts of the file system functionality.A number of different file system format variations are supported.<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><a href="./dosFsLib.html#dosFsLibInit">dosFsLibInit</a>(&nbsp;)</b> routine is the principal initialization function; it shouldbe called once during system initialization, regardless of how many dosFsdevices are to be used.<p>Another dosFs routine is used for device initialization. For each dosFs device, <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> must be called to install thedevice in VxWorks device list.In the case where partitioned disks are used, <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> must becalled for each partition that is anticipated, thereby it is associatedwith a logical device name, so it can be later accessed via the I/Osystem.<p>In case of a removable disk, <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> must be called duringsystem initialization time, even if a cartridge or diskette may beabsent from the drive at boot time. <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> will onlyassociate the device with a logical device name. Device access will bedone only when the logical device is first accessed by the application.<p>More detailed information on all of these routines is provided below.<p></blockquote><h4>INITIALIZING DOSFSLIB</h4><blockquote><p>To enable this file system in a particular VxWorks configuration,a library initialization routine must be called for each sub-module ofthe file system, as well as for the underlying disk cache, partitionmanager and drivers.This is usually done at system initialization time, within the <i>usrRoot </i>task context.<p>Following is the list of initialization routines that need to becalled:<dl><dt>dosFsLibInit<dd>(mandatory) initialize the principle dosFs module. Must be called first.<dt>dosFsFatInit<dd>(mandatory) initialize the File Allocation Table handler, which supports12-bit, 16-bit and 32-bit FATs.<dt>dosVDirLibInit<dd>(choice) install the variable size directory handlersupporting Windows-compatible Long File Names (VFAT) DirectoryHandler.<dt>dosDirOldLibInit<dd>(choice) install the fixed size  directory handlerwhich supports old-fashioned 8.3MS-DOS file names, and Wind River Systems proprietary long file names(VXLONG).<dt>dosFsFmtLibInit<dd>(optional) install the volume formatting module.<dt>dosChkLibInit<dd>(optional) install the file system consistency checking module.</dl>The two Directory handlers which are marked<i>choice </i>are installed in accordance with the system requirements, either oneof these modules could be installed or both, in which case the VFAT willtake precedence for MS-DOS compatible volumes.<p>Also, at least one<i>CBIO </i>module must be initialized on a per-device basis prior to calling<b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b>.See the related documentation for more details and examples.<p></blockquote><h4>DEFINING A DOSFS DEVICE</h4><blockquote><p>The <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&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 - logicaldevice name.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><a href="./iosShow.html#iosDevShow">iosDevShow</a>(&nbsp;)</b> routine.<dt>(2)<dd><b>CBIO_DEV_ID</b> - a pointer to the <b>CBIO_DEV</b> structure which provides interfaceto particular disk, via a disk cache, or a partition manager or acombination of a number of<i>CBIO </i>modules which are stacked on top of each other to form one of manyconfigurations possible.<dt>(3)<dd>A maximum number of files can be simultaneously opened on a particular device.<dt>(4)<dd>Because volume integrity check utility can be automaticallyinvoked every time a device is mounted,this parameter indicates whether the consistency check needs to beperformed automatically on a given device, and on what level ofverbosity is required.In any event, the consistency check may be invoked at a later timee.g. by calling <b><a href="./usrFsLib.html#chkdsk">chkdsk</a>(&nbsp;)</b>.See description for FIOCHKDSK ioctl command for more information.</dl>For example:<pre>    dosFsDevCreate        (        "/sd0",         /* name to be used for volume   */        pCbio,          /* pointer to device descriptor */        10,             /* max no. of simultaneously open files */        DOS_CHK_REPAIR | DOS_CHK_VERB_1                        /* check volume during mounting and repair */                        /* errors, and display volume statistics */        )</pre>Once <b><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> has been called, the device can be accessedusing <i><b><a href="./ioLib.html#top">ioLib</a></b> </i>generic I/O routines: <b><a href="./ioLib.html#open">open</a>(&nbsp;)</b>, <b><a href="./ioLib.html#read">read</a>(&nbsp;)</b>, <b><a href="./ioLib.html#write">write</a>(&nbsp;)</b>, <b><a href="./ioLib.html#close">close</a>(&nbsp;)</b>,<b><a href="./ioLib.html#ioctl">ioctl</a>(&nbsp;)</b>, <b><a href="./ioLib.html#remove">remove</a>(&nbsp;)</b>. Also, the user-level utility functions may be used toaccess the device at a higher level (See <b><a href="./usrFsLib.html#top">usrFsLib</a></b> reference page formore details).<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><a href="./dosFsLib.html#dosFsDevCreate">dosFsDevCreate</a>(&nbsp;)</b> call.<p>The pathnames used to specify dosFs files and directories may use eitherforward slashes ("/") or backslashes ("freely mixed.  The choice of forward slashes or backslashes has absolutelyno 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>For the sake of consistency however use of forward slashes ("/") isrecommended at all times.<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 DIRECTORY STRUCTURE</h4><blockquote><p>This library supports DOS4.0 standard file names which fit the restrictionsof eight upper-case characters optionally followed by a three-characterextension,as well as Windows style VFAT standard long file namesthat are stored mixed cased on disk, but are case insensitive whensearched and matched (e.g. during <b><a href="./ioLib.html#open">open</a>(&nbsp;)</b> call).The VFAT long file name is stored in a variable number of consecutivedirectory entries.Both standards restrict file size to 4 GB (32 bit value).<p>To provide additional flexibility, this implementation of theDOS file system provides proprietary ling file name format (VXLONGNAMES),which uses a simpler directory structure: the directory entry isof fixed size.  When this option isused, file names may consist of any sequence of up to 40 ASCIIcharacters.  No case conversion is performed, and file name match is case-sensitive.With this directory format thefile maximum size is expanded to 1 Terabyte (40 bit value).<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 other implementation of theMS-DOS systems, and cannot be read on MS-DOS or Windows machines.<p>To enable the extended file names, set the <b>DOS_OPT_VXLONGNAMES</b> flag when calling <b><a href="./dosFsFmtLib.html#dosFsVolFormat">dosFsVolFormat</a>(&nbsp;)</b>.<p></blockquote><h4>READING DIRECTORY ENTRIES</h4><blockquote><p>Directories on VxWorks dosFs volumes may be searched using the <b><a href="./dirLib.html#opendir">opendir</a>(&nbsp;)</b>,<b><a href="./dirLib.html#readdir">readdir</a>(&nbsp;)</b>, <b><a href="./dirLib.html#rewinddir">rewinddir</a>(&nbsp;)</b>, and <b><a href="./dirLib.html#closedir">closedir</a>(&nbsp;)</b> routines.  These calls allow thenames of files and subdirectories to be determined.<p>To obtain more detailed information about a specific file, use the <b><a href="./dirLib.html#fstat">fstat</a>(&nbsp;)</b>or <b><a href="./dirLib.html#stat">stat</a>(&nbsp;)</b> routine.  Along with standard file information, the structureused by these routines also returns the file attribute byte from a dosFsdirectory entry.<p>For more information, see the manual entry for <b><a href="./dirLib.html#top">dirLib</a></b>.<p></blockquote><h4>FILE DATE AND TIME</h4><blockquote><p>Directory entries on dosFs volumes contain creation, last modificationtime and date, and the last access date for each file or subdirectory.Directory last modification time and date fields are set only when a new entry is created, but not when any directory entries are deleted.The last access date field indicates the date of the last read or write.  The last access date field is an optional field, per Microsoft.  By default, file open-read-close operations do not update the last access date field.  This default avoids media writes (writing out the date field)during read only operations.   In order to enable the updating of the optional last access date field for open-read-close operations, you must call <b><a href="./dosFsLib.html#dosFsLastAccessDateEnable">dosFsLastAccessDateEnable</a>(&nbsp;)</b>, passing it the volumes <b>DOS_VOLUME_DESC_ID</b> and TRUE.<p>The dosFs file system uses the ANSI <b><a href="./ansiTime.html#time">time</a>(&nbsp;)</b> function, that returnssystem clock value to obtain date and time.  It is recommended that thetarget system should set the system time during system initializationtime from a network server or from an embedded Calendar / Clockhardware component, so that all files on the file system would beassociated with a correct date and time.<p>The file system consistency checker (see below) sets system clock tovalue following the latest date-time field stored on the disk, if itdiscovers, that function <b><a href="./ansiTime.html#time">time</a>(&nbsp;)</b> returns a date earlier then Jan 1,1998, meaning that the target system does not have a source of validdate and time to synchronize with.<p>See also the reference manual entry for ansiTime.<p></blockquote><h4>FILE ATTRIBUTES</h4><blockquote><p>Directory entries on dosFs volumes contain an attribute byte consistingof bit-flags which specify various characteristics of the entry.  Theattributes which are identified are:  read-only file, hidden file,system file, volume label, directory, and archive.  The VxWorks symbolsfor these attribute bit-flags are:<p><dl><dt><b>DOS_ATTR_RDONLY</b><dd>File is write-protected, can not be modified or deleted.<dt><b>DOS_ATTR_HIDDEN</b><dd>this attribute is not used by VxWorks.<dt><b>DOS_ATTR_SYSTEM</b><dd>this attribute is not used by VxWorks.<dt><b>DOS_ATTR_VOL_LABEL</b><dd>directory entry describes a volume label,this attribute can not be set or used directly, see <b><a href="./ioLib.html#ioctl">ioctl</a>(&nbsp;)</b> commandFIOLABELGET and FIOLABELSET below for volume label manipulation.<dt><b>DOS_ATTR_DIRECTORY</b><dd>directory entry is a subdirectory,this attribute can not be set directly.<dt><b>DOS_ATTR_ARCHIVE</b><dd>this attribute is not used by VxWorks.<p></dl>All the flags in the attribute byte, except the directory and volume labelflags, may be set or cleared using the <b><a href="./ioLib.html#ioctl">ioctl</a>(&nbsp;)</b> FIOATTRIBSET function.  Thisfunction is called after opening the specific file whose attributes are tobe changed.  The attribute byte value specified in the FIOATTRIBSET call iscopied directly.  To preserve existing flag settings, the current attributesshould first be determined via <b><a href="./dirLib.html#fstat">fstat</a>(&nbsp;)</b>, and the appropriateflag(s) changed using bitwise AND or OR operations.  For example, to makea file read-only, while leaving other attributes intact:<p><pre>    struct stat fileStat;    fd = open ("file", O_RDONLY, 0);     /* open file          */    fstat (fd, &amp;fileStat);               /* get file status    */    ioctl (fd, FIOATTRIBSET, (fileStat.st_attrib | DOS_ATTR_RDONLY));                                         /* set read-only flag */    close (fd);                          /* close file         */</pre><p>See also the reference manual entry for <b><a href="./usrFsLib.html#attrib">attrib</a>(&nbsp;)</b> and <b><a href="./usrFsLib.html#xattrib">xattrib</a>(&nbsp;)</b> foruser-level utility routines which control the attributes of files orfile hierarchy.<p></blockquote><h4>CONTIGOUS FILE SUPPORT</h4><blockquote><p>The VxWorks dosFs file system provides efficient files storage:space will be allocated in groups of clusters (also termed <i>extents </i>) so that a file will be composed of relatively large contiguous units.This  nearly contiguous allocation technique is designed toeffectively eliminate the effects of disk space fragmentation,keeping throughput very close to the maximum of which the hardware iscapable of.<p>However dosFs provides mechanism to allocate truly contiguous files,meaning files which are made up of a consecutive series of disk sectors.This support includes both the ability to allocate contiguous space to a fileand optimized access to such a file when it is used.Usually this will somewhat improve performance when compared toNearly Contiguous allocation, at the price of disk space fragmentation.<p>To allocate a contiguous area to a file, the file is first created in thenormal fashion, using <b><a href="./ioLib.html#open">open</a>(&nbsp;)</b> or <b><a href="./ioLib.html#creat">creat</a>(&nbsp;)</b>.  The file descriptor returnedduring the creation of the file is then used to make an <b><a href="./ioLib.html#ioctl">ioctl</a>(&nbsp;)</b> call,specifying the FIOCONTIG or FIOCONTIG64 function.The last parameter to the FIOCONTIG function is the size of the requestedcontiguous area in bytes, If the FIOCONTIG64 is used, the last parameteris pointer to 64-bit integer variable, which contains the required file size.

⌨️ 快捷键说明

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