diff --git a/lfs3.c b/lfs3.c index 17a1fe17..464f520a 100644 --- a/lfs3.c +++ b/lfs3.c @@ -10025,7 +10025,7 @@ again:; } // needed in lfs3_mtree_traverse -static void lfs3_alloc_markinusebptr(lfs3_t *lfs3, +static void lfs3_alloc_setinusebptr(lfs3_t *lfs3, lfs3_tag_t tag, const lfs3_bptr_t *bptr); // high-level immutable traversal, handle extra features here, @@ -10156,7 +10156,7 @@ static inline bool lfs3_alloc_canlookahead(const lfs3_t *lfs3); static inline bool lfs3_alloc_canlookgbmap(const lfs3_t *lfs3); static void lfs3_alloc_adopt(lfs3_t *lfs3, lfs3_block_t known); static int lfs3_gbmap_zero(lfs3_t *lfs3, lfs3_btree_t *gbmap); -static int lfs3_gbmap_markbptr(lfs3_t *lfs3, lfs3_btree_t *gbmap, +static int lfs3_gbmap_setbptr(lfs3_t *lfs3, lfs3_btree_t *gbmap, lfs3_tag_t tag, const lfs3_bptr_t *bptr, lfs3_tag_t tag_); static int lfs3_alloc_adoptgbmap(lfs3_t *lfs3, @@ -10263,7 +10263,7 @@ again:; // mark in-use blocks in gbmap? if (LFS3_IFDEF_GBMAP(mgc->gbmap_.r.weight != 0, false)) { #ifdef LFS3_GBMAP - int err = lfs3_gbmap_markbptr(lfs3, &mgc->gbmap_, tag, bptr_, + int err = lfs3_gbmap_setbptr(lfs3, &mgc->gbmap_, tag, bptr_, LFS3_TAG_BMINUSE); if (err) { return err; @@ -10272,7 +10272,7 @@ again:; // mark in-use blocks in lookahead buffer? } else { - lfs3_alloc_markinusebptr(lfs3, tag, bptr_); + lfs3_alloc_setinusebptr(lfs3, tag, bptr_); } } @@ -10498,7 +10498,7 @@ static int lfs3_gbmap_commit(lfs3_t *lfs3, lfs3_btree_t *gbmap, // // the purpose of weight is really just to provide a shortcut for bulk // clearing ranges in lfs3_alloc_lookgbmap -static int lfs3_gbmap_mark_(lfs3_t *lfs3, lfs3_btree_t *gbmap, +static int lfs3_gbmap_set_(lfs3_t *lfs3, lfs3_btree_t *gbmap, lfs3_block_t block, lfs3_block_t weight, lfs3_tag_t tag, const lfs3_ecksum_t *ecksum) { // lookup gbmap range @@ -10629,14 +10629,14 @@ static int lfs3_gbmap_mark_(lfs3_t *lfs3, lfs3_btree_t *gbmap, #endif #if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) -static int lfs3_gbmap_mark(lfs3_t *lfs3, lfs3_btree_t *gbmap, +static int lfs3_gbmap_set(lfs3_t *lfs3, lfs3_btree_t *gbmap, lfs3_block_t block, lfs3_tag_t tag, const lfs3_ecksum_t *ecksum) { - return lfs3_gbmap_mark_(lfs3, gbmap, block, 1, tag, ecksum); + return lfs3_gbmap_set_(lfs3, gbmap, block, 1, tag, ecksum); } #endif #if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) -static int lfs3_gbmap_markbptr(lfs3_t *lfs3, lfs3_btree_t *gbmap, +static int lfs3_gbmap_setbptr(lfs3_t *lfs3, lfs3_btree_t *gbmap, lfs3_tag_t tag, const lfs3_bptr_t *bptr, lfs3_tag_t tag_) { const lfs3_block_t *blocks; @@ -10660,7 +10660,7 @@ static int lfs3_gbmap_markbptr(lfs3_t *lfs3, lfs3_btree_t *gbmap, } for (lfs3_size_t i = 0; i < block_count; i++) { - int err = lfs3_gbmap_mark(lfs3, gbmap, blocks[i], tag_, NULL); + int err = lfs3_gbmap_set(lfs3, gbmap, blocks[i], tag_, NULL); if (err) { return err; } @@ -10688,7 +10688,7 @@ static int lfs3_gbmap_zero(lfs3_t *lfs3, lfs3_btree_t *gbmap) { // mark in-use/erased ranges as free if (tag__ == LFS3_TAG_BMINUSE || tag__ == LFS3_TAG_BMERASED) { - int err = lfs3_gbmap_mark_(lfs3, gbmap, + int err = lfs3_gbmap_set_(lfs3, gbmap, block__, weight__, LFS3_TAG_BMFREE, NULL); if (err) { return err; @@ -10838,7 +10838,7 @@ static inline void lfs3_alloc_discard(lfs3_t *lfs3) { // mark a block as in-use #ifndef LFS3_RDONLY -static void lfs3_alloc_markinuse(lfs3_t *lfs3, lfs3_block_t block) { +static void lfs3_alloc_setinuse(lfs3_t *lfs3, lfs3_block_t block) { // TODO can this be simplified? // translate to lookahead-relative @@ -10862,19 +10862,19 @@ static void lfs3_alloc_markinuse(lfs3_t *lfs3, lfs3_block_t block) { // mark some filesystem object as in-use #ifndef LFS3_RDONLY -static void lfs3_alloc_markinusebptr(lfs3_t *lfs3, +static void lfs3_alloc_setinusebptr(lfs3_t *lfs3, lfs3_tag_t tag, const lfs3_bptr_t *bptr) { if (tag == LFS3_TAG_MDIR) { lfs3_mdir_t *mdir = (lfs3_mdir_t*)bptr->d.u.buffer; - lfs3_alloc_markinuse(lfs3, mdir->r.blocks[0]); - lfs3_alloc_markinuse(lfs3, mdir->r.blocks[1]); + lfs3_alloc_setinuse(lfs3, mdir->r.blocks[0]); + lfs3_alloc_setinuse(lfs3, mdir->r.blocks[1]); } else if (tag == LFS3_TAG_BRANCH) { lfs3_rbyd_t *rbyd = (lfs3_rbyd_t*)bptr->d.u.buffer; - lfs3_alloc_markinuse(lfs3, rbyd->blocks[0]); + lfs3_alloc_setinuse(lfs3, rbyd->blocks[0]); } else if (tag == LFS3_TAG_BLOCK) { - lfs3_alloc_markinuse(lfs3, lfs3_bptr_block(bptr)); + lfs3_alloc_setinuse(lfs3, lfs3_bptr_block(bptr)); } else { LFS3_UNREACHABLE(); @@ -11115,14 +11115,14 @@ static lfs3_sblock_t lfs3_alloc__(lfs3_t *lfs3, uint32_t flags, } // track in-use blocks - lfs3_alloc_markinusebptr(lfs3, tag, &bptr); + lfs3_alloc_setinusebptr(lfs3, tag, &bptr); } // mask out any in-flight graft state for (lfs3_size_t i = 0; i < lfs3_graft_count(lfs3->graft_count); i++) { - lfs3_alloc_markinuse(lfs3, lfs3->graft[i].u.disk.block); + lfs3_alloc_setinuse(lfs3, lfs3->graft[i].u.disk.block); } // mark anything not seen as free @@ -11286,7 +11286,7 @@ static int lfs3_alloc_lookgbmap(lfs3_t *lfs3) { } // track in-use blocks - err = lfs3_gbmap_markbptr(lfs3, &gbmap_, tag, &bptr, + err = lfs3_gbmap_setbptr(lfs3, &gbmap_, tag, &bptr, LFS3_TAG_BMINUSE); if (err) { return err; @@ -11348,7 +11348,7 @@ static int lfs3_alloc_preerase(lfs3_t *lfs3) { // commit into gbmap // // this relies on lfs3_gbmap_commit being atomic - err = lfs3_gbmap_mark(lfs3, &lfs3->gbmap.b, + err = lfs3_gbmap_set(lfs3, &lfs3->gbmap.b, block, LFS3_TAG_BMERASED, &ecksum); if (err) { return err; diff --git a/tests/test_gbmap.toml b/tests/test_gbmap.toml index f3565159..172c18b9 100644 --- a/tests/test_gbmap.toml +++ b/tests/test_gbmap.toml @@ -12,7 +12,7 @@ ifdef = 'LFS3_GBMAP' # test low-level gbmap operations # test simple set operations -[cases.test_gbmap_mark_split] +[cases.test_gbmap_set_split] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -29,9 +29,9 @@ code = ''' LFS3_RATTR_NULL)) => 0; // set some blocks as in-use, avoid any weird merges for now - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -75,7 +75,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_replace] +[cases.test_gbmap_set_replace] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -92,13 +92,13 @@ code = ''' LFS3_RATTR_NULL)) => 0; // set some blocks as in-use, avoid any weird merges for now - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; // replace those blocks as bad, this tests deleting ranges - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMBAD, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMBAD, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMBAD, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMBAD, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMBAD, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMBAD, NULL) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -142,7 +142,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_merge] +[cases.test_gbmap_set_merge] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -159,14 +159,14 @@ code = ''' LFS3_RATTR_NULL)) => 0; // set some blocks as in-use, avoid any weird merges for now - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 12, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 12, LFS3_TAG_BMINUSE, NULL) => 0; // set neighboring blocks as in-use, triggering merges - lfs3_gbmap_mark(&lfs3, &gbmap, 5, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 9, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 13, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 5, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 9, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 13, LFS3_TAG_BMINUSE, NULL) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -210,7 +210,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_noop] +[cases.test_gbmap_set_noop] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -227,15 +227,15 @@ code = ''' LFS3_RATTR_NULL)) => 0; // set some blocks as in-use, avoid any weird merges for now - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; // test a bunch of noops - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 7, LFS3_TAG_BMFREE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 9, LFS3_TAG_BMFREE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 7, LFS3_TAG_BMFREE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 9, LFS3_TAG_BMFREE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMINUSE, NULL) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -279,7 +279,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_bounds] +[cases.test_gbmap_set_bounds] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -298,8 +298,8 @@ code = ''' // test that setting the first and last blocks don't break anything // // though in theory blocks 0x{0,1} are immutable... - lfs3_gbmap_mark(&lfs3, &gbmap, 0, LFS3_TAG_BMINUSE, NULL) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, BLOCK_COUNT-1, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 0, LFS3_TAG_BMINUSE, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, BLOCK_COUNT-1, LFS3_TAG_BMINUSE, NULL) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -327,7 +327,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_fuzz] +[cases.test_gbmap_set_fuzz] defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] defines.TYPES = [2, 3, 4] defines.SEED = 'range(20)' @@ -361,7 +361,7 @@ code = ''' lfs3_tag_t tag = LFS3_TAG_BMRANGE + (TEST_PRNG(&prng) % TYPES); // set in gbmap - lfs3_gbmap_mark(&lfs3, &gbmap, block, tag, NULL) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, block, tag, NULL) => 0; // and set in sim sim[block] = tag; @@ -399,7 +399,7 @@ code = ''' # set operations with ecksums are a bit more complicated -[cases.test_gbmap_mark_ecksum_split] +[cases.test_gbmap_set_ecksum_split] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -418,9 +418,9 @@ code = ''' // set some blocks as erased with ecksums, avoid any weird merges // for now lfs3_ecksum_t ecksum = {.cksize=CFG->prog_size, .cksum=0x12345678}; - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -472,7 +472,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_ecksum_replace] +[cases.test_gbmap_set_ecksum_replace] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -491,14 +491,14 @@ code = ''' // set some blocks as erased with ecksums, avoid any weird merges // for now lfs3_ecksum_t ecksum_a = {.cksize=CFG->prog_size, .cksum=0x12345678}; - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_a) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_a) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_a) => 0; // replace those blocks with different ecksums lfs3_ecksum_t ecksum_b = {.cksize=CFG->prog_size, .cksum=0x9abcdef0}; - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_b) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_b) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_b) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -550,7 +550,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_ecksum_merge] +[cases.test_gbmap_set_ecksum_merge] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -569,14 +569,14 @@ code = ''' // set some blocks as erased with ecksums, avoid any weird merges // for now lfs3_ecksum_t ecksum = {.cksize=CFG->prog_size, .cksum=0x12345678}; - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 12, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 12, LFS3_TAG_BMERASED, &ecksum) => 0; // set neighboring blocks as erased with ecksums, triggering merges - lfs3_gbmap_mark(&lfs3, &gbmap, 5, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 9, LFS3_TAG_BMERASED, &ecksum) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 13, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 5, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 9, LFS3_TAG_BMERASED, &ecksum) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 13, LFS3_TAG_BMERASED, &ecksum) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -628,7 +628,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_ecksum_nomerge] +[cases.test_gbmap_set_ecksum_nomerge] in = 'lfs3.c' code = ''' lfs3_t lfs3; @@ -647,16 +647,16 @@ code = ''' // set some blocks as erased with ecksums, avoid any weird merges // for now lfs3_ecksum_t ecksum_a = {.cksize=CFG->prog_size, .cksum=0x12345678}; - lfs3_gbmap_mark(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_a) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_a) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_a) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 12, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 6, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 8, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 10, LFS3_TAG_BMERASED, &ecksum_a) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 12, LFS3_TAG_BMERASED, &ecksum_a) => 0; // set neighboring blocks as erased with _different_ ecksums, this // should _not_ trigger a merge! lfs3_ecksum_t ecksum_b = {.cksize=CFG->prog_size, .cksum=0x9abcdef0}; - lfs3_gbmap_mark(&lfs3, &gbmap, 5, LFS3_TAG_BMERASED, &ecksum_b) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 9, LFS3_TAG_BMERASED, &ecksum_b) => 0; - lfs3_gbmap_mark(&lfs3, &gbmap, 13, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 5, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 9, LFS3_TAG_BMERASED, &ecksum_b) => 0; + lfs3_gbmap_set(&lfs3, &gbmap, 13, LFS3_TAG_BMERASED, &ecksum_b) => 0; printf("gbmap: w%d 0x%x.%x\n", gbmap.r.weight, gbmap.r.blocks[0], @@ -728,7 +728,7 @@ code = ''' lfs3_unmount(&lfs3) => 0; ''' -[cases.test_gbmap_mark_ecksum_fuzz] +[cases.test_gbmap_set_ecksum_fuzz] defines.N = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512] defines.MASK = [0x1, 0x3, 0xf, 0xffff] defines.SEED = 'range(20)' @@ -764,7 +764,7 @@ code = ''' ecksum.cksum = TEST_PRNG(&prng) & MASK; // set in gbmap - lfs3_gbmap_mark(&lfs3, &gbmap, + lfs3_gbmap_set(&lfs3, &gbmap, block, LFS3_TAG_BMERASED, &ecksum) => 0; // and set in sim