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:
Christopher Haster
2020-11-26 11:24:19 -06:00
parent a7cdd563f6
commit 30ed816feb
7 changed files with 97 additions and 97 deletions

View File

@@ -37,8 +37,9 @@ struct lfs_rambd_cfg {
// Number of erasable blocks on the device.
lfs_size_t erase_count;
// 8-bit erase value to simulate erasing with. -1 indicates no erase
// occurs, which is still a valid block device
// 8-bit erase value to use for simulating erases. -1 does not simulate
// erases, which can speed up testing by avoiding all the extra block-device
// operations to store the erase value.
int32_t erase_value;
// Optional statically allocated buffer for the block device.
@@ -48,7 +49,7 @@ struct lfs_rambd_cfg {
// rambd state
typedef struct lfs_rambd {
uint8_t *buffer;
struct lfs_rambd_cfg cfg;
const struct lfs_rambd_cfg *cfg;
} lfs_rambd_t;