Chapter 37. Formatting Support
If the option
CYGSEM_FS_FAT_FORMAT is enabled, the
filesystem is able to format the chosen volume with a FAT filesystem
while mounting it. This is controlled by a number of options passed
to the filesystem through the mount function.
This option enables formatting. If this is present without an
argument, then the volume will only be formatted if the file system
cannot be mounted. With an argument of
forcethe volume will be formatted regardless of its current contents. Without this option present, the following options will be ignored.
- This option forces the file system to be formatted using FAT16.
This option forces the file system to be formatted using FAT32. If
fat32options are provided, the formatter will choose the format based on the size of the volume. At present, any volume less than 512MiB in size will be formatted as FAT16, all others will be FAT32.
- This option takes an argument giving the size of each cluster in KiB. It should be a power of 2. If not supplied, the formatter will choose a cluster size based on the size of the volume.
- This option takes a name which should be up to 11 characters in length. This is used to set the volume label in the boot block and to create a volume label entry in the root directory. If not supplied a default volume label will be set (currently "eCos DISK").
A somewhat contrived example of a mount call with the format option might be as follows:
err = mount("/dev/hd0/1", "/disk0", "fatfs:format=force,fat16,clsize=8,label=My Volume");
Under normal circumstances, just giving the
option should be sufficient for most purposes:
err = mount("/dev/hd0/1", "/disk0", "fatfs:format");
This will cause the volume to be formatted according to its size, but only if it is not already mountable.
|2021-04-29||eCosPro Non-Commercial Public License|