VxWorks API Reference : OS Libraries
dosFsLib - MS-DOS media-compatible file system library
dosSetVolCaseSens( ) - set case sensitivity of volume
dosFsVolDescGet( ) - convert a device name into a DOS volume descriptor pointer.
dosFsChkDsk( ) - make volume integrity checking.
dosFsLastAccessDateEnable( ) - enable last access date updating for this volume
dosFsLibInit( ) - prepare to use the dosFs library
dosFsDevCreate( ) - create file system device.
dosFsShow( ) - display dosFs volume configuration data.
This library implements the MS-DOS compatible file system. This is a multi-module library, which depends on sub-modules to perform certain parts of the file system functionality. A number of different file system format variations are supported.
The various routines provided by the VxWorks DOS file system (dosFs) may be separated into three broad groups: general initialization, device initialization, and file system operation.
The dosFsLibInit( ) routine is the principal initialization function; it should be called once during system initialization, regardless of how many dosFs devices are to be used.
Another dosFs routine is used for device initialization. For each dosFs device, dosFsDevCreate( ) must be called to install the device in VxWorks device list. In the case where partitioned disks are used, dosFsDevCreate( ) must be called for each partition that is anticipated, thereby it is associated with a logical device name, so it can be later accessed via the I/O system.
In case of a removable disk, dosFsDevCreate( ) must be called during system initialization time, even if a cartridge or diskette may be absent from the drive at boot time. dosFsDevCreate( ) will only associate the device with a logical device name. Device access will be done only when the logical device is first accessed by the application.
More detailed information on all of these routines is provided below.
To enable this file system in a particular VxWorks configuration, a library initialization routine must be called for each sub-module of the file system, as well as for the underlying disk cache, partition manager and drivers. This is usually done at system initialization time, within the usrRoot task context.
Following is the list of initialization routines that need to be called:
The two Directory handlers which are marked choice are installed in accordance with the system requirements, either one of these modules could be installed or both, in which case the VFAT will take precedence for MS-DOS compatible volumes.
- dosFsLibInit
- (mandatory) initialize the principle dosFs module. Must be called first.
- dosFsFatInit
- (mandatory) initialize the File Allocation Table handler, which supports 12-bit, 16-bit and 32-bit FATs.
- dosVDirLibInit
- (choice) install the variable size directory handler supporting Windows-compatible Long File Names (VFAT) Directory Handler.
- dosDirOldLibInit
- (choice) install the fixed size directory handler which supports old-fashioned 8.3 MS-DOS file names, and Wind River Systems proprietary long file names (VXLONG).
- dosFsFmtLibInit
- (optional) install the volume formatting module.
- dosChkLibInit
- (optional) install the file system consistency checking module.
Also, at least one CBIO module must be initialized on a per-device basis prior to calling dosFsDevCreate( ). See the related documentation for more details and examples.
The dosFsDevCreate( ) routine associates a device with the dosFsLib functions. It expects three parameters:
For example:
- (1)
- A pointer to a name string, to be used to identify the device - logical device name. This will be part of the pathname for I/O operations which operate on the device. This name will appear in the I/O system device table, which may be displayed using the iosDevShow( ) routine.
- (2)
- CBIO_DEV_ID - a pointer to the CBIO_DEV structure which provides interface to particular disk, via a disk cache, or a partition manager or a combination of a number of CBIO modules which are stacked on top of each other to form one of many configurations possible.
- (3)
- A maximum number of files can be simultaneously opened on a particular device.
- (4)
- Because volume integrity check utility can be automatically invoked every time a device is mounted, this parameter indicates whether the consistency check needs to be performed automatically on a given device, and on what level of verbosity is required. In any event, the consistency check may be invoked at a later time e.g. by calling chkdsk( ). See description for FIOCHKDSK ioctl command for more information.
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 */ )Once dosFsDevCreate( ) has been called, the device can be accessed using ioLib generic I/O routines: open( ), read( ), write( ), close( ), ioctl( ), remove( ). Also, the user-level utility functions may be used to access the device at a higher level (See usrFsLib reference page for more details).
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 be used with the VxWorks dosFs file system. However, it is possible (and desirable) to use longer, more mnemonic device names, such as "DOS1:", or "/floppy0". The name is specified during the dosFsDevCreate( ) call.
The pathnames used to specify dosFs files and directories may use either forward slashes ("/") or backslashes ("freely mixed. The choice of forward slashes or backslashes has absolutely no effect on the directory data written to the disk. (Note, however, that forward slashes are not allowed within VxWorks dosFs filenames, although they are normally legal for pure MS-DOS implementations.)
For the sake of consistency however use of forward slashes ("/") is recommended at all times.
The leading slash of a dosFs pathname following the device name is optional. For example, both "DOS1:newfile.new" and "DOS1:/newfile.new" refer to the same file.
This library supports DOS4.0 standard file names which fit the restrictions of eight upper-case characters optionally followed by a three-character extension, as well as Windows style VFAT standard long file names that are stored mixed cased on disk, but are case insensitive when searched and matched (e.g. during open( ) call). The VFAT long file name is stored in a variable number of consecutive directory entries. Both standards restrict file size to 4 GB (32 bit value).
To provide additional flexibility, this implementation of the DOS file system provides proprietary ling file name format (VXLONGNAMES), which uses a simpler directory structure: the directory entry is of fixed size. When this option is used, file names may consist of any sequence of up to 40 ASCII characters. No case conversion is performed, and file name match is case-sensitive. With this directory format the file maximum size is expanded to 1 Terabyte (40 bit value).
Because special directory entries are used on the disk, disks which use the extended names are not compatible with other implementation of the MS-DOS systems, and cannot be read on MS-DOS or Windows machines.
To enable the extended file names, set the DOS_OPT_VXLONGNAMES flag when calling dosFsVolFormat( ).
Directories on VxWorks dosFs volumes may be searched using the opendir( ), readdir( ), rewinddir( ), and closedir( ) routines. These calls allow the names of files and subdirectories to be determined.
To obtain more detailed information about a specific file, use the fstat( ) or stat( ) routine. Along with standard file information, the structure used by these routines also returns the file attribute byte from a dosFs directory entry.
For more information, see the manual entry for dirLib.
Directory entries on dosFs volumes contain creation, last modification time 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 dosFsLastAccessDateEnable( ), passing it the volumes DOS_VOLUME_DESC_ID and TRUE.
The dosFs file system uses the ANSI time( ) function, that returns system clock value to obtain date and time. It is recommended that the target system should set the system time during system initialization time from a network server or from an embedded Calendar / Clock hardware component, so that all files on the file system would be associated with a correct date and time.
The file system consistency checker (see below) sets system clock to value following the latest date-time field stored on the disk, if it discovers, that function time( ) returns a date earlier then Jan 1, 1998, meaning that the target system does not have a source of valid date and time to synchronize with.
See also the reference manual entry for ansiTime.
Directory entries on dosFs volumes contain an attribute byte consisting of bit-flags which specify various characteristics of the entry. The attributes which are identified are: read-only file, hidden file, system file, volume label, directory, and archive. The VxWorks symbols for these attribute bit-flags are:
All the flags in the attribute byte, except the directory and volume label flags, may be set or cleared using the ioctl( ) FIOATTRIBSET function. This function is called after opening the specific file whose attributes are to be changed. The attribute byte value specified in the FIOATTRIBSET call is copied directly. To preserve existing flag settings, the current attributes should first be determined via fstat( ), and the appropriate flag(s) changed using bitwise AND or OR operations. For example, to make a file read-only, while leaving other attributes intact:
- DOS_ATTR_RDONLY
- File is write-protected, can not be modified or deleted.
- DOS_ATTR_HIDDEN
- this attribute is not used by VxWorks.
- DOS_ATTR_SYSTEM
- this attribute is not used by VxWorks.
- DOS_ATTR_VOL_LABEL
- directory entry describes a volume label, this attribute can not be set or used directly, see ioctl( ) command FIOLABELGET and FIOLABELSET below for volume label manipulation.
- DOS_ATTR_DIRECTORY
- directory entry is a subdirectory, this attribute can not be set directly.
- DOS_ATTR_ARCHIVE
- this attribute is not used by VxWorks.
struct stat fileStat; fd = open ("file", O_RDONLY, 0); /* open file */ fstat (fd, &fileStat); /* get file status */ ioctl (fd, FIOATTRIBSET, (fileStat.st_attrib | DOS_ATTR_RDONLY)); /* set read-only flag */ close (fd); /* close file */See also the reference manual entry for attrib( ) and xattrib( ) for user-level utility routines which control the attributes of files or file hierarchy.
The VxWorks dosFs file system provides efficient files storage: space will be allocated in groups of clusters (also termed extents ) so that a file will be composed of relatively large contiguous units. This nearly contiguous allocation technique is designed to effectively eliminate the effects of disk space fragmentation, keeping throughput very close to the maximum of which the hardware is capable of.
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 file and optimized access to such a file when it is used. Usually this will somewhat improve performance when compared to Nearly Contiguous allocation, at the price of disk space fragmentation.
To allocate a contiguous area to a file, the file is first created in the normal fashion, using open( ) or creat( ). The file descriptor returned during the creation of the file is then used to make an ioctl( ) call, specifying the FIOCONTIG or FIOCONTIG64 function. The last parameter to the FIOCONTIG function is the size of the requested contiguous area in bytes, If the FIOCONTIG64 is used, the last parameter is pointer to 64-bit integer variable, which contains the required file size. It is also possible to request that the largest contiguous free area on the disk be obtained. In this case, the size value CONTIG_MAX (-1) is used instead of an actual size. These ioctl( ) codes are not supported for directories. The volume is searched for a contiguous area of free space, which is assigned to the file. If a segment of contiguous free space large enough for the request was not found, ERROR is returned, with errno set to S_dosFsLib_NO_CONTIG_SPACE.
When contiguous space is allocated to a file, the file remains empty, while the newly allocated space has not been initialized. The data should be then written to the file, and eventually, when all data has been written, the file is closed. When file is closed, its space is truncated to reflect the amount of data actually written to the file. This file may then be again opened and used for further I/O operations read( ) or write( ), but it can not be guaranteed that appended data will be contiguous to the initially written data segment.
For example, the following will create a file and allocate 85 Mbytes of contiguous space:
fd = creat ("file", O_RDWR, 0); /* open file */ status = ioctl (fd, FIOCONTIG, 85*0x100000);/* get contiguous area */ if (status != OK) ... /* do error handling */ close (fd); /* close file */In contrast, the following example will create a file and allocate the largest contiguous area on the disk to it:
fd = creat ("file", O_RDWR, 0); /* open file */ status = ioctl (fd, FIOCONTIG, CONTIG_MAX); /* get contiguous area */ if (status != OK) ... /* do error handling */ close (fd); /* close file */To determine the actual amount of contiguous space obtained when CONTIG_MAX is specified as the size, use fstat( ) to examine the number of blocks and block size for the file.
- NOTE
- the FIOCONTIG operation should take place right after the file has been created, before any data is written to the file. Directories may not be allocated a contiguous disk area.
When any file is opened, it may be checked for contiguity. Use the extended flag DOS_O_CONTIG_CHK when calling open( ) to access an existing file which may have been allocated contiguous space. If a file is detected as contiguous, all subsequent operations on the file will not require access to the File Allocation Table, thus eliminating any disk Seek operations. The down side however is that if this option is used, open( ) will take an amount of time which is linearly proportional of the file size.
Buffering of disk data in RAM, synchronization of these buffers with the disk and detection of removable disk replacement are all handled by the disk cache. See reference manual on dcacheCbio for more details.
If a disk is physically removed, the disk cache will cause dosFsLib to unmount the volume, which will mark all currently open file descriptors as obsolete.
If a new disk is inserted, it will be automatically mounted on the next call to open( ) or creat( ).
The dosFs file system supports the following ioctl( ) functions. The functions listed are defined in the header ioLib.h. Unless stated otherwise, the file descriptor used for these functions may be any file descriptor which is opened to a file or directory on the volume or to the volume itself. There are some ioctl( ) commands, that expect a 32-bit integer result (FIONFREE, FIOWHERE, etc.). However, disks and files with are grater than 4GB are supported. In order to solve this problem, new ioctl( ) functions have been added to support 64-bit integer results. They have the same name as basic functions, but with suffix 64, namely: FIONFREE64, FIOWHERE64 and so on. These commands expect a pointer to a 64-bit integer, i.e.:
long long *arg ;as the 3rd argument to the ioctl( ) function. If a value which is requested with a 32-bit ioctl( ) command is too large to be represented in the 32-bit variable, ioctl( ) will return ERROR, and errno will be set to S_dosFsLib_32BIT_OVERFLOW.
Possible verbosity levels are:
- FIODISKINIT
- Reinitializes a DOS file system on the disk volume. This function calls dosFsVolFormat( ) to format the volume, so dosFsFmtLib must be installed for this to work. Third argument of ioctl( ) is passed as argument opt to dosFsVolFormat( ) routine. This routine does not perform a low level format, the physical media is expected to be already formatted. If DOS file system device has not been created yet for a particular device, only direct call to dosFsVolFormat( ) can be used.
fd = open ("DEV1:", O_WRONLY); status = ioctl (fd, FIODISKINIT, DOS_OPT_BLANK);- FIODISKCHANGE
- Announces a media change. No buffers flushing is performed. This function may be called from interrupt level:
status = ioctl (fd, FIODISKCHANGE, 0);- FIOUNMOUNT
- Unmounts a disk volume. It performs the same function as dosFsVolUnmount( ). This function must not be called from interrupt level:
status = ioctl (fd, FIOUNMOUNT, 0);- FIOGETNAME
- Gets the file name of the file descriptor and copies it to the buffer nameBuf. Note that nameBuf must be large enough to contain the largest possible path name, which requires at least 256 bytes.
status = ioctl (fd, FIOGETNAME, &nameBuf );- FIORENAME
- Renames the file or directory to the string newname:
fd = open( "oldname", O_RDONLY, 0 ); status = ioctl (fd, FIORENAME, "newname");- FIOMOVE
- Moves the file or directory to the string newname:
fd = open( "oldname", O_RDONLY, 0 ); status = ioctl (fd, FIOMOVE, "newname");- FIOSEEK
- Sets the current byte offset in the file to the position specified by newOffset. This function supports offsets in 32-bit value range. Use FIOSEEK64 for larger position values:
status = ioctl (fd, FIOSEEK, newOffset);- FIOSEEK64
- Sets the current byte offset in the file to the position specified by newOffset. This function supports offsets in 64-bit value range:
long long newOffset; status = ioctl (fd, FIOSEEK64, (int) & newOffset);- FIOWHERE
- Returns the current byte position in the file. This is the byte offset of the next byte to be read or written. This function returns a 32-bit value. It takes no additional argument:
position = ioctl (fd, FIOWHERE, 0);- FIOWHERE64
- Returns the current byte position in the file. This is the byte offset of the next byte to be read or written. This function returns a 64-bit value in position:
long long position; status = ioctl (fd, FIOWHERE64, (int) & position);- FIOFLUSH
- Flushes disk cache buffers. It guarantees that any output that has been requested is actually written to the device:
status = ioctl (fd, FIOFLUSH, 0);- FIOSYNC
- Updates the FAT copy for the passed file descriptor, then flushes and invalidates the CBIO cache buffers for the file descriptor's volume. FIOSYNC ensures that any outstanding output requests for the passed file descriptor are written to the device and a subsequent I/O operation will fetch data directly from the physical medium. To safely sync a volume for shutdown, all open file descriptor's should at the least be FIOSYNC'd by the application. Better, all open FD's should be closed by the application and the volume should be unmounted via FIOUNMOUNT.
status = ioctl (fd, FIOSYNC, 0);- FIOTRUNC
- Truncates the specified file's length to newLength bytes. Any disk clusters which had been allocated to the file but are now unused are deallocated, and the directory entry for the file is updated to reflect the new length. Only regular files may be truncated; attempts to use FIOTRUNC on directories will return an error. FIOTRUNC may only be used to make files shorter; attempting to specify a newLength larger than the current size of the file produces an error (setting errno to S_dosFsLib_INVALID_NUMBER_OF_BYTES).
status = ioctl (fd, FIOTRUNC, newLength);- FIOTRUNC64
- Similar to FIOTRUNC, but can be used for files lager, than 4GB.
long long newLength = .....; status = ioctl (fd, FIOTRUNC, (int) & newLength);- FIONREAD
- Copies to unreadCount the number of unread bytes in the file:
unsigned long unreadCount; status = ioctl (fd, FIONREAD, &unreadCount);- FIONREAD64
- Copies to unreadCount the number of unread bytes in the file. This function returns a 64-bit integer value:
long long unreadCount; status = ioctl (fd, FIONREAD64, &unreadCount);- FIONFREE
- Copies to freeCount the amount of free space, in bytes, on the volume:
unsigned long freeCount; status = ioctl (fd, FIONFREE, &freeCount);- FIONFREE64
- Copies to freeCount the amount of free space, in bytes, on the volume. This function can return value in 64-bit range:
long long freeCount; status = ioctl (fd, FIONFREE64, &freeCount);- FIOMKDIR
- Creates a new directory with the name specified as dirName:
status = ioctl (fd, FIOMKDIR, "dirName");- FIORMDIR
- Removes the directory whose name is specified as dirName:
status = ioctl (fd, FIORMDIR, "dirName");- FIOLABELGET
- Gets the volume label (located in root directory) and copies the string to labelBuffer. If the label contains DOS_VOL_LABEL_LEN significant characters, resulting string is not NULL terminated:
char labelBuffer [DOS_VOL_LABEL_LEN]; status = ioctl (fd, FIOLABELGET, (int)labelBuffer);- FIOLABELSET
- Sets the volume label to the string specified as newLabel. The string may consist of up to eleven ASCII characters:
status = ioctl (fd, FIOLABELSET, (int)"newLabel");- FIOATTRIBSET
- Sets the file attribute byte in the DOS directory entry to the new value newAttrib. The file descriptor refers to the file whose entry is to be modified:
status = ioctl (fd, FIOATTRIBSET, newAttrib);- FIOCONTIG
- Allocates contiguous disk space for a file or directory. The number of bytes of requested space is specified in bytesRequested. In general, contiguous space should be allocated immediately after the file is created:
status = ioctl (fd, FIOCONTIG, bytesRequested);- FIOCONTIG64
- Allocates contiguous disk space for a file or directory. The number of bytes of requested space is specified in bytesRequested. In general, contiguous space should be allocated immediately after the file is created. This function accepts a 64-bit value:
long long bytesRequested; status = ioctl (fd, FIOCONTIG64, &bytesRequested);- FIONCONTIG
- Copies to maxContigBytes the size of the largest contiguous free space, in bytes, on the volume:
status = ioctl (fd, FIONCONTIG, &maxContigBytes);- FIONCONTIG64
- Copies to maxContigBytes the size of the largest contiguous free space, in bytes, on the volume. This function returns a 64-bit value:
long long maxContigBytes; status = ioctl (fd, FIONCONTIG64, &maxContigBytes);- FIOREADDIR
- Reads the next directory entry. The argument dirStruct is a DIR directory descriptor. Normally, the readdir( ) routine is used to read a directory, rather than using the FIOREADDIR function directly. See dirLib.
DIR dirStruct; fd = open ("directory", O_RDONLY); status = ioctl (fd, FIOREADDIR, &dirStruct);- FIOFSTATGET
- Gets file status information (directory entry data). The argument statStruct is a pointer to a stat structure that is filled with data describing the specified file. Normally, the stat( ) or fstat( ) routine is used to obtain file information, rather than using the FIOFSTATGET function directly. See dirLib.
struct stat statStruct; fd = open ("file", O_RDONLY); status = ioctl (fd, FIOFSTATGET, (int)&statStruct);- FIOTIMESET
- Update time on a file. arg shall be a pointer to a utimbuf structure, see utime.h. If arg is value NULL, the current system time is used for both actime and modtime members. If arg is not NULL then the utimbuf structure members actime and modtime are used as passed. If actime is zero value, the file access time is not updated (the operation is ignored). If modtime is zero, the file modification time is not updated (the operation is ignored). See also utime( ) ..CS
struct utimbuf newTimeBuf;;
newTimeBuf.modtime = newTimeBuf.actime = fileNewTime;
fd = open ("file", O_RDONLY);
status = ioctl (fd, FIOTIMESET, (int)&newTimeBuf); \ce- FIOCHKDSK
- This function invokes the integral consistency checking. During the test, the file system will be blocked from application code access, and will emit messages describing any inconsistencies found on the disk, as well as some statistics, depending on the verbosity level in the flags argument. Depending on the repair permission value in flags argument, the inconsistencies will be repaired, and changes written to disk or only reported. Argument flags should be composed of bitwise or-ed verbosity level value and repair permission value. Possible repair levels are:
- DOS_CHK_ONLY (1)
- Only report errors, do not modify disk.
- DOS_CHK_REPAIR (2)
- Repair any errors found.
- DOS_CHK_VERB_SILENT (0xff00)
- Do not emit any messages, except errors encountered.
- DOS_CHK_VERB_1 (0x0100)
- Display some volume statistics when done testing, as well
- DOS_CHK_VERB_2 (0x0200)
- In addition to the above option, display path of every file, while it is being checked. This option may significantly slow down the test process.
- NOTE
- In environments with reduced RAM size check disk uses reserved FAT copy as temporary buffer, it can cause respectively long time of execution on a slow CPU architectures..
See also the reference manual usrFsLib for the chkdsk( ) user level utility which may be used to invoke the FIOCHKDSK ioctl( ). The volume root directory should be opened, and the resulting file descriptor should be used:
int fd = open (device_name, O_RDONLY, 0); status = ioctl (fd, FIOCHKDSK, DOS_CHK_REPAIR | DOS_CHK_VERB_1); close (fd);Any other ioctl( ) function codes are passed to the underlying CBIO modules for handling.
dosFsLib.h
ioLib, iosLib, dirLib, usrFsLib, dcacheCbio, dpartCbio, dosFsFmtLib, dosChkLib Microsoft MS-DOS Programmer's Reference (Microsoft Press), Advanced MS-DOS Programming (Ray Duncan, Microsoft Press), VxWorks Programmer's Guide: I/O System, Local File Systems
dosSetVolCaseSens( ) - set case sensitivity of volume
STATUS dosSetVolCaseSens ( DOS_VOLUME_DESC_ID pVolDesc, BOOL sensitivity )
Pass TRUE to setup a case sensitive volume. Pass FALSE to setup a case insensitive volume. Note this affects rename lookups only.
TRUE if pVolDesc pointed to a DOS volume.
dosFsVolDescGet( ) - convert a device name into a DOS volume descriptor pointer.
DOS_VOLUME_DESC_ID dosFsVolDescGet ( void * pDevNameOrPVolDesc, /* device name or pointer to dos vol desc */ u_char * * ppTail /* return ptr for name, used in iosDevFind */ )
This routine validates pDevNameOrPVolDesc to be a DOS volume descriptor pointer else a path to a DOS device. This routine uses the standard iosLib function iosDevFind( ) to obtain a pointer to the device descriptor. If device is eligible, ppTail is filled with the pointer to the first character following the device name. Note that ppTail is passed to iosDevFind( ). ppTail may be passed as NULL, in which case it is ignored.
A DOS_VOLUME_DESC_ID or NULL if not a DOSFS device.
S_dosFsLib_INVALID_PARAMETER
dosFsChkDsk( ) - make volume integrity checking.
STATUS dosFsChkDsk ( DOS_FILE_DESC_ID pFd, /* file descriptor of root dir */ u_int params /* check level and verbosity */ )
This library does not makes integrity check process itself, but instead uses routine provided by dosChkLib. This routine prepares parameters and invokes checking routine via preinitialized function pointer. If dosChkLib does not configured into vxWorks, this routine returns ERROR.
Ownership on device should be taken by an upper level routine.
STATUS as returned by volume checking routine or
ERROR, if such routine does not installed.
S_dosFsLib_UNSUPPORTED.
dosFsLastAccessDateEnable( ) - enable last access date updating for this volume
STATUS dosFsLastAccessDateEnable ( DOS_VOLUME_DESC_ID dosVolDescId, /* dosfs volume ID to alter */ BOOL enable /* TRUE = enable update, FALSE = */ /* disable update */ )
This function enables or disables updating of the last access date directory entry field on open-read-close operations for the given dosFs volume. The last access date file indicates the last date that a file has been read or written. When the optional last access date field update is enabled, read operations on a file will cause a write to the media.
OK or ERROR if the volume is invalid or enable is not TRUE or FALSE.
dosFsLibInit( ) - prepare to use the dosFs library
STATUS dosFsLibInit ( int ignored )
This routine initializes the dosFs library. This routine installs dosFsLib as a driver in the I/O system driver table, and allocates and sets up the necessary structures. The driver number assigned to dosFsLib is placed in the global variable dosFsDrvNum.
OK or ERROR, if driver can not be installed.
dosFsDevCreate( ) - create file system device.
STATUS dosFsDevCreate ( char * pDevName, /* device name */ CBIO_DEV_ID cbio, /* CBIO or cast blkIo device */ u_int maxFiles, /* max no. of simultaneously open files */ u_int autoChkLevel /* automate volume integrity check level */ /* via mounting 0 - default: DOS_CHK_REPAIR DOS_CHK_VERB_1 */ )
This routine associates a CBIO device with a logical I/O device name and prepare it to perform file system functions. It takes a CBIO_DEV_ID device handle, typically created by dcacheDevCreate( ), and defines it as a dosFs volume. As a result, when high-level I/O operations (e.g., open( ), write( )) are performed on the device, the calls will be routed through dosFsLib. The pCbio parameter is the handle of the underlying cache or block device.
The argument maxFiles specifies the number of files that can be opened at once on the device.
The volume structure integrity can be automatically checked during volume mounting. Parameter autoChkLevel defines checking level (DOS_CHK_ONLY or DOS_CHK_REPAIR), that can be bitwise or-ed with check verbosity level value (DOS_CHK_VERB_SILENT, DOS_CHK_VERB_1 or DOS_CHK_VERB_2). If value of autoChkLevel is 0, this means default level, that is DOS_CHK_REPAIR | DOS_CHK_VERB_1. To prevent check disk autocall set autoChkLevel to NONE.
Note that actual disk accesses are deferred to the time when open( ) or creat( ) are first called. That is also when the automatic disk checking will take place. Therefore this function will succeed in cases where a removable disk is not present in the drive.
OK, or ERROR if the device name is already in use or insufficient memory.
dosFsShow( ) - display dosFs volume configuration data.
STATUS dosFsShow ( void * pDevName, /* name of device */ u_int level /* detail level */ )
This routine obtains the dosFs volume configuration for the named device, formats the data, and displays it on the standard output.
If no device name is specified, the current default device is described.
OK or ERROR, if no valid device specified.