|
PebbleOS
|
Contiguous virtual address space for PFS over several flash regions. More...
Functions | |
| void | ftl_add_region (uint32_t region_start, uint32_t region_end, bool erase_new_region) |
| Append a flash region to the translation space. | |
| uint32_t | ftl_get_size (void) |
| Get the size of the translation space. | |
| void | ftl_erase_sector (uint32_t size, uint32_t offset) |
| Erase a sector of the translation space. | |
| void | ftl_erase_subsector (uint32_t size, uint32_t offset) |
| Erase a subsector of the translation space. | |
| void | ftl_read (void *buffer, size_t size, uint32_t offset) |
| Read from the translation space. | |
| void | ftl_write (const void *buffer, size_t size, uint32_t offset) |
| Write to the translation space. | |
| void | ftl_format (void) |
| Format all regions of the translation space. | |
| void | ftl_populate_region_list (void) |
| Build the translation space at boot. | |
Contiguous virtual address space for PFS over several flash regions.
Lets PFS grow into multiple flash regions while keeping a contiguous virtual address space. Regions are added in the order of the board's filesystem region list. On boot, the regions where PFS is already active are added as they are; the remaining ones are erased and then added, growing the filesystem.
| void ftl_add_region | ( | uint32_t | region_start, |
| uint32_t | region_end, | ||
| bool | erase_new_region | ||
| ) |
Append a flash region to the translation space.
The region must be the next one in the filesystem region list; otherwise the call is ignored. Grows the PFS size by region_end - region_start.
| region_start | Start address of the region. |
| region_end | End address of the region, exclusive. |
| erase_new_region | Erase the region before adding it. |
| void ftl_erase_sector | ( | uint32_t | size, |
| uint32_t | offset | ||
| ) |
Erase a sector of the translation space.
| size | Size of the area to erase, must equal SECTOR_SIZE_BYTES (asserted). |
| offset | Virtual offset of the sector. |
| void ftl_erase_subsector | ( | uint32_t | size, |
| uint32_t | offset | ||
| ) |
Erase a subsector of the translation space.
| size | Size of the area to erase, must equal SUBSECTOR_SIZE_BYTES (asserted). |
| offset | Virtual offset of the subsector. |
| void ftl_format | ( | void | ) |
Format all regions of the translation space.
Currently does nothing; use pfs_format() to erase the filesystem.
| uint32_t ftl_get_size | ( | void | ) |
Get the size of the translation space.
| void ftl_populate_region_list | ( | void | ) |
Build the translation space at boot.
Adds the regions where PFS already exists, runs pfs_reboot_cleanup(), then erases and adds the remaining regions. Called by pfs_init().
| void ftl_read | ( | void * | buffer, |
| size_t | size, | ||
| uint32_t | offset | ||
| ) |
Read from the translation space.
| [out] | buffer | Destination buffer. |
| size | Number of bytes to read, at most the size of buffer. | |
| offset | Virtual offset to read from. |
| void ftl_write | ( | const void * | buffer, |
| size_t | size, | ||
| uint32_t | offset | ||
| ) |
Write to the translation space.
| buffer | Data to write. |
| size | Number of bytes to write, at most the size of buffer. |
| offset | Virtual offset to write to. |