#include <ringfs.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
Go to the source code of this file.
Data Structures | |
struct | sector_header |
struct | slot_header |
Enumerations | |
enum | sector_status { SECTOR_ERASED = 0xFFFFFFFF, SECTOR_FREE = 0xFFFFFF00, SECTOR_IN_USE = 0xFFFF0000, SECTOR_ERASING = 0xFF000000, SECTOR_FORMATTING = 0x00000000 } |
enum | slot_status { SLOT_ERASED = 0xFFFFFFFF, SLOT_RESERVED = 0xFFFFFF00, SLOT_VALID = 0xFFFF0000, SLOT_GARBAGE = 0xFF000000 } |
Functions | |
static int | _sector_address (struct ringfs *fs, int sector_offset) |
static int | _sector_get_status (struct ringfs *fs, int sector, uint32_t *status) |
static int | _sector_set_status (struct ringfs *fs, int sector, uint32_t status) |
static int | _sector_free (struct ringfs *fs, int sector) |
static int | _slot_address (struct ringfs *fs, struct ringfs_loc *loc) |
static int | _slot_get_status (struct ringfs *fs, struct ringfs_loc *loc, uint32_t *status) |
static int | _slot_set_status (struct ringfs *fs, struct ringfs_loc *loc, uint32_t status) |
static bool | _loc_equal (struct ringfs_loc *a, struct ringfs_loc *b) |
static void | _loc_advance_sector (struct ringfs *fs, struct ringfs_loc *loc) |
Advance a location to the beginning of the next sector. More... | |
static void | _loc_advance_slot (struct ringfs *fs, struct ringfs_loc *loc) |
Advance a location to the next slot, advancing the sector too if needed. More... | |
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... | |