Moved emulation of erase values up into lfs_testbd

Yes this is more expensive, since small programs need to rewrite the
whole block in order to conform to the block device API. However, it
reduces code duplication and keeps all of the test-related block device
emulation in lfs_testbd.

Some people have used lfs_filebd/lfs_rambd as a starting point for new block
devices and I think it should be clear that erase does not need to have side
effects. Though to be fair this also just means we should have more
examples of block devices...
This commit is contained in:
Christopher Haster
2022-08-17 11:50:45 -05:00
parent b08463f8de
commit a368d3a07c
6 changed files with 127 additions and 147 deletions
-4
View File
@@ -28,10 +28,6 @@ extern "C"
// rambd config (optional)
struct lfs_rambd_config {
// 8-bit erase value to simulate erasing with. -1 indicates no erase
// occurs, which is still a valid block device
int32_t erase_value;
// Optional statically allocated buffer for the block device.
void *buffer;
};