From 7b330d67ebc1c5638f1d61147beceb909ce7f26a Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 18 Jul 2025 18:17:45 -0500 Subject: [PATCH] Renamed config -> cfg Note this includes both the lfs3_config -> lfs3_cfg structs as well as the LFS3_CONFIG -> LFS3_CFG include define: - LFS3_CONFIG -> LFS3_CFG - struct lfs3_config -> struct lfs3_cfg - struct lfs3_file_config -> struct lfs3_file_cfg - struct lfs3_*bd_config -> struct lfs3_*bd_cfg - cfg -> cfg We were already using cfg as the variable name everywhere. The fact that these names were different was an inconsistency that should be fixed since we're committing to an API break. LFS3_CFG is already out-of-date from upstream, and there's plans for a config rework, but I figured I'd go ahead and change it as well to lower the chances it gets overlooked. --- Note this does _not_ affect LFS3_TAG_CONFIG. Having the on-disk vs driver-level config take slightly different names is not a bad thing. --- bd/lfs3_emubd.c | 64 +++++++++++++------------- bd/lfs3_emubd.h | 64 +++++++++++++------------- bd/lfs3_filebd.c | 12 ++--- bd/lfs3_filebd.h | 14 +++--- bd/lfs3_rambd.c | 18 ++++---- bd/lfs3_rambd.h | 22 ++++----- lfs3.c | 22 ++++----- lfs3.h | 26 +++++------ lfs3_util.h | 8 ++-- runners/bench_runner.c | 8 ++-- runners/bench_runner.h | 4 +- runners/test_runner.c | 26 +++++------ runners/test_runner.h | 4 +- scripts/bench.py | 4 +- scripts/test.py | 4 +- tests/test_alloc.toml | 8 ++-- tests/test_attrs.toml | 94 +++++++++++++++++++------------------- tests/test_compat.toml | 58 +++++++++++------------ tests/test_exhaustion.toml | 10 ++-- tests/test_grow.toml | 24 +++++----- tests/test_trvs.toml | 4 +- 21 files changed, 249 insertions(+), 249 deletions(-) diff --git a/bd/lfs3_emubd.c b/bd/lfs3_emubd.c index aa068d87..b1d2b061 100644 --- a/bd/lfs3_emubd.c +++ b/bd/lfs3_emubd.c @@ -46,7 +46,7 @@ static void lfs3_emubd_decblock(lfs3_emubd_block_t *block) { } static lfs3_emubd_block_t *lfs3_emubd_mutblock( - const struct lfs3_config *cfg, + const struct lfs3_cfg *cfg, lfs3_emubd_block_t *block) { if (block && block->rc == 1) { // rc == 1? can modify @@ -111,8 +111,8 @@ static uint32_t lfs3_emubd_prng_(uint32_t *state) { // emubd create/destroy -int lfs3_emubd_createcfg(const struct lfs3_config *cfg, const char *path, - const struct lfs3_emubd_config *bdcfg) { +int lfs3_emubd_createcfg(const struct lfs3_cfg *cfg, const char *path, + const struct lfs3_emubd_cfg *bdcfg) { LFS3_EMUBD_TRACE("lfs3_emubd_createcfg(%p {.context=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read_size=%"PRIu32", .prog_size=%"PRIu32", " @@ -241,7 +241,7 @@ failed:; return err; } -int lfs3_emubd_create(const struct lfs3_config *cfg, const char *path) { +int lfs3_emubd_create(const struct lfs3_cfg *cfg, const char *path) { LFS3_EMUBD_TRACE("lfs3_emubd_create(%p {.context=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read_size=%"PRIu32", .prog_size=%"PRIu32", " @@ -252,13 +252,13 @@ int lfs3_emubd_create(const struct lfs3_config *cfg, const char *path) { (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count, path); - static const struct lfs3_emubd_config defaults = {.erase_value=-1}; + static const struct lfs3_emubd_cfg defaults = {.erase_value=-1}; int err = lfs3_emubd_createcfg(cfg, path, &defaults); LFS3_EMUBD_TRACE("lfs3_emubd_create -> %d", err); return err; } -int lfs3_emubd_destroy(const struct lfs3_config *cfg) { +int lfs3_emubd_destroy(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_destroy(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; @@ -297,7 +297,7 @@ int lfs3_emubd_destroy(const struct lfs3_config *cfg) { // block device API -int lfs3_emubd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_emubd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size) { LFS3_EMUBD_TRACE("lfs3_emubd_read(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -362,7 +362,7 @@ int lfs3_emubd_read(const struct lfs3_config *cfg, lfs3_block_t block, return 0; } -int lfs3_emubd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_emubd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size) { LFS3_EMUBD_TRACE("lfs3_emubd_prog(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -671,7 +671,7 @@ progged:; return 0; } -int lfs3_emubd_erase(const struct lfs3_config *cfg, lfs3_block_t block) { +int lfs3_emubd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_erase(%p, 0x%"PRIx32" (%"PRIu32"))", (void*)cfg, block, cfg->block_size); lfs3_emubd_t *bd = cfg->context; @@ -966,7 +966,7 @@ erased:; return 0; } -int lfs3_emubd_sync(const struct lfs3_config *cfg) { +int lfs3_emubd_sync(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_sync(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; @@ -985,7 +985,7 @@ int lfs3_emubd_sync(const struct lfs3_config *cfg) { /// Additional extended API for driving test features /// -void lfs3_emubd_seed(const struct lfs3_config *cfg, uint32_t seed) { +void lfs3_emubd_seed(const struct lfs3_cfg *cfg, uint32_t seed) { LFS3_EMUBD_TRACE("lfs3_emubd_seed(%p, 0x%08"PRIx32")", (void*)cfg, seed); lfs3_emubd_t *bd = cfg->context; @@ -995,7 +995,7 @@ void lfs3_emubd_seed(const struct lfs3_config *cfg, uint32_t seed) { LFS3_EMUBD_TRACE("lfs3_emubd_seed -> _"); } -uint32_t lfs3_emubd_prng(const struct lfs3_config *cfg) { +uint32_t lfs3_emubd_prng(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_prng(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; @@ -1005,28 +1005,28 @@ uint32_t lfs3_emubd_prng(const struct lfs3_config *cfg) { return x; } -lfs3_emubd_sio_t lfs3_emubd_readed(const struct lfs3_config *cfg) { +lfs3_emubd_sio_t lfs3_emubd_readed(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_readed(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; LFS3_EMUBD_TRACE("lfs3_emubd_readed -> %"PRIu64, bd->readed); return bd->readed; } -lfs3_emubd_sio_t lfs3_emubd_proged(const struct lfs3_config *cfg) { +lfs3_emubd_sio_t lfs3_emubd_proged(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_proged(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; LFS3_EMUBD_TRACE("lfs3_emubd_proged -> %"PRIu64, bd->proged); return bd->proged; } -lfs3_emubd_sio_t lfs3_emubd_erased(const struct lfs3_config *cfg) { +lfs3_emubd_sio_t lfs3_emubd_erased(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_erased(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; LFS3_EMUBD_TRACE("lfs3_emubd_erased -> %"PRIu64, bd->erased); return bd->erased; } -int lfs3_emubd_setreaded(const struct lfs3_config *cfg, +int lfs3_emubd_setreaded(const struct lfs3_cfg *cfg, lfs3_emubd_io_t readed) { LFS3_EMUBD_TRACE("lfs3_emubd_setreaded(%p, %"PRIu64")", (void*)cfg, readed); lfs3_emubd_t *bd = cfg->context; @@ -1035,7 +1035,7 @@ int lfs3_emubd_setreaded(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_setproged(const struct lfs3_config *cfg, +int lfs3_emubd_setproged(const struct lfs3_cfg *cfg, lfs3_emubd_io_t proged) { LFS3_EMUBD_TRACE("lfs3_emubd_setproged(%p, %"PRIu64")", (void*)cfg, proged); lfs3_emubd_t *bd = cfg->context; @@ -1044,7 +1044,7 @@ int lfs3_emubd_setproged(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_seterased(const struct lfs3_config *cfg, +int lfs3_emubd_seterased(const struct lfs3_cfg *cfg, lfs3_emubd_io_t erased) { LFS3_EMUBD_TRACE("lfs3_emubd_seterased(%p, %"PRIu64")", (void*)cfg, erased); lfs3_emubd_t *bd = cfg->context; @@ -1053,7 +1053,7 @@ int lfs3_emubd_seterased(const struct lfs3_config *cfg, return 0; } -lfs3_emubd_swear_t lfs3_emubd_wear(const struct lfs3_config *cfg, +lfs3_emubd_swear_t lfs3_emubd_wear(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_wear(%p, %"PRIu32")", (void*)cfg, block); lfs3_emubd_t *bd = cfg->context; @@ -1074,7 +1074,7 @@ lfs3_emubd_swear_t lfs3_emubd_wear(const struct lfs3_config *cfg, return wear; } -int lfs3_emubd_setwear(const struct lfs3_config *cfg, +int lfs3_emubd_setwear(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_emubd_wear_t wear) { LFS3_EMUBD_TRACE("lfs3_emubd_setwear(%p, %"PRIu32", %"PRIi32")", (void*)cfg, block, wear); @@ -1098,7 +1098,7 @@ int lfs3_emubd_setwear(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_markbad(const struct lfs3_config *cfg, +int lfs3_emubd_markbad(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_markbad(%p, %"PRIu32")", (void*)cfg, block); @@ -1128,7 +1128,7 @@ int lfs3_emubd_markbad(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_markgood(const struct lfs3_config *cfg, +int lfs3_emubd_markgood(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_markgood(%p, %"PRIu32")", (void*)cfg, block); @@ -1152,7 +1152,7 @@ int lfs3_emubd_markgood(const struct lfs3_config *cfg, return 0; } -lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_config *cfg, +lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_badbit(%p, %"PRIu32")", (void*)cfg, block); lfs3_emubd_t *bd = cfg->context; @@ -1173,7 +1173,7 @@ lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_config *cfg, return bad_bit; } -int lfs3_emubd_setbadbit(const struct lfs3_config *cfg, +int lfs3_emubd_setbadbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit) { LFS3_EMUBD_TRACE("lfs3_emubd_setbadbit(%p, %"PRIu32", %"PRIu32")", (void*)cfg, block, bit); @@ -1197,7 +1197,7 @@ int lfs3_emubd_setbadbit(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_randomizebadbit(const struct lfs3_config *cfg, +int lfs3_emubd_randomizebadbit(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_EMUBD_TRACE("lfs3_emubd_randomizebadbit(%p, %"PRIu32")", (void*)cfg, block); @@ -1221,7 +1221,7 @@ int lfs3_emubd_randomizebadbit(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_markbadbit(const struct lfs3_config *cfg, +int lfs3_emubd_markbadbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit) { LFS3_EMUBD_TRACE("lfs3_emubd_markbadbit(%p, %"PRIu32", %"PRIu32")", (void*)cfg, block, bit); @@ -1247,7 +1247,7 @@ int lfs3_emubd_markbadbit(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_flipbit_(const struct lfs3_config *cfg, +int lfs3_emubd_flipbit_(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit) { lfs3_emubd_t *bd = cfg->context; @@ -1285,7 +1285,7 @@ int lfs3_emubd_flipbit_(const struct lfs3_config *cfg, } -int lfs3_emubd_flipbit(const struct lfs3_config *cfg, +int lfs3_emubd_flipbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit) { LFS3_EMUBD_TRACE("lfs3_emubd_flipbit(%p, %"PRIu32", %"PRIu32")", (void*)cfg, block, bit); @@ -1301,7 +1301,7 @@ int lfs3_emubd_flipbit(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_flip(const struct lfs3_config *cfg) { +int lfs3_emubd_flip(const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_flip(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; @@ -1323,7 +1323,7 @@ int lfs3_emubd_flip(const struct lfs3_config *cfg) { } lfs3_emubd_spowercycles_t lfs3_emubd_powercycles( - const struct lfs3_config *cfg) { + const struct lfs3_cfg *cfg) { LFS3_EMUBD_TRACE("lfs3_emubd_powercycles(%p)", (void*)cfg); lfs3_emubd_t *bd = cfg->context; @@ -1331,7 +1331,7 @@ lfs3_emubd_spowercycles_t lfs3_emubd_powercycles( return bd->power_cycles; } -int lfs3_emubd_setpowercycles(const struct lfs3_config *cfg, +int lfs3_emubd_setpowercycles(const struct lfs3_cfg *cfg, lfs3_emubd_powercycles_t power_cycles) { LFS3_EMUBD_TRACE("lfs3_emubd_setpowercycles(%p, %"PRIi32")", (void*)cfg, power_cycles); @@ -1343,7 +1343,7 @@ int lfs3_emubd_setpowercycles(const struct lfs3_config *cfg, return 0; } -int lfs3_emubd_cpy(const struct lfs3_config *cfg, lfs3_emubd_t *copy) { +int lfs3_emubd_cpy(const struct lfs3_cfg *cfg, lfs3_emubd_t *copy) { LFS3_EMUBD_TRACE("lfs3_emubd_cpy(%p, %p)", (void*)cfg, (void*)copy); lfs3_emubd_t *bd = cfg->context; diff --git a/bd/lfs3_emubd.h b/bd/lfs3_emubd.h index cdd04db9..4695dbd0 100644 --- a/bd/lfs3_emubd.h +++ b/bd/lfs3_emubd.h @@ -65,7 +65,7 @@ typedef uint64_t lfs3_emubd_sleep_t; typedef int64_t lfs3_emubd_ssleep_t; // emubd config, this is required for testing -struct lfs3_emubd_config { +struct lfs3_emubd_cfg { // 8-bit erase value to use for simulating erases. -1 simulates a noop // erase, which is faster than simulating a fixed erase value. int32_t erase_value; @@ -147,119 +147,119 @@ typedef struct lfs3_emubd { lfs3_emubd_block_t **ooo_after; lfs3_emubd_disk_t *disk; - const struct lfs3_emubd_config *cfg; + const struct lfs3_emubd_cfg *cfg; } lfs3_emubd_t; /// Block device API /// -// Create an emulating block device using the geometry in lfs3_config +// Create an emulating block device using the geometry in lfs3_cfg // // Note that filebd is used if a path is provided, if path is NULL // emubd will use rambd which can be much faster. -int lfs3_emubd_create(const struct lfs3_config *cfg, const char *path); -int lfs3_emubd_createcfg(const struct lfs3_config *cfg, const char *path, - const struct lfs3_emubd_config *bdcfg); +int lfs3_emubd_create(const struct lfs3_cfg *cfg, const char *path); +int lfs3_emubd_createcfg(const struct lfs3_cfg *cfg, const char *path, + const struct lfs3_emubd_cfg *bdcfg); // Clean up memory associated with block device -int lfs3_emubd_destroy(const struct lfs3_config *cfg); +int lfs3_emubd_destroy(const struct lfs3_cfg *cfg); // Read a block -int lfs3_emubd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_emubd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size); // Program a block // // The block must have previously been erased. -int lfs3_emubd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_emubd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size); // Erase a block // // A block must be erased before being programmed. The // state of an erased block is undefined. -int lfs3_emubd_erase(const struct lfs3_config *cfg, lfs3_block_t block); +int lfs3_emubd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block); // Sync the block device -int lfs3_emubd_sync(const struct lfs3_config *cfg); +int lfs3_emubd_sync(const struct lfs3_cfg *cfg); /// Additional extended API for driving test features /// // Set the current prng state -void lfs3_emubd_seed(const struct lfs3_config *cfg, uint32_t seed); +void lfs3_emubd_seed(const struct lfs3_cfg *cfg, uint32_t seed); // Get a pseudo-random number from emubd's internal prng -uint32_t lfs3_emubd_prng(const struct lfs3_config *cfg); +uint32_t lfs3_emubd_prng(const struct lfs3_cfg *cfg); // Get total amount of bytes read -lfs3_emubd_sio_t lfs3_emubd_readed(const struct lfs3_config *cfg); +lfs3_emubd_sio_t lfs3_emubd_readed(const struct lfs3_cfg *cfg); // Get total amount of bytes programmed -lfs3_emubd_sio_t lfs3_emubd_proged(const struct lfs3_config *cfg); +lfs3_emubd_sio_t lfs3_emubd_proged(const struct lfs3_cfg *cfg); // Get total amount of bytes erased -lfs3_emubd_sio_t lfs3_emubd_erased(const struct lfs3_config *cfg); +lfs3_emubd_sio_t lfs3_emubd_erased(const struct lfs3_cfg *cfg); // Manually set amount of bytes read -int lfs3_emubd_setreaded(const struct lfs3_config *cfg, +int lfs3_emubd_setreaded(const struct lfs3_cfg *cfg, lfs3_emubd_io_t readed); // Manually set amount of bytes programmed -int lfs3_emubd_setproged(const struct lfs3_config *cfg, +int lfs3_emubd_setproged(const struct lfs3_cfg *cfg, lfs3_emubd_io_t proged); // Manually set amount of bytes erased -int lfs3_emubd_seterased(const struct lfs3_config *cfg, +int lfs3_emubd_seterased(const struct lfs3_cfg *cfg, lfs3_emubd_io_t erased); // Get simulated wear on a given block -lfs3_emubd_swear_t lfs3_emubd_wear(const struct lfs3_config *cfg, +lfs3_emubd_swear_t lfs3_emubd_wear(const struct lfs3_cfg *cfg, lfs3_block_t block); // Manually set simulated wear on a given block -int lfs3_emubd_setwear(const struct lfs3_config *cfg, +int lfs3_emubd_setwear(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_emubd_wear_t wear); // Mark a block as bad, this is equivalent to setting wear to maximum -int lfs3_emubd_markbad(const struct lfs3_config *cfg, lfs3_block_t block); +int lfs3_emubd_markbad(const struct lfs3_cfg *cfg, lfs3_block_t block); // Clear any simulated wear on a given block -int lfs3_emubd_markgood(const struct lfs3_config *cfg, lfs3_block_t block); +int lfs3_emubd_markgood(const struct lfs3_cfg *cfg, lfs3_block_t block); // Get which bit failed, this changes on erase/power-loss unless manually set -lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_config *cfg, +lfs3_ssize_t lfs3_emubd_badbit(const struct lfs3_cfg *cfg, lfs3_block_t block); // Set which bit should fail in a given block -int lfs3_emubd_setbadbit(const struct lfs3_config *cfg, +int lfs3_emubd_setbadbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit); // Randomize the bad bit on erase (the default) -int lfs3_emubd_randomizebadbit(const struct lfs3_config *cfg, +int lfs3_emubd_randomizebadbit(const struct lfs3_cfg *cfg, lfs3_block_t block); // Mark a block as bad and which bit should fail -int lfs3_emubd_markbadbit(const struct lfs3_config *cfg, +int lfs3_emubd_markbadbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit); // Flip a bit in a given block, intended for emulating bit errors -int lfs3_emubd_flipbit(const struct lfs3_config *cfg, +int lfs3_emubd_flipbit(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_size_t bit); // Flip all bits marked as bad -int lfs3_emubd_flip(const struct lfs3_config *cfg); +int lfs3_emubd_flip(const struct lfs3_cfg *cfg); // Get the remaining power-cycles lfs3_emubd_spowercycles_t lfs3_emubd_powercycles( - const struct lfs3_config *cfg); + const struct lfs3_cfg *cfg); // Manually set the remaining power-cycles -int lfs3_emubd_setpowercycles(const struct lfs3_config *cfg, +int lfs3_emubd_setpowercycles(const struct lfs3_cfg *cfg, lfs3_emubd_powercycles_t power_cycles); // Create a copy-on-write copy of the state of this block device -int lfs3_emubd_cpy(const struct lfs3_config *cfg, lfs3_emubd_t *copy); +int lfs3_emubd_cpy(const struct lfs3_cfg *cfg, lfs3_emubd_t *copy); #endif diff --git a/bd/lfs3_filebd.c b/bd/lfs3_filebd.c index 7fc4c514..5caefbd0 100644 --- a/bd/lfs3_filebd.c +++ b/bd/lfs3_filebd.c @@ -15,7 +15,7 @@ #include #endif -int lfs3_filebd_create(const struct lfs3_config *cfg, const char *path) { +int lfs3_filebd_create(const struct lfs3_cfg *cfg, const char *path) { LFS3_FILEBD_TRACE("lfs3_filebd_create(%p {.context=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read_size=%"PRIu32", .prog_size=%"PRIu32", " @@ -45,7 +45,7 @@ int lfs3_filebd_create(const struct lfs3_config *cfg, const char *path) { return 0; } -int lfs3_filebd_destroy(const struct lfs3_config *cfg) { +int lfs3_filebd_destroy(const struct lfs3_cfg *cfg) { LFS3_FILEBD_TRACE("lfs3_filebd_destroy(%p)", (void*)cfg); lfs3_filebd_t *bd = cfg->context; int err = close(bd->fd); @@ -58,7 +58,7 @@ int lfs3_filebd_destroy(const struct lfs3_config *cfg) { return 0; } -int lfs3_filebd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_filebd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size) { LFS3_FILEBD_TRACE("lfs3_filebd_read(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -94,7 +94,7 @@ int lfs3_filebd_read(const struct lfs3_config *cfg, lfs3_block_t block, return 0; } -int lfs3_filebd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_filebd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size) { LFS3_FILEBD_TRACE("lfs3_filebd_prog(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -127,7 +127,7 @@ int lfs3_filebd_prog(const struct lfs3_config *cfg, lfs3_block_t block, return 0; } -int lfs3_filebd_erase(const struct lfs3_config *cfg, lfs3_block_t block) { +int lfs3_filebd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_FILEBD_TRACE("lfs3_filebd_erase(%p, 0x%"PRIx32" (%"PRIu32"))", (void*)cfg, block, cfg->block_size); @@ -141,7 +141,7 @@ int lfs3_filebd_erase(const struct lfs3_config *cfg, lfs3_block_t block) { return 0; } -int lfs3_filebd_sync(const struct lfs3_config *cfg) { +int lfs3_filebd_sync(const struct lfs3_cfg *cfg) { LFS3_FILEBD_TRACE("lfs3_filebd_sync(%p)", (void*)cfg); // file sync diff --git a/bd/lfs3_filebd.h b/bd/lfs3_filebd.h index 846d110a..0d24b508 100644 --- a/bd/lfs3_filebd.h +++ b/bd/lfs3_filebd.h @@ -27,30 +27,30 @@ typedef struct lfs3_filebd { } lfs3_filebd_t; -// Create a file block device using the geometry in lfs3_config -int lfs3_filebd_create(const struct lfs3_config *cfg, const char *path); +// Create a file block device using the geometry in lfs3_cfg +int lfs3_filebd_create(const struct lfs3_cfg *cfg, const char *path); // Clean up memory associated with block device -int lfs3_filebd_destroy(const struct lfs3_config *cfg); +int lfs3_filebd_destroy(const struct lfs3_cfg *cfg); // Read a block -int lfs3_filebd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_filebd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size); // Program a block // // The block must have previously been erased. -int lfs3_filebd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_filebd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size); // Erase a block // // A block must be erased before being programmed. The // state of an erased block is undefined. -int lfs3_filebd_erase(const struct lfs3_config *cfg, lfs3_block_t block); +int lfs3_filebd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block); // Sync the block device -int lfs3_filebd_sync(const struct lfs3_config *cfg); +int lfs3_filebd_sync(const struct lfs3_cfg *cfg); #endif diff --git a/bd/lfs3_rambd.c b/bd/lfs3_rambd.c index 2c0ff16e..43016c97 100644 --- a/bd/lfs3_rambd.c +++ b/bd/lfs3_rambd.c @@ -7,8 +7,8 @@ */ #include "bd/lfs3_rambd.h" -int lfs3_rambd_createcfg(const struct lfs3_config *cfg, - const struct lfs3_rambd_config *bdcfg) { +int lfs3_rambd_createcfg(const struct lfs3_cfg *cfg, + const struct lfs3_rambd_cfg *bdcfg) { LFS3_RAMBD_TRACE("lfs3_rambd_createcfg(%p {.context=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read_size=%"PRIu32", .prog_size=%"PRIu32", " @@ -40,7 +40,7 @@ int lfs3_rambd_createcfg(const struct lfs3_config *cfg, return 0; } -int lfs3_rambd_create(const struct lfs3_config *cfg) { +int lfs3_rambd_create(const struct lfs3_cfg *cfg) { LFS3_RAMBD_TRACE("lfs3_rambd_create(%p {.context=%p, " ".read=%p, .prog=%p, .erase=%p, .sync=%p, " ".read_size=%"PRIu32", .prog_size=%"PRIu32", " @@ -49,13 +49,13 @@ int lfs3_rambd_create(const struct lfs3_config *cfg) { (void*)(uintptr_t)cfg->read, (void*)(uintptr_t)cfg->prog, (void*)(uintptr_t)cfg->erase, (void*)(uintptr_t)cfg->sync, cfg->read_size, cfg->prog_size, cfg->block_size, cfg->block_count); - static const struct lfs3_rambd_config defaults = {0}; + static const struct lfs3_rambd_cfg defaults = {0}; int err = lfs3_rambd_createcfg(cfg, &defaults); LFS3_RAMBD_TRACE("lfs3_rambd_create -> %d", err); return err; } -int lfs3_rambd_destroy(const struct lfs3_config *cfg) { +int lfs3_rambd_destroy(const struct lfs3_cfg *cfg) { LFS3_RAMBD_TRACE("lfs3_rambd_destroy(%p)", (void*)cfg); // clean up memory lfs3_rambd_t *bd = cfg->context; @@ -66,7 +66,7 @@ int lfs3_rambd_destroy(const struct lfs3_config *cfg) { return 0; } -int lfs3_rambd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_rambd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size) { LFS3_RAMBD_TRACE("lfs3_rambd_read(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -86,7 +86,7 @@ int lfs3_rambd_read(const struct lfs3_config *cfg, lfs3_block_t block, return 0; } -int lfs3_rambd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_rambd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size) { LFS3_RAMBD_TRACE("lfs3_rambd_prog(%p, " "0x%"PRIx32", %"PRIu32", %p, %"PRIu32")", @@ -106,7 +106,7 @@ int lfs3_rambd_prog(const struct lfs3_config *cfg, lfs3_block_t block, return 0; } -int lfs3_rambd_erase(const struct lfs3_config *cfg, lfs3_block_t block) { +int lfs3_rambd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block) { LFS3_RAMBD_TRACE("lfs3_rambd_erase(%p, 0x%"PRIx32" (%"PRIu32"))", (void*)cfg, block, cfg->block_size); @@ -120,7 +120,7 @@ int lfs3_rambd_erase(const struct lfs3_config *cfg, lfs3_block_t block) { return 0; } -int lfs3_rambd_sync(const struct lfs3_config *cfg) { +int lfs3_rambd_sync(const struct lfs3_cfg *cfg) { LFS3_RAMBD_TRACE("lfs3_rambd_sync(%p)", (void*)cfg); // sync is a noop diff --git a/bd/lfs3_rambd.h b/bd/lfs3_rambd.h index 3aa2ad7d..26b1ddc3 100644 --- a/bd/lfs3_rambd.h +++ b/bd/lfs3_rambd.h @@ -22,7 +22,7 @@ #endif // rambd config (optional) -struct lfs3_rambd_config { +struct lfs3_rambd_cfg { // Optional statically allocated buffer for the block device. void *buffer; }; @@ -30,36 +30,36 @@ struct lfs3_rambd_config { // rambd state typedef struct lfs3_rambd { uint8_t *buffer; - const struct lfs3_rambd_config *cfg; + const struct lfs3_rambd_cfg *cfg; } lfs3_rambd_t; -// Create a RAM block device using the geometry in lfs3_config -int lfs3_rambd_create(const struct lfs3_config *cfg); -int lfs3_rambd_createcfg(const struct lfs3_config *cfg, - const struct lfs3_rambd_config *bdcfg); +// Create a RAM block device using the geometry in lfs3_cfg +int lfs3_rambd_create(const struct lfs3_cfg *cfg); +int lfs3_rambd_createcfg(const struct lfs3_cfg *cfg, + const struct lfs3_rambd_cfg *bdcfg); // Clean up memory associated with block device -int lfs3_rambd_destroy(const struct lfs3_config *cfg); +int lfs3_rambd_destroy(const struct lfs3_cfg *cfg); // Read a block -int lfs3_rambd_read(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_rambd_read(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size); // Program a block // // The block must have previously been erased. -int lfs3_rambd_prog(const struct lfs3_config *cfg, lfs3_block_t block, +int lfs3_rambd_prog(const struct lfs3_cfg *cfg, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size); // Erase a block // // A block must be erased before being programmed. The // state of an erased block is undefined. -int lfs3_rambd_erase(const struct lfs3_config *cfg, lfs3_block_t block); +int lfs3_rambd_erase(const struct lfs3_cfg *cfg, lfs3_block_t block); // Sync the block device -int lfs3_rambd_sync(const struct lfs3_config *cfg); +int lfs3_rambd_sync(const struct lfs3_cfg *cfg); #endif diff --git a/lfs3.c b/lfs3.c index bcc8b021..d84a0c29 100644 --- a/lfs3.c +++ b/lfs3.c @@ -11585,7 +11585,7 @@ static inline lfs3_off_t lfs3_file_size_(const lfs3_file_t *file) { // file operations static void lfs3_file_init(lfs3_file_t *file, uint32_t flags, - const struct lfs3_file_config *cfg) { + const struct lfs3_file_cfg *cfg) { file->cfg = cfg; file->b.h.flags = lfs3_o_typeflags(LFS3_TYPE_REG) | flags; #ifndef LFS3_KVONLY @@ -11672,7 +11672,7 @@ static int lfs3_file_ck(lfs3_t *lfs3, const lfs3_file_t *file, int lfs3_file_opencfg_(lfs3_t *lfs3, lfs3_file_t *file, const char *path, uint32_t flags, - const struct lfs3_file_config *cfg) { + const struct lfs3_file_cfg *cfg) { #ifndef LFS3_RDONLY if (!lfs3_o_isrdonly(flags)) { // prepare our filesystem for writing @@ -11857,7 +11857,7 @@ failed:; int lfs3_file_opencfg(lfs3_t *lfs3, lfs3_file_t *file, const char *path, uint32_t flags, - const struct lfs3_file_config *cfg) { + const struct lfs3_file_cfg *cfg) { // already open? LFS3_ASSERT(!lfs3_handle_isopen(lfs3, &file->b.h)); // don't allow the forbidden mode! @@ -11897,7 +11897,7 @@ int lfs3_file_opencfg(lfs3_t *lfs3, lfs3_file_t *file, } // default file config -static const struct lfs3_file_config lfs3_file_defaultcfg = {0}; +static const struct lfs3_file_cfg lfs3_file_defaultcfg = {0}; int lfs3_file_open(lfs3_t *lfs3, lfs3_file_t *file, const char *path, uint32_t flags) { @@ -14180,7 +14180,7 @@ int lfs3_file_ckdata(lfs3_t *lfs3, lfs3_file_t *file) { // advanced file operations // kv file config, we need to explicitly disable the file cache -static const struct lfs3_file_config lfs3_file_kvconfig = { +static const struct lfs3_file_cfg lfs3_file_kvcfg = { // TODO is this the best way to do this? .cache_buffer = (uint8_t*)1, .cache_size = 0, @@ -14192,7 +14192,7 @@ lfs3_ssize_t lfs3_get(lfs3_t *lfs3, const char *path, // bypass the cache lfs3_file_t file; int err = lfs3_file_opencfg(lfs3, &file, path, LFS3_O_RDONLY, - &lfs3_file_kvconfig); + &lfs3_file_kvcfg); if (err) { return err; } @@ -14216,7 +14216,7 @@ lfs3_ssize_t lfs3_size(lfs3_t *lfs3, const char *path) { // bypass the cache lfs3_file_t file; int err = lfs3_file_opencfg(lfs3, &file, path, LFS3_O_RDONLY, - &lfs3_file_kvconfig); + &lfs3_file_kvcfg); if (err) { return err; } @@ -14244,7 +14244,7 @@ int lfs3_set(lfs3_t *lfs3, const char *path, // normally in lfs3_file_close, lfs3_file_sync has its own logic // to try to commit small files atomically // - struct lfs3_file_config cfg = { + struct lfs3_file_cfg cfg = { .cache_buffer = (uint8_t*)buffer, .cache_size = size, }; @@ -14271,7 +14271,7 @@ static int lfs3_deinit(lfs3_t *lfs3); // initialize littlefs state, assert on bad configuration static int lfs3_init(lfs3_t *lfs3, uint32_t flags, - const struct lfs3_config *cfg) { + const struct lfs3_cfg *cfg) { // unknown flags? LFS3_ASSERT((flags & ~( LFS3_IFDEF_RDONLY(0, LFS3_M_RDWR) @@ -15130,7 +15130,7 @@ static int lfs3_fs_gc_(lfs3_t *lfs3, lfs3_trv_t *trv, uint32_t flags, lfs3_soff_t steps); int lfs3_mount(lfs3_t *lfs3, uint32_t flags, - const struct lfs3_config *cfg) { + const struct lfs3_cfg *cfg) { #ifdef LFS3_YES_RDONLY flags |= LFS3_M_RDONLY; #endif @@ -15366,7 +15366,7 @@ static int lfs3_formatinited(lfs3_t *lfs3) { #ifndef LFS3_RDONLY int lfs3_format(lfs3_t *lfs3, uint32_t flags, - const struct lfs3_config *cfg) { + const struct lfs3_cfg *cfg) { #ifdef LFS3_YES_REVDBG flags |= LFS3_F_REVDBG; #endif diff --git a/lfs3.h b/lfs3.h index 627bae2c..bdd752f0 100644 --- a/lfs3.h +++ b/lfs3.h @@ -337,21 +337,21 @@ enum lfs3_btype { // Configuration provided during initialization of the littlefs -struct lfs3_config { +struct lfs3_cfg { // Opaque user provided context that can be used to pass // information to the block device operations void *context; // Read a region in a block. Negative error codes are propagated // to the user. - int (*read)(const struct lfs3_config *c, lfs3_block_t block, + int (*read)(const struct lfs3_cfg *c, lfs3_block_t block, lfs3_off_t off, void *buffer, lfs3_size_t size); // Program a region in a block. The block must have previously // been erased. Negative error codes are propagated to the user. // May return LFS3_ERR_CORRUPT if the block should be considered bad. #ifndef LFS3_RDONLY - int (*prog)(const struct lfs3_config *c, lfs3_block_t block, + int (*prog)(const struct lfs3_cfg *c, lfs3_block_t block, lfs3_off_t off, const void *buffer, lfs3_size_t size); #endif @@ -360,23 +360,23 @@ struct lfs3_config { // are propagated to the user. // May return LFS3_ERR_CORRUPT if the block should be considered bad. #ifndef LFS3_RDONLY - int (*erase)(const struct lfs3_config *c, lfs3_block_t block); + int (*erase)(const struct lfs3_cfg *c, lfs3_block_t block); #endif // Sync the state of the underlying block device. Negative error codes // are propagated to the user. #ifndef LFS3_RDONLY - int (*sync)(const struct lfs3_config *c); + int (*sync)(const struct lfs3_cfg *c); #endif #ifdef LFS3_THREADSAFE // Lock the underlying block device. Negative error codes // are propagated to the user. - int (*lock)(const struct lfs3_config *c); + int (*lock)(const struct lfs3_cfg *c); // Unlock the underlying block device. Negative error codes // are propagated to the user. - int (*unlock)(const struct lfs3_config *c); + int (*unlock)(const struct lfs3_cfg *c); #endif // Minimum size of a read in bytes. All read operations will be a @@ -597,7 +597,7 @@ struct lfs3_attr { }; // Optional configuration provided during lfs3_file_opencfg -struct lfs3_file_config { +struct lfs3_file_cfg { // Optional statically allocated file cache buffer. Must be cache_size. // By default lfs3_malloc is used to allocate this buffer. void *cache_buffer; @@ -722,7 +722,7 @@ typedef struct lfs3_bshrub { typedef struct lfs3_file { // btree/bshrub stuff is in here lfs3_bshrub_t b; - const struct lfs3_file_config *cfg; + const struct lfs3_file_cfg *cfg; // current file position #ifndef LFS3_KVONLY @@ -804,7 +804,7 @@ typedef struct lfs3_grm { // The littlefs filesystem type typedef struct lfs3 { - const struct lfs3_config *cfg; + const struct lfs3_cfg *cfg; uint32_t flags; lfs3_size_t block_count; lfs3_size_t name_limit; @@ -901,7 +901,7 @@ typedef struct lfs3 { // Returns a negative error code on failure. #ifndef LFS3_RDONLY int lfs3_format(lfs3_t *lfs3, uint32_t flags, - const struct lfs3_config *cfg); + const struct lfs3_cfg *cfg); #endif // Mounts a littlefs @@ -913,7 +913,7 @@ int lfs3_format(lfs3_t *lfs3, uint32_t flags, // // Returns a negative error code on failure. int lfs3_mount(lfs3_t *lfs3, uint32_t flags, - const struct lfs3_config *cfg); + const struct lfs3_cfg *cfg); // Unmounts a littlefs // @@ -1023,7 +1023,7 @@ int lfs3_file_open(lfs3_t *lfs3, lfs3_file_t *file, #ifndef LFS3_KVONLY int lfs3_file_opencfg(lfs3_t *lfs3, lfs3_file_t *file, const char *path, uint32_t flags, - const struct lfs3_file_config *cfg); + const struct lfs3_file_cfg *cfg); #endif // Close a file diff --git a/lfs3_util.h b/lfs3_util.h index 9075e1fe..8ee727bc 100644 --- a/lfs3_util.h +++ b/lfs3_util.h @@ -9,15 +9,15 @@ #define LFS3_UTIL_H // Users can override lfs3_util.h with their own configuration by defining -// LFS3_CONFIG as a header file to include (-DLFS_CONFIG=lfs3_config.h). +// LFS3_CFG as a header file to include (-DLFS3_CFG=my_cfg.h). // -// If LFS3_CONFIG is used, none of the default utils will be emitted and must be +// If LFS3_CFG is used, none of the default utils will be emitted and must be // provided by the config file. To start, I would suggest copying lfs3_util.h // and modifying as needed. -#ifdef LFS3_CONFIG +#ifdef LFS3_CFG #define LFS3_STRINGIZE(x) LFS3_STRINGIZE2(x) #define LFS3_STRINGIZE2(x) #x -#include LFS3_STRINGIZE(LFS3_CONFIG) +#include LFS3_STRINGIZE(LFS3_CFG) #else diff --git a/runners/bench_runner.c b/runners/bench_runner.c index 5d210ed4..d29e8538 100644 --- a/runners/bench_runner.c +++ b/runners/bench_runner.c @@ -612,12 +612,12 @@ typedef struct bench_record { lfs3_emubd_io_t last_erased; } bench_record_t; -static struct lfs3_config *bench_cfg = NULL; +static struct lfs3_cfg *bench_cfg = NULL; static bench_record_t *bench_records; size_t bench_record_count; size_t bench_record_capacity; -void bench_reset(struct lfs3_config *cfg) { +void bench_reset(struct lfs3_cfg *cfg) { bench_cfg = cfg; bench_record_count = 0; } @@ -1337,7 +1337,7 @@ void perm_run( // create block device and configuration lfs3_emubd_t bd; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1346,7 +1346,7 @@ void perm_run( BENCH_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = bench_disk_path, .read_sleep = bench_read_sleep, .prog_sleep = bench_prog_sleep, diff --git a/runners/bench_runner.h b/runners/bench_runner.h index a6ea00ab..ebb048a6 100644 --- a/runners/bench_runner.h +++ b/runners/bench_runner.h @@ -45,7 +45,7 @@ void bench_fresult(const char *m, uintmax_t n, double result); // generated bench configurations -struct lfs3_config; +struct lfs3_cfg; enum bench_flags { BENCH_INTERNAL = 0x1, @@ -69,7 +69,7 @@ struct bench_case { size_t permutations; bool (*if_)(void); - void (*run)(struct lfs3_config *cfg); + void (*run)(struct lfs3_cfg *cfg); }; struct bench_suite { diff --git a/runners/test_runner.c b/runners/test_runner.c index 56938d1a..7b4c325c 100644 --- a/runners/test_runner.c +++ b/runners/test_runner.c @@ -1301,7 +1301,7 @@ static void run_powerloss_none( // create block device and configuration lfs3_emubd_t bd; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1310,7 +1310,7 @@ static void run_powerloss_none( TEST_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = test_disk_path, .read_sleep = test_read_sleep, .prog_sleep = test_prog_sleep, @@ -1362,7 +1362,7 @@ static void run_powerloss_linear( lfs3_emubd_t bd; jmp_buf powerloss_jmp; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1371,7 +1371,7 @@ static void run_powerloss_linear( TEST_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = test_disk_path, .read_sleep = test_read_sleep, .prog_sleep = test_prog_sleep, @@ -1439,7 +1439,7 @@ static void run_powerloss_log( lfs3_emubd_t bd; jmp_buf powerloss_jmp; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1448,7 +1448,7 @@ static void run_powerloss_log( TEST_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = test_disk_path, .read_sleep = test_read_sleep, .prog_sleep = test_prog_sleep, @@ -1516,7 +1516,7 @@ static void run_powerloss_cycles( lfs3_emubd_t bd; jmp_buf powerloss_jmp; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1525,7 +1525,7 @@ static void run_powerloss_cycles( TEST_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = test_disk_path, .read_sleep = test_read_sleep, .prog_sleep = test_prog_sleep, @@ -1582,7 +1582,7 @@ static void run_powerloss_cycles( } struct powerloss_exhaustive_state { - struct lfs3_config *cfg; + struct lfs3_cfg *cfg; lfs3_emubd_t *branches; size_t branch_count; @@ -1623,8 +1623,8 @@ static void run_powerloss_exhaustive_layer( struct powerloss_exhaustive_cycles *cycles, const struct test_suite *suite, const struct test_case *case_, - struct lfs3_config *cfg, - struct lfs3_emubd_config *bdcfg, + struct lfs3_cfg *cfg, + struct lfs3_emubd_cfg *bdcfg, size_t depth, size_t pls) { struct powerloss_exhaustive_state state = { @@ -1691,7 +1691,7 @@ static void run_powerloss_exhaustive( // create block device and configuration lfs3_emubd_t bd; - struct lfs3_config cfg = { + struct lfs3_cfg cfg = { .context = &bd, .read = lfs3_emubd_read, .prog = lfs3_emubd_prog, @@ -1700,7 +1700,7 @@ static void run_powerloss_exhaustive( TEST_CFG }; - struct lfs3_emubd_config bdcfg = { + struct lfs3_emubd_cfg bdcfg = { .disk_path = test_disk_path, .read_sleep = test_read_sleep, .prog_sleep = test_prog_sleep, diff --git a/runners/test_runner.h b/runners/test_runner.h index 79f2bdb5..7223dfcf 100644 --- a/runners/test_runner.h +++ b/runners/test_runner.h @@ -30,7 +30,7 @@ void test_trace(const char *fmt, ...); // generated test configurations -struct lfs3_config; +struct lfs3_cfg; enum test_flags { TEST_INTERNAL = 0x1, @@ -56,7 +56,7 @@ struct test_case { size_t permutations; bool (*if_)(void); - void (*run)(struct lfs3_config *cfg); + void (*run)(struct lfs3_cfg *cfg); }; struct test_suite { diff --git a/scripts/bench.py b/scripts/bench.py index e17fe379..b5cf7526 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -443,7 +443,7 @@ def compile(bench_paths, **args): # create case run function f.writeln('void __bench__%s__run(' '__attribute__((unused)) ' - 'struct lfs3_config *CFG) {' % ( + 'struct lfs3_cfg *CFG) {' % ( case.name)) f.writeln(4*' '+'// bench case %s' % case.name) if case.code_lineno is not None: @@ -506,7 +506,7 @@ def compile(bench_paths, **args): 'void);' % ( case.name)) f.writeln('extern void __bench__%s__run(' - 'struct lfs3_config *CFG);' % ( + 'struct lfs3_cfg *CFG);' % ( case.name)) f.writeln() diff --git a/scripts/test.py b/scripts/test.py index 0d2f2f1c..41fc7080 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -455,7 +455,7 @@ def compile(test_paths, **args): # create case run function f.writeln('void __test__%s__run(' '__attribute__((unused)) ' - 'struct lfs3_config *CFG) {' % ( + 'struct lfs3_cfg *CFG) {' % ( case.name)) f.writeln(4*' '+'// test case %s' % case.name) if case.code_lineno is not None: @@ -518,7 +518,7 @@ def compile(test_paths, **args): 'void);' % ( case.name)) f.writeln('extern void __test__%s__run(' - 'struct lfs3_config *CFG);' % ( + 'struct lfs3_cfg *CFG);' % ( case.name)) f.writeln() diff --git a/tests/test_alloc.toml b/tests/test_alloc.toml index c88ea52a..94f7df0a 100644 --- a/tests/test_alloc.toml +++ b/tests/test_alloc.toml @@ -23,7 +23,7 @@ defines.ERASE = [false, true] in = 'lfs3.c' code = ''' // test various block counts - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -67,7 +67,7 @@ defines.ERASE = [false, true] in = 'lfs3.c' code = ''' // test various block counts - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -647,7 +647,7 @@ defines.COUNT = [ ] code = ''' // test various block counts - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -729,7 +729,7 @@ defines.SIZE = [ ] code = ''' // test various block counts - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; diff --git a/tests/test_attrs.toml b/tests/test_attrs.toml index f846ed48..364e3099 100644 --- a/tests/test_attrs.toml +++ b/tests/test_attrs.toml @@ -2071,7 +2071,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2153,7 +2153,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2225,7 +2225,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2299,7 +2299,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2365,7 +2365,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2438,7 +2438,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2536,7 +2536,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2647,7 +2647,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2755,7 +2755,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2869,7 +2869,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -2981,7 +2981,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -3092,7 +3092,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -3190,7 +3190,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -3298,7 +3298,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -3406,7 +3406,7 @@ code = ''' .size = (MUTSIZE) ? &c_size : NULL, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 3, }; @@ -3508,7 +3508,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -3532,7 +3532,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -3622,7 +3622,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -3646,7 +3646,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -3727,7 +3727,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -3751,7 +3751,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -3834,7 +3834,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -3858,7 +3858,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -3935,7 +3935,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -3959,7 +3959,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4126,7 +4126,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -4150,7 +4150,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4278,7 +4278,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -4302,7 +4302,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4467,7 +4467,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -4491,7 +4491,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4617,7 +4617,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -4641,7 +4641,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4750,7 +4750,7 @@ code = ''' uint8_t c_buf[3][256]; lfs3_ssize_t c_size[3]; struct lfs3_attr attrs[3][3]; - struct lfs3_file_config filecfg[3]; + struct lfs3_file_cfg filecfg[3]; lfs3_file_t file[3]; for (lfs3_size_t i = 0; i < 3; i++) { attrs[i][0] = (struct lfs3_attr){ @@ -4774,7 +4774,7 @@ code = ''' .buffer_size = sizeof(c_buf[i]), .size = (MUTSIZE) ? &c_size[i] : NULL, }; - filecfg[i] = (struct lfs3_file_config){ + filecfg[i] = (struct lfs3_file_cfg){ .attrs = attrs[i], .attr_count = 3, }; @@ -4992,7 +4992,7 @@ code = ''' .size = &a_size, } }; - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = 1, }; @@ -5069,7 +5069,7 @@ code = ''' .buffer_size = SIZE, }; } - struct lfs3_file_config filecfg = { + struct lfs3_file_cfg filecfg = { .attrs = attrs, .attr_count = M, }; @@ -5136,7 +5136,7 @@ code = ''' uint8_t a_buf[N][M][SIZE]; lfs3_ssize_t a_size[N][M]; struct lfs3_attr attrs[N][M]; - struct lfs3_file_config filecfg[N]; + struct lfs3_file_cfg filecfg[N]; lfs3_file_t file[N]; // create N files @@ -5152,7 +5152,7 @@ code = ''' .size = &a_size[x][a], }; } - filecfg[x] = (struct lfs3_file_config){ + filecfg[x] = (struct lfs3_file_cfg){ .attrs = attrs[x], .attr_count = M, }; @@ -5254,7 +5254,7 @@ code = ''' uint8_t a_buf[N][H][M][SIZE]; lfs3_ssize_t a_size[N][H][M]; struct lfs3_attr attrs[N][H][M]; - struct lfs3_file_config filecfg[N][H]; + struct lfs3_file_cfg filecfg[N][H]; lfs3_file_t file[N][H]; // create N files @@ -5271,7 +5271,7 @@ code = ''' .size = &a_size[x][y][a], }; } - filecfg[x][y] = (struct lfs3_file_config){ + filecfg[x][y] = (struct lfs3_file_cfg){ .attrs = attrs[x][y], .attr_count = M, }; @@ -5381,7 +5381,7 @@ code = ''' uint8_t a_buf[N][M][SIZE]; lfs3_ssize_t a_size[N][M]; struct lfs3_attr attrs[N][M]; - struct lfs3_file_config filecfg[N]; + struct lfs3_file_cfg filecfg[N]; lfs3_file_t file[N]; // create N files @@ -5397,7 +5397,7 @@ code = ''' .size = &a_size[x][a], }; } - filecfg[x] = (struct lfs3_file_config){ + filecfg[x] = (struct lfs3_file_cfg){ .attrs = attrs[x], .attr_count = M, }; @@ -5634,7 +5634,7 @@ code = ''' uint8_t a_buf[M][SIZE]; lfs3_ssize_t a_size[M]; struct lfs3_attr attrs[M]; - struct lfs3_file_config filecfg; + struct lfs3_file_cfg filecfg; lfs3_file_t file; for (lfs3_size_t a = 0; a < M; a++) { attrs[a] = (struct lfs3_attr){ @@ -5645,7 +5645,7 @@ code = ''' .size = &a_size[a], }; } - filecfg = (struct lfs3_file_config){ + filecfg = (struct lfs3_file_cfg){ .attrs = attrs, .attr_count = M, }; @@ -5710,7 +5710,7 @@ code = ''' uint8_t a_buf[M][SIZE]; lfs3_ssize_t a_size[M]; struct lfs3_attr attrs[M]; - struct lfs3_file_config filecfg; + struct lfs3_file_cfg filecfg; lfs3_file_t file; for (lfs3_size_t a = 0; a < M; a++) { attrs[a] = (struct lfs3_attr){ @@ -5721,7 +5721,7 @@ code = ''' .size = &a_size[a], }; } - filecfg = (struct lfs3_file_config){ + filecfg = (struct lfs3_file_cfg){ .attrs = attrs, .attr_count = M, }; diff --git a/tests/test_compat.toml b/tests/test_compat.toml index 992ffa41..d915cdfa 100644 --- a/tests/test_compat.toml +++ b/tests/test_compat.toml @@ -37,7 +37,7 @@ code = ''' #define LFSP_DISK_VERSION_MAJOR LFS3_DISK_VERSION_MAJOR #define LFSP_DISK_VERSION_MINOR LFS3_DISK_VERSION_MINOR #define lfsp_t lfs3_t -#define lfsp_config lfs3_config +#define lfsp_cfg lfs3_cfg #define LFSP_ERR_NOENT LFS3_ERR_NOENT #define lfsp_format lfs3_format #define LFSP_M_RDWR LFS3_M_RDWR @@ -78,8 +78,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -105,8 +105,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -165,8 +165,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -255,8 +255,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -372,8 +372,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -439,8 +439,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -561,8 +561,8 @@ if = [ ] code = ''' // create the previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfs3_format(&lfsp, LFS3_F_RDWR, &cfgp) => 0; @@ -724,8 +724,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -757,8 +757,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -829,8 +829,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -922,8 +922,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -1024,8 +1024,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -1109,8 +1109,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; @@ -1234,8 +1234,8 @@ code = ''' ////// // now mount with previous version - struct lfsp_config cfgp; - assert(sizeof(struct lfsp_config) == sizeof(struct lfs3_config)); + struct lfsp_cfg cfgp; + assert(sizeof(struct lfsp_cfg) == sizeof(struct lfs3_cfg)); memcpy(&cfgp, CFG, sizeof(cfgp)); lfsp_t lfsp; lfsp_mount(&lfsp, LFSP_M_RDWR, &cfgp) => 0; diff --git a/tests/test_exhaustion.toml b/tests/test_exhaustion.toml index 243d4925..85153ef7 100644 --- a/tests/test_exhaustion.toml +++ b/tests/test_exhaustion.toml @@ -51,7 +51,7 @@ code = ''' } // configure the filesystem size - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = run_bc[run]; // run the test @@ -269,7 +269,7 @@ code = ''' } // configure the filesystem size - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = run_bc[run]; // run the test @@ -557,7 +557,7 @@ code = ''' } // configure the filesystem size - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = run_bc[run]; // run the test @@ -737,7 +737,7 @@ code = ''' } // configure the filesystem size - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = run_bc[run]; // run the test @@ -1242,7 +1242,7 @@ code = ''' } // configure the filesystem size - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = run_bc[run]; // run the test diff --git a/tests/test_grow.toml b/tests/test_grow.toml index 70a31ad3..6a7ce313 100644 --- a/tests/test_grow.toml +++ b/tests/test_grow.toml @@ -26,7 +26,7 @@ defines.BIGGER_BLOCK_COUNT = [ if = 'BIGGER_BLOCK_COUNT > SMALLER_BLOCK_COUNT' code = ''' // create a smaller fs - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = SMALLER_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -145,7 +145,7 @@ defines.BIGGER_BLOCK_COUNT = [ if = 'BIGGER_BLOCK_COUNT > SMALLER_BLOCK_COUNT' code = ''' // create a bigger fs - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = BIGGER_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -206,7 +206,7 @@ defines.BIGGER_BLOCK_COUNT = [ if = 'BIGGER_BLOCK_COUNT > SMALLER_BLOCK_COUNT' code = ''' // create a smaller fs - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = SMALLER_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -321,7 +321,7 @@ defines.SMALLER_BLOCK_COUNT = [ ] code = ''' // create a smaller fs - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = SMALLER_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -438,7 +438,7 @@ defines.REMOUNT = [false, true] defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -581,7 +581,7 @@ defines.SEED = 'range(10)' fuzz = 'SEED' code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -812,7 +812,7 @@ defines.SIZE = [ if = '(SIZE*N)/BLOCK_SIZE <= 32' code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -961,7 +961,7 @@ fuzz = 'SEED' if = '(SIZE*N)/BLOCK_SIZE <= 16' code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -1255,7 +1255,7 @@ fuzz = 'SEED' if = '(SIZE*N)/BLOCK_SIZE <= 16' code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -1755,7 +1755,7 @@ fuzz = 'SEED' if = '(SIZE*N)/BLOCK_SIZE <= 16' code = ''' // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_t lfs3; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; @@ -2369,7 +2369,7 @@ code = ''' int err = lfs3_mount(&lfs3, LFS3_M_RDWR, CFG); if (err) { // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; // mount with maximum block count @@ -2682,7 +2682,7 @@ code = ''' int err = lfs3_mount(&lfs3, LFS3_M_RDWR, CFG); if (err) { // start with a small number of blocks - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_count = INIT_BLOCK_COUNT; lfs3_format(&lfs3, LFS3_F_RDWR, &cfg) => 0; // mount with maximum block count diff --git a/tests/test_trvs.toml b/tests/test_trvs.toml index 01d34d22..22c5bdd3 100644 --- a/tests/test_trvs.toml +++ b/tests/test_trvs.toml @@ -4780,7 +4780,7 @@ code = ''' // switch to early relocations after extending lfs3_unmount(&lfs3) => 0; - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_recycles = 0; lfs3_mount(&lfs3, LFS3_M_RDWR, &cfg) => 0; @@ -4954,7 +4954,7 @@ code = ''' // switch to early relocations after extending lfs3_unmount(&lfs3) => 0; - struct lfs3_config cfg = *CFG; + struct lfs3_cfg cfg = *CFG; cfg.block_recycles = 0; lfs3_mount(&lfs3, LFS3_M_RDWR, &cfg) => 0;