Readded support for mirror writes to a file in testbd

Before this was available implicitly by supporting both rambd and filebd
as backends, but now that testbd is a bit more complicated and no longer
maps directly to a block-device, this needs to be explicitly supported.
This commit is contained in:
Christopher Haster
2022-08-23 14:48:29 -05:00
parent 4689678208
commit 3f4f85986e
3 changed files with 95 additions and 50 deletions
+7 -8
View File
@@ -90,14 +90,9 @@ struct lfs_testbd_config {
// heavy memory usage!
bool track_branches;
// // Optional buffer for RAM block device.
// void *buffer;
//
// // Optional buffer for wear.
// void *wear_buffer;
//
// // Optional buffer for scratch memory, needed when erase_value != -1.
// void *scratch_buffer;
// Path to file to use as a mirror of the disk. This provides a way to view
// the current state of the block device.
const char *disk_path;
};
// A reference counted block
@@ -112,7 +107,11 @@ typedef struct lfs_testbd_block {
typedef struct lfs_testbd {
// array of copy-on-write blocks
lfs_testbd_block_t **blocks;
// some other test state
uint32_t power_cycles;
int disk_fd;
uint8_t *disk_scratch_block;
// array of tracked branches
struct lfs_testbd *branches;