mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
Standardized on externally provided config structs in the block devices
I have another branch where I tried exploring inlined config structs backed by RAM, but this did not work out due to additional RAM and ROM costs. Changing the bds to follow this was surprisingly annoying, as they had a lot of shared geometry that was previously in a single shared config object, and the way that testbd contains either of rambd and filebd made configuring all three of these a bit complicated. Ended up settling on a lfs_testbd_cfg that contains optional pointers to lfs_rambd_cfg and lfs_filebd_cfg. These can be NULL, but only if that bd goes unused.
This commit is contained in:
@@ -44,6 +44,11 @@ typedef int32_t lfs_testbd_swear_t;
|
||||
|
||||
// testbd config, this is required for testing
|
||||
struct lfs_testbd_cfg {
|
||||
// Block device specific configuration, see the related config structs.
|
||||
// May be NULL if the underlying implementation goes unused.
|
||||
const struct lfs_rambd_cfg *rambd_cfg;
|
||||
const struct lfs_filebd_cfg *filebd_cfg;
|
||||
|
||||
// Minimum size of block read. All read operations must be a
|
||||
// multiple of this value.
|
||||
lfs_size_t read_size;
|
||||
@@ -74,9 +79,6 @@ struct lfs_testbd_cfg {
|
||||
// the program with exit. Simulates power-loss. 0 disables.
|
||||
uint32_t power_cycles;
|
||||
|
||||
// Optional buffer for RAM block device.
|
||||
void *buffer;
|
||||
|
||||
// Optional buffer for wear
|
||||
void *wear_buffer;
|
||||
};
|
||||
@@ -92,7 +94,7 @@ typedef struct lfs_testbd {
|
||||
uint32_t power_cycles;
|
||||
lfs_testbd_wear_t *wear;
|
||||
|
||||
struct lfs_testbd_cfg cfg;
|
||||
const struct lfs_testbd_cfg *cfg;
|
||||
} lfs_testbd_t;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user