PFS, the wear-leveled file system on the external NOR flash.
More...
|
| int | pbl_fs_pfs_optimal_size (const char *path, size_t min_size) |
| | Get the optimal size of a file that can use space beyond a minimum.
|
| |
PFS, the wear-leveled file system on the external NOR flash.
- Files have a fixed size, set with pbl_fs_truncate() right after they are created.
- There are no directories: file names may contain
'/', and only the root of the mount can be listed.
- A file is open once at a time, and at most 8 files are open at once.
- The flash is NOR: a bit written to 0 stays 0 until the file is rewritten, which PBL_FS_O_REPLACE does safely.
- Erasing flash is slow and costs power: avoid deleting and creating files repeatedly.
- Removing a file that is open is a fatal error.
- Only one PFS can be mounted; the normal firmware mounts it at the root,
"/".
◆ PBL_FS_O_PFS_SKIP_HDR_CRC_CHECK
Skip checking the on-flash header CRCs, for files opened thousands of times.
◆ PBL_FS_O_PFS_USE_PAGE_CACHE
Cache the translation from file pages to flash pages.
Speeds up random access to large files. Best limited to reads, so that heap corruption cannot corrupt the file.
◆ pbl_fs_pfs_optimal_size()
| int pbl_fs_pfs_optimal_size |
( |
const char * |
path, |
|
|
size_t |
min_size |
|
) |
| |
Get the optimal size of a file that can use space beyond a minimum.
Rounds min_size up to use all the space of the flash pages the file takes anyway.
- Parameters
-
| path | Absolute path of the file. |
| min_size | Minimum size in bytes. |
- Returns
- Optimal size in bytes, or negative errno if
path is not on a PFS mount.
◆ pbl_fs_pfs_ops