Porting the FileSystem module
This module implements an abstraction layer for POSIX-like file system APIs, to allow Pelion Device Management Client to perform file I/O operations.
Supported key functionality:
- Folder operations: create and delete directory.
- File operations: open, seek, read, write , close and delete (unlink).
- Special operations:
- Delete folder content: files only, non-recursive deletion (no folder iteration).
- Nonrecursively copy all files in the folder to a different folder.
- Format partition.
pal_plat_fileSystem.h header declares the FileSystem functions.
Note: You need to implement all APIs in this module.
Prerequisites for this porting stage
An RTOS module (successfully ported).
Storage with at least one partition and a file system (on Linux, you can use
gpartedfor partition management). One or more additional partitions may be used as backup.
Note: Mbed OS supports only primary partitions. MBRBlockDevice includes a partition method that you can use for creating partitions.
FileSystemmodule must receive at least one mount point.
The name of the primary and secondary mount points must be set in the
PAL_FS_MOUNT_POINT_SECONDARYenvironment variables, respectively.
Note: The primary and secondary mount points may be the same (for example, for single-partition systems).
The file system folder access assumes that folders are separated with the
KCM and PAL
Key and Configuration Management data (KCM) files are in the ESFS folders
ESFS_WORKING_DIRECTORY, in case of partition
ESFS_BACKUP_DIRECTORY, in case of partition
PAL_FS_PARTITION_SECONDARY. You can override
ESFS_BACKUP_DIRECTORY in the application configuration file. More specific details about KCM are available in Using FCC and KCM in your application.
- You do not need a special configuration; the
FileSystemfunctionality uses the Linux
- The default format type is
ext4. If you need a different format, set
pal_plat_filesystem.c) to the desired type.
Dual partition porting
To enable dual partition, change the value of
PAL_NUMBER_OF_PARTITIONS to 2.
You must override the
FileSystem::get_default_instance()method, because it is for the whole blockdevice. The PAL mount point defines
PAL_FS_MOUNT_POINT_SECONDARY must match with the mount points of the filesystem instances. The default value for
PAL_FS_MOUNT_POINT_SECONDARY. You can override the values in the