VxWorks API Reference : OS Libraries
dosFsFmtLib - MS-DOS media-compatible file system formatting library
dosFsVolFormat( ) - format an MS-DOS compatible volume
This module is a scaleable companion module for dosFsLib, and is intended to facilitate high level formatting of disk volumes.
There are two ways to high level format a volume:
- (1)
- Directly calling dosFsVolFormat( ) routine allows to have complete control over the format used, parameters and allows to supply a hook routine which for instance could interactively prompt the user to modify disk parameters.
- (2)
- Calling ioctl command FIODISKINIT will invoke the formatting routine via dosFsLib. This uses the default volume format and parameters.
This routine is an optional part of the MS-DOS file system, and may be included in a target system if it is required to be able to format new volumes.
In order to include this option, the following function needs to be invoked during system initialization:
void dosFsFmtLibInit( void );See reference page dosFsVolFormat( ) for complete description of supported formats, options and arguments.
dosFsVolFormat( ) - format an MS-DOS compatible volume
STATUS dosFsVolFormat ( void * device, /* device name or volume or CBIO pointer */ int opt, /* bit-wise or'ed options */ FUNCPTR pPromptFunc /* interactive parameter change callback */ )
This utility routine performs the initialization of file system data structures on a disk. It supports FAT12 for small disks, FAT16 for medium size and FAT32 for large volumes. The device argument may be either a device name known to the I/O system, or a dosFsLib Volume descriptor or a CBIO device handle.
The opt argument is a bit-wise or'ed combination of options controlling the operation of this routine as follows:
The third argument, pPromptFunc is an optional pointer to a function that may interactively prompt the user to change any of the modifiable volume parameters before formatting:
- DOS_OPT_DEFAULT
- If the current volume boot block is reasonably intact, use existing parameters, else calculate parameters based only on disk size, possibly reusing only the volume label and serial number.
- DOS_OPT_PRESERVE
- Attempt to preserve the current volume parameters even if they seem to be somewhat unreliable.
- DOS_OPT_BLANK
- Disregard the current volume parameters, and calculate new parameters based only on disk size.
- DOS_OPT_QUIET
- Do not produce any diagnostic output during formatting.
- DOS_OPT_FAT16
- Format the volume with FAT16 format even if the disk is larger then 2 Gbytes, which would normally be formatted with FAT32.
- DOS_OPT_FAT32
- Format the volume with FAT32, even if the disk is smaller then 2 Gbytes, but is larger then 512 Mbytes.
- DOS_OPT_VXLONGNAMES
- Format the volume to use Wind River proprietary case-sensitive Long File Names. Note that this format is incompatible with any other implementation of the MS-DOS file system.
void formatPromptFunc( DOS_VOL_CONFIG *pConfig );The <*pConfig> structure upon entry to formatPromptFunc( ) will contain the initial volume parameters, some of which can be changed before it returns. pPromptFunc should be NULL if no interactive prompting is required.
Although this routine tries to format the disk to be compatibile with Microsoft implementations of the FAT and FAT32 file systems, there may be differences which are not under WRS control. For this reason, it is highly recommended that any disks which are expected to be interchanged between vxWorks and Windows should be formatted under Windows to provide the best interchangeability. The WRS implementation is more flexible, and should be able to handle the differences when formatting is done on Windows, but Windows implementations may not be able to handle minor differences between their implementation and ours.
This function is an optional part of the MS-DOS file system, and may be included in a target system if it is required to be able to format new volumes.
OK or ERROR if was unable to format the disk.