Using Volumes

A volume is opened with FSVol_Open():

Listing - Example FSVol_Open( ) call
    FSVol_Open((CPU_CHAR         *)"ide:0:",   /* <-- (a) volume name      */
               (CPU_CHAR         *)"ide:0:",   /* <-- (b) device name      */
               (FS_PARTITION_NBR *) 0,         /* <-- (c) partition number */
               (FS_ERR           *)&err);      /* <-- (d) return error     */

The parameters are the volume name (a), the device name (b) and the partition that will be opened (c). There is no restriction on the volume name (a); however, it is typical to give the volume the same name as the underlying device. If the default partition is to be opened, or if the device is not partitioned, then the partition number (c) should be zero.

The return error code from this function provides important information about the volume state:

  • The parameters are the volume name (a), the device name (b) and the partition that will be opened (c). There is no restriction on the volume name (a); however, it is typical to give the volume the same name as the underlying device. If the default partition is to be opened, or if the device is not partitioned, then the partition number (c) should be zero.
  • If the return error code is FS_ERR_NONE, then the volume has been mounted and is ready to use.
  • If the return error code is FS_ERR_PARTITION_NOT_FOUND, then no valid file system could be found on the device, or the specified partition does not exist. The device may need to be formatted (see below).
  • If the return error code is FS_ERR_DEV, FS_ERR_DEV_NOT_PRESENT, FS_ERR_DEV_IO or FS_ERR_DEV_TIMEOUT, the device is either not present or did not respond. This is an important consideration for removable devices. The volume is still registered with the file system suite, and the file system will attempt to re-open the volume each time the application accesses it (see Using Devices for more information).
  • If any other error code is returned, the volume is not registered with the file system. The developer should examine the error code to determine the source of the error.

FSVol_Fmt() formats a device, (re-)initializing the file system on the device:

Listing - Example FSVol_Fmt( ) call
    FSVol_Fmt((CPU_CHAR *)"ide:0:",  /* <-- (a) volume name                     */
              (void     *) 0,        /* <-- (b) pointer to system configuration */
              (FS_ERR   *)&err);     /* <-- (c) return error                    */


The parameters are the volume name (a) and a pointer to file system-specific configuration (b). The configuration is not required; if you are willing to accept the default format, a NULL pointer should be passed. Alternatively, the exact properties of the file system can be configured by passing a pointer to a FS_FAT_SYS_CFG structure as the second argument. For more information about the FS_FAT_SYS_CFG structure, see FS_FAT_SYS_CFG
.