User`s manual

144 digi.com File Systems
Lastly, a pointer to a partition structure is declared with the statement:
fat_part *first_part;
This pointer will be used as a handle to an active partition. (The fat_part structure and other data struc-
tures needed by the FAT file system are discussed in fat_AutoMount().) The partition pointer will be
passed to API functions, such as fat_open().
Now a call is made to fat_AutoMount(). This function was introduced in FAT version 2.01 as a
replacement for fat_Init(). Whereas fat_Init() can do all the things necessary to ready the first
partition on the first device for use, it is limited to that. The function fat_AutoMount() is more flexi-
ble because it uses data from the configuration file fat_config.lib to identify FAT partitions and to
optionally ready them for use, depending on the flags parameter that is passed to it. The flags parameter is
described in the function description for fat_AutoMount().
For this sample program, we are interested in the first usable FAT partition. The for loop after the call to
fat_AutoMount() finds the partition, if one is available.
The for loop allows us to check every possible partition by using num_fat_devices, which is the
number of configured devices, and then multiplying the configured devices by the maximum number of
allowable partitions on a device, which is four. The for loop also makes use of fat_part_mounted,
an array of pointers to partition structures that is populated by the fat_autoMount() call.