ringfs
|
Data Structures | |
struct | ringfs_flash_partition |
Flash memory+parition descriptor. More... | |
struct | ringfs |
RingFS instance. More... | |
Functions | |
int | ringfs_init (struct ringfs *fs, const struct ringfs_flash_partition *flash, uint32_t version, int object_size) |
Initialize a RingFS instance. More... | |
int | ringfs_format (struct ringfs *fs) |
Format the flash memory. More... | |
int | ringfs_scan (struct ringfs *fs) |
Scan the flash memory for a valid filesystem. More... | |
int | ringfs_capacity (struct ringfs *fs) |
Calculate maximum RingFS capacity. More... | |
int | ringfs_count_estimate (struct ringfs *fs) |
Calculate approximate object count. More... | |
int | ringfs_count_exact (struct ringfs *fs) |
Calculate exact object count. More... | |
int | ringfs_append (struct ringfs *fs, const void *object) |
Append an object at the end of the ring. More... | |
int | ringfs_fetch (struct ringfs *fs, void *object) |
Fetch next object from the ring, oldest-first. More... | |
int | ringfs_discard (struct ringfs *fs) |
Discard all fetched objects up to the read cursor. More... | |
int | ringfs_rewind (struct ringfs *fs) |
Rewind the read cursor back to the oldest object. More... | |
struct ringfs |
RingFS instance.
Should be initialized with ringfs_init() befure use. Structure fields should not be accessed directly.
Data Fields | ||
---|---|---|
struct ringfs_loc | cursor | |
const struct ringfs_flash_partition * |
flash | |
int | object_size | |
struct ringfs_loc | read | |
int | slots_per_sector | |
uint32_t | version | |
struct ringfs_loc | write |
int ringfs_append | ( | struct ringfs * | fs, |
const void * | object | ||
) |
int ringfs_capacity | ( | struct ringfs * | fs | ) |
int ringfs_count_estimate | ( | struct ringfs * | fs | ) |
int ringfs_count_exact | ( | struct ringfs * | fs | ) |
int ringfs_discard | ( | struct ringfs * | fs | ) |
int ringfs_fetch | ( | struct ringfs * | fs, |
void * | object | ||
) |
int ringfs_format | ( | struct ringfs * | fs | ) |
int ringfs_init | ( | struct ringfs * | fs, |
const struct ringfs_flash_partition * | flash, | ||
uint32_t | version, | ||
int | object_size | ||
) |
Initialize a RingFS instance.
Must be called before the instance can be used with the other ringfs_* functions.
fs | RingFS instance to be initialized. |
flash | Flash memory interface. Must be implemented externally. |
version | Object version. Should be incremented whenever the object's semantics or size change in a backwards-incompatible way. |
object_size | Size of one stored object, in bytes. |
int ringfs_rewind | ( | struct ringfs * | fs | ) |