diff --git a/lfs.c b/lfs.c index 6a3c0d1a..cbc68ee1 100644 --- a/lfs.c +++ b/lfs.c @@ -630,7 +630,7 @@ enum lfsr_tag_type { LFSR_TAG_ALTRGT = 0x7000, LFSR_TAG_CKSUM = 0x2000, - LFSR_TAG_FCKSUM = 0x2100, + LFSR_TAG_ECKSUM = 0x2100, // in-device only LFSR_TAG_MOVE = 0x0800, @@ -1429,24 +1429,24 @@ typedef struct lfsr_attr { //#endif -// fcksum on-disk encoding -typedef struct lfsr_fcksum { +// erased-state checksum on-disk encoding +typedef struct lfsr_ecksum { uint32_t cksum; lfs_size_t size; -} lfsr_fcksum_t; +} lfsr_ecksum_t; // 1 leb128 + 1 crc32c => 9 bytes (worst case) -#define LFSR_FCKSUM_DSIZE (5+4) +#define LFSR_ECKSUM_DSIZE (5+4) -static lfs_ssize_t lfsr_fcksum_todisk(lfs_t *lfs, const lfsr_fcksum_t *fcksum, - uint8_t buffer[static LFSR_FCKSUM_DSIZE]) { +static lfs_ssize_t lfsr_ecksum_todisk(lfs_t *lfs, const lfsr_ecksum_t *ecksum, + uint8_t buffer[static LFSR_ECKSUM_DSIZE]) { (void)lfs; lfs_ssize_t d = 0; - lfs_tole32_(fcksum->cksum, &buffer[d]); + lfs_tole32_(ecksum->cksum, &buffer[d]); d += 4; - lfs_ssize_t d_ = lfs_toleb128(fcksum->size, &buffer[d], 5); + lfs_ssize_t d_ = lfs_toleb128(ecksum->size, &buffer[d], 5); if (d_ < 0) { return d_; } @@ -1455,16 +1455,16 @@ static lfs_ssize_t lfsr_fcksum_todisk(lfs_t *lfs, const lfsr_fcksum_t *fcksum, return d; } -static lfs_ssize_t lfsr_fcksum_fromdisk(lfs_t *lfs, lfsr_fcksum_t *fcksum, +static lfs_ssize_t lfsr_ecksum_fromdisk(lfs_t *lfs, lfsr_ecksum_t *ecksum, lfsr_data_t data) { lfs_ssize_t d = 0; - lfs_ssize_t d_ = lfsr_data_readle32(lfs, data, d, &fcksum->cksum); + lfs_ssize_t d_ = lfsr_data_readle32(lfs, data, d, &ecksum->cksum); if (d_ < 0) { return d_; } d += d_; - d_ = lfsr_data_readleb128(lfs, data, d, &fcksum->size); + d_ = lfsr_data_readleb128(lfs, data, d, &ecksum->size); if (d_ < 0) { return d_; } @@ -1770,13 +1770,13 @@ static int lfsr_fs_fixgrm(lfs_t *lfs); // helper functions static bool lfsr_rbyd_isfetched(const lfsr_rbyd_t *rbyd) { - return !(rbyd->off == 0 && rbyd->trunk > 0); + return !(rbyd->eoff == 0 && rbyd->trunk > 0); } // allocate an rbyd block static int lfsr_rbyd_alloc(lfs_t *lfs, lfsr_rbyd_t *rbyd) { - *rbyd = (lfsr_rbyd_t){.weight=0, .trunk=0, .off=0, .cksum=0}; + *rbyd = (lfsr_rbyd_t){.weight=0, .trunk=0, .eoff=0, .cksum=0}; int err = lfs_alloc(lfs, &rbyd->block); if (err) { return err; @@ -1801,7 +1801,7 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, } rbyd->block = block; - rbyd->off = 0; + rbyd->eoff = 0; rbyd->trunk = 0; // temporary state until we validate a cksum @@ -1812,12 +1812,12 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, lfs_size_t weight_ = 0; // assume unerased until proven otherwise - lfsr_fcksum_t fcksum; - bool hasfcksum = false; + lfsr_ecksum_t ecksum; + bool hasecksum = false; bool maybeerased = false; // scan tags, checking valid bits, cksums, etc - while (off < lfs->cfg->block_size && (!trunk || rbyd->off <= trunk)) { + while (off < lfs->cfg->block_size && (!trunk || rbyd->eoff <= trunk)) { lfsr_tag_t tag; lfs_size_t weight__; lfs_size_t size; @@ -1850,11 +1850,11 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, return err; } - // found an fcksum? save for later - if (tag == LFSR_TAG_FCKSUM) { - uint8_t fcksum_buf[LFSR_FCKSUM_DSIZE]; + // found an ecksum? save for later + if (tag == LFSR_TAG_ECKSUM) { + uint8_t ecksum_buf[LFSR_ECKSUM_DSIZE]; err = lfsr_bd_read(lfs, block, off, lfs->cfg->block_size, - fcksum_buf, lfs_min32(size, LFSR_FCKSUM_DSIZE)); + ecksum_buf, lfs_min32(size, LFSR_ECKSUM_DSIZE)); if (err) { if (err == LFS_ERR_CORRUPT) { break; @@ -1862,15 +1862,15 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, return err; } - lfs_ssize_t fcksum_dsize = lfsr_fcksum_fromdisk(lfs, &fcksum, - LFSR_DATA_BUF(fcksum_buf, - lfs_min32(size, LFSR_FCKSUM_DSIZE))); - if (fcksum_dsize < 0 && fcksum_dsize != LFS_ERR_CORRUPT) { - return fcksum_dsize; + lfs_ssize_t ecksum_dsize = lfsr_ecksum_fromdisk(lfs, &ecksum, + LFSR_DATA_BUF(ecksum_buf, + lfs_min32(size, LFSR_ECKSUM_DSIZE))); + if (ecksum_dsize < 0 && ecksum_dsize != LFS_ERR_CORRUPT) { + return ecksum_dsize; } - // ignore malformed fcksums - hasfcksum = (fcksum_dsize != LFS_ERR_CORRUPT); + // ignore malformed ecksums + hasecksum = (ecksum_dsize != LFS_ERR_CORRUPT); } // is an end-of-commit cksum @@ -1897,12 +1897,12 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, // random and convenient lfs->seed = lfs_crc32c(lfs->seed, &cksum, sizeof(uint32_t)); - // fcksum appears valid so far - maybeerased = hasfcksum; - hasfcksum = false; + // ecksum appears valid so far + maybeerased = hasecksum; + hasecksum = false; // save what we've found so far - rbyd->off = off + size; + rbyd->eoff = off + size; rbyd->cksum = cksum; rbyd->trunk = trunk_; rbyd->weight = weight; @@ -1948,23 +1948,23 @@ static int lfsr_rbyd_fetch(lfs_t *lfs, lfsr_rbyd_t *rbyd, // did we end on a valid commit? we may have an erased block bool erased = false; - if (maybeerased && rbyd->off % lfs->cfg->prog_size == 0) { - // check for an fcksum matching the next prog's erased state, if + if (maybeerased && rbyd->eoff % lfs->cfg->prog_size == 0) { + // check for an ecksum matching the next prog's erased state, if // this failed most likely a previous prog was interrupted, we // need a new erase - uint32_t fcksum_ = 0; - int err = lfsr_bd_cksum(lfs, rbyd->block, rbyd->off, 0, fcksum.size, - &fcksum_); + uint32_t ecksum_ = 0; + int err = lfsr_bd_cksum(lfs, rbyd->block, rbyd->eoff, 0, ecksum.size, + &ecksum_); if (err && err != LFS_ERR_CORRUPT) { return err; } // found beginning of erased part? - erased = (fcksum_ == fcksum.cksum); + erased = (ecksum_ == ecksum.cksum); } if (!erased) { - rbyd->off = -1; + rbyd->eoff = -1; } return 0; @@ -2097,25 +2097,25 @@ static lfs_ssize_t lfsr_rbyd_get(lfs_t *lfs, const lfsr_rbyd_t *rbyd, // this is optional, if not called revision count defaults to 0 (for btrees) static int lfsr_rbyd_appendrev(lfs_t *lfs, lfsr_rbyd_t *rbyd, uint32_t rev) { // should only be called before any tags are written - LFS_ASSERT(rbyd->off == 0); + LFS_ASSERT(rbyd->eoff == 0); // revision count stored as le32, we don't use a leb128 encoding as we // intentionally allow the revision count to overflow uint8_t rev_buf[sizeof(uint32_t)]; lfs_tole32_(rev, &rev_buf); - int err = lfsr_bd_prog(lfs, rbyd->block, rbyd->off, + int err = lfsr_bd_prog(lfs, rbyd->block, rbyd->eoff, &rev_buf, sizeof(uint32_t), &rbyd->cksum); if (err) { goto failed; } - rbyd->off += sizeof(uint32_t); + rbyd->eoff += sizeof(uint32_t); return 0; failed: // if we fail mark the rbyd as unerased and release the pcache lfs_cache_zero(lfs, &lfs->pcache); - rbyd->off = -1; + rbyd->eoff = -1; return err; } @@ -2131,15 +2131,15 @@ static int lfsr_rbyd_p_flush(lfs_t *lfs, lfsr_rbyd_t *rbyd, // change to a relative jump at the last minute lfsr_tag_t alt = p_alts[3-1-i]; lfs_size_t weight = p_weights[3-1-i]; - lfs_off_t jump = rbyd->off - p_jumps[3-1-i]; + lfs_off_t jump = rbyd->eoff - p_jumps[3-1-i]; - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off, + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->eoff, alt, weight, jump, &rbyd->cksum); if (d < 0) { return d; } - rbyd->off += d; + rbyd->eoff += d; } } @@ -2238,7 +2238,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd, // we can't do anything if we're not erased int err; - if (rbyd->off >= lfs->cfg->block_size) { + if (rbyd->eoff >= lfs->cfg->block_size) { err = LFS_ERR_RANGE; goto failed; } @@ -2250,7 +2250,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd, } // make sure every rbyd starts with a revision count - if (rbyd->off == 0) { + if (rbyd->eoff == 0) { err = lfsr_rbyd_appendrev(lfs, rbyd, 0); if (err) { goto failed; @@ -2343,7 +2343,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd, rbyd->weight += delta; // assume we'll update our trunk - rbyd->trunk = rbyd->off; + rbyd->trunk = rbyd->eoff; // no trunk yet? if (!branch) { @@ -2702,7 +2702,7 @@ leaf:; // // note we always need a non-alt to terminate the trunk, otherwise we // can't find trunks during fetch - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off, + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->eoff, // rm => null, otherwise strip off control bits (lfsr_tag_isrm(tag) ? LFSR_TAG_NULL : lfsr_tag_key(tag)), upper_rid - lower_rid - 1 + delta, @@ -2712,22 +2712,22 @@ leaf:; err = d; goto failed; } - rbyd->off += d; + rbyd->eoff += d; // don't forget the data! - err = lfsr_bd_progdata(lfs, rbyd->block, rbyd->off, data, + err = lfsr_bd_progdata(lfs, rbyd->block, rbyd->eoff, data, &rbyd->cksum); if (err) { goto failed; } - rbyd->off += lfsr_data_size(data); + rbyd->eoff += lfsr_data_size(data); return 0; failed:; // if we fail mark the rbyd as unerased and release the pcache lfs_cache_zero(lfs, &lfs->pcache); - rbyd->off = -1; + rbyd->eoff = -1; return err; } @@ -2858,13 +2858,13 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, // we can't do anything if we're not erased int err; - if (rbyd->off >= lfs->cfg->block_size) { + if (rbyd->eoff >= lfs->cfg->block_size) { err = LFS_ERR_RANGE; goto failed; } // make sure every rbyd starts with a revision count - if (rbyd->off == 0) { + if (rbyd->eoff == 0) { err = lfsr_rbyd_appendrev(lfs, rbyd, 0); if (err) { goto failed; @@ -2876,7 +2876,7 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, lfs_size_t layer_weight = 0; // first copy over raw tags, note this doesn't create a tree - lfs_off_t layer_start = rbyd->off; + lfs_off_t layer_start = rbyd->eoff; lfs_ssize_t rid = start_rid; lfsr_tag_t tag = 0; while (true) { @@ -2899,28 +2899,28 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, } // write the tag - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off, + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->eoff, tag, weight, lfsr_data_size(data), &rbyd->cksum); if (d < 0) { err = d; goto failed; } - rbyd->off += d; + rbyd->eoff += d; // and the data - err = lfsr_bd_progdata(lfs, rbyd->block, rbyd->off, data, + err = lfsr_bd_progdata(lfs, rbyd->block, rbyd->eoff, data, &rbyd->cksum); if (err) { goto failed; } - rbyd->off += lfsr_data_size(data); + rbyd->eoff += lfsr_data_size(data); // keep track of the layer weight/trunks layer_trunks += 1; layer_weight += weight; } - lfs_off_t layer_end = rbyd->off; + lfs_off_t layer_end = rbyd->eoff; // connect every other trunk together, building layers of a perfectly // balanced binary tree upwards until we have a single trunk @@ -2930,7 +2930,7 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, layer_weight = 0; lfs_off_t off = layer_start; - layer_start = rbyd->off; + layer_start = rbyd->eoff; while (off < layer_end) { // connect two trunks together with a new binary trunk for (int i = 0; i < 2 && off < layer_end; i++) { @@ -2972,32 +2972,32 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, } // connect with an altle - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off, + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->eoff, LFSR_TAG_ALTLE(false, lfsr_tag_key(trunk_tag)), trunk_weight, - rbyd->off - trunk_off, + rbyd->eoff - trunk_off, &rbyd->cksum); if (d < 0) { err = d; goto failed; } - rbyd->off += d; + rbyd->eoff += d; } // terminate with a null tag - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->off, + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd->block, rbyd->eoff, LFSR_TAG_NULL, 0, 0, &rbyd->cksum); if (d < 0) { err = d; goto failed; } - rbyd->off += d; + rbyd->eoff += d; // keep track of the number of trunks layer_trunks += 1; } - layer_end = rbyd->off; + layer_end = rbyd->eoff; } // done! just need to update our trunk/weight, note we could have @@ -3013,7 +3013,7 @@ static int lfsr_rbyd_compact(lfs_t *lfs, lfsr_rbyd_t *rbyd, failed:; // if we fail mark the rbyd as unerased and release the pcache lfs_cache_zero(lfs, &lfs->pcache); - rbyd->off = -1; + rbyd->eoff = -1; return err; #else @@ -3056,7 +3056,7 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, // we can't do anything if we're not erased int err; - if (rbyd->off >= lfs->cfg->block_size) { + if (rbyd->eoff >= lfs->cfg->block_size) { err = LFS_ERR_RANGE; goto failed; } @@ -3066,7 +3066,7 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, lfsr_rbyd_t rbyd_ = *rbyd; // make sure every rbyd starts with its revision count - if (rbyd_.off == 0) { + if (rbyd_.eoff == 0) { err = lfsr_rbyd_appendrev(lfs, &rbyd_, 0); if (err) { goto failed; @@ -3084,12 +3084,12 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, // // this gets a bit complicated as we have two types of cksums: // - // - 9-word cksum with fcksum to check following prog (middle of block) - // - fcksum tag type => 2 byte le16 - // - fcksum tag rid => 1 byte leb128 - // - fcksum tag size => 1 byte leb128 (worst case) - // - fcksum crc32c => 4 byte le32 - // - fcksum size => 5 byte leb128 (worst case) + // - 9-word cksum with ecksum to check following prog (middle of block) + // - ecksum tag type => 2 byte le16 + // - ecksum tag rid => 1 byte leb128 + // - ecksum tag size => 1 byte leb128 (worst case) + // - ecksum crc32c => 4 byte le32 + // - ecksum size => 5 byte leb128 (worst case) // - cksum tag type => 2 byte le16 // - cksum tag rid => 1 byte leb128 // - cksum tag size => 5 byte leb128 (worst case) @@ -3104,10 +3104,10 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, // => 12 bytes total // lfs_off_t aligned = lfs_alignup( - rbyd_.off + 2+1+1+4+5 + 2+1+5+4, + rbyd_.eoff + 2+1+1+4+5 + 2+1+5+4, lfs->cfg->prog_size); - // space for fcksum? + // space for ecksum? uint8_t perturb = 0; if (aligned < lfs->cfg->block_size) { // read the leading byte in case we need to change the expected @@ -3115,40 +3115,40 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, int err = lfsr_bd_read(lfs, rbyd_.block, aligned, lfs->cfg->prog_size, &perturb, 1); if (err && err != LFS_ERR_CORRUPT) { - rbyd->off = -1; + rbyd->eoff = -1; return err; } - // find the expected fcksum, don't bother avoiding a reread of the + // find the expected ecksum, don't bother avoiding a reread of the // perturb byte, as it should still be in our cache - lfsr_fcksum_t fcksum = {.cksum=0, .size=lfs->cfg->prog_size}; + lfsr_ecksum_t ecksum = {.cksum=0, .size=lfs->cfg->prog_size}; err = lfsr_bd_cksum(lfs, rbyd_.block, aligned, lfs->cfg->prog_size, lfs->cfg->prog_size, - &fcksum.cksum); + &ecksum.cksum); if (err && err != LFS_ERR_CORRUPT) { goto failed; } - uint8_t fcksum_buf[LFSR_FCKSUM_DSIZE]; - lfs_size_t fcksum_dsize = lfsr_fcksum_todisk(lfs, &fcksum, fcksum_buf); - lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd_.block, rbyd_.off, - LFSR_TAG_FCKSUM, 0, fcksum_dsize, + uint8_t ecksum_buf[LFSR_ECKSUM_DSIZE]; + lfs_size_t ecksum_dsize = lfsr_ecksum_todisk(lfs, &ecksum, ecksum_buf); + lfs_ssize_t d = lfsr_bd_progtag(lfs, rbyd_.block, rbyd_.eoff, + LFSR_TAG_ECKSUM, 0, ecksum_dsize, &rbyd_.cksum); if (d < 0) { err = d; goto failed; } - rbyd_.off += d; + rbyd_.eoff += d; - err = lfsr_bd_prog(lfs, rbyd_.block, rbyd_.off, - fcksum_buf, fcksum_dsize, &rbyd_.cksum); + err = lfsr_bd_prog(lfs, rbyd_.block, rbyd_.eoff, + ecksum_buf, ecksum_dsize, &rbyd_.cksum); if (err) { goto failed; } - rbyd_.off += fcksum_dsize; + rbyd_.eoff += ecksum_dsize; // at least space for a cksum? - } else if (rbyd_.off + 2+1+5+4 <= lfs->cfg->block_size) { + } else if (rbyd_.eoff + 2+1+5+4 <= lfs->cfg->block_size) { // note this implicitly marks the rbyd as unerased aligned = lfs->cfg->block_size; @@ -3168,7 +3168,7 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, cksum_buf[1] = 0; cksum_buf[2] = 0; - lfs_off_t padding = aligned - (rbyd_.off + 2+1+5); + lfs_off_t padding = aligned - (rbyd_.eoff + 2+1+5); cksum_buf[3] = 0x80 | (0x7f & (padding >> 0)); cksum_buf[4] = 0x80 | (0x7f & (padding >> 7)); cksum_buf[5] = 0x80 | (0x7f & (padding >> 14)); @@ -3186,11 +3186,11 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, } lfs_tole32_(rbyd_.cksum, &cksum_buf[2+1+5]); - err = lfsr_bd_prog(lfs, rbyd_.block, rbyd_.off, cksum_buf, 2+1+5+4, NULL); + err = lfsr_bd_prog(lfs, rbyd_.block, rbyd_.eoff, cksum_buf, 2+1+5+4, NULL); if (err) { goto failed; } - rbyd_.off += 2+1+5+4; + rbyd_.eoff += 2+1+5+4; // flush our caches, finalizing the commit on-disk err = lfsr_bd_sync(lfs); @@ -3200,8 +3200,8 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, // succesful commit, check checksum to make sure uint32_t cksum_ = rbyd->cksum; - err = lfsr_bd_cksum(lfs, rbyd_.block, rbyd->off, 0, - rbyd_.off-4 - rbyd->off, + err = lfsr_bd_cksum(lfs, rbyd_.block, rbyd->eoff, 0, + rbyd_.eoff-4 - rbyd->eoff, &cksum_); if (err) { goto failed; @@ -3217,14 +3217,14 @@ static int lfsr_rbyd_commit(lfs_t *lfs, lfsr_rbyd_t *rbyd, } // ok, everything is good, save what we've committed - rbyd_.off = aligned; + rbyd_.eoff = aligned; *rbyd = rbyd_; return 0; failed:; // if we fail mark the rbyd as unerased and release the pcache lfs_cache_zero(lfs, &lfs->pcache); - rbyd->off = -1; + rbyd->eoff = -1; return err; } @@ -3557,7 +3557,7 @@ static lfs_ssize_t lfsr_branch_fromdisk(lfs_t *lfs, lfsr_rbyd_t *branch, lfsr_data_t data) { // setting off to 0 here will trigger asserts if we try to append // without fetching first - branch->off = 0; + branch->eoff = 0; lfs_ssize_t d = 0; lfs_ssize_t d_ = lfsr_data_readle32(lfs, data, d, &branch->cksum); @@ -4017,7 +4017,7 @@ static int lfsr_btree_commit(lfs_t *lfs, // TODO we should have a benchmark for how removes affect tree size // is our compacted size too small? try to merge with one of // our siblings - if (rbyd_.off < lfs->cfg->block_size/4) { + if (rbyd_.eoff < lfs->cfg->block_size/4) { goto merge; merge_abort:; } @@ -4326,7 +4326,7 @@ static int lfsr_btree_commit(lfs_t *lfs, // if we exceed our compaction threshold our merge has failed, // clean up ids and return to merge_abort - if (rbyd_.off > lfs->cfg->block_size/2) { + if (rbyd_.eoff > lfs->cfg->block_size/2) { err = lfsr_rbyd_append(lfs, &rbyd_, sdelta+(rbyd_.weight-rweight_)-1, LFSR_TAG_UNR, -(rbyd_.weight-rweight_), @@ -5364,7 +5364,7 @@ static int lfsr_mdir_compact_(lfs_t *lfs, lfsr_mdir_t *mdir_, lfs_swap32(&mdir_->u.r.rbyd.block, &mdir_->u.r.redund_block); mdir_->u.r.rbyd.weight = 0; mdir_->u.r.rbyd.trunk = 0; - mdir_->u.r.rbyd.off = 0; + mdir_->u.r.rbyd.eoff = 0; mdir_->u.r.rbyd.cksum = 0; // erase, preparing for compact @@ -5465,7 +5465,7 @@ static int lfsr_mdir_commit_(lfs_t *lfs, lfsr_mdir_t *mdir, // TODO handle this differently? // TODO let the lower rbyd layer handle this somehow? // mark mdir as unerased in case we fail - mdir->u.r.rbyd.off = lfs->cfg->block_size; + mdir->u.r.rbyd.eoff = lfs->cfg->block_size; int err = lfsr_rbyd_appendall(lfs, &mdir_.u.r.rbyd, start_rid, end_rid, attrs, attr_count); if (err && err != LFS_ERR_RANGE) { @@ -7004,7 +7004,7 @@ static int lfsr_formatinited(lfs_t *lfs) { for (uint32_t i = 0; i < 2; i++) { // write superblock to both rbyds in the root mroot to hopefully // avoid mounting an older filesystem on disk - lfsr_rbyd_t rbyd = {.block=i, .off=0, .trunk=0}; + lfsr_rbyd_t rbyd = {.block=i, .eoff=0, .trunk=0}; int err = lfsr_bd_erase(lfs, rbyd.block); if (err) { diff --git a/lfs.h b/lfs.h index 4cb7cc6b..2a122780 100644 --- a/lfs.h +++ b/lfs.h @@ -348,11 +348,11 @@ typedef struct lfs_cache { typedef struct lfsr_rbyd { // note this lines up with weight in lfsr_btree_t lfs_size_t weight; - // off=0, trunk=0 => not yet committed - // off=0, trunk>0 => not yet fetched - // off>=block_size => rbyd not erased/needs compaction + // eoff=0, trunk=0 => not yet committed + // eoff=0, trunk>0 => not yet fetched + // eoff>=block_size => rbyd not erased/needs compaction lfs_off_t trunk; - lfs_off_t off; + lfs_off_t eoff; uint32_t cksum; // note this lines up with arrays of redundant blocks in lfsr_mdir_t lfs_block_t block; diff --git a/scripts/dbgbtree.py b/scripts/dbgbtree.py index 54ddbfbd..1788333c 100755 --- a/scripts/dbgbtree.py +++ b/scripts/dbgbtree.py @@ -30,7 +30,7 @@ TAG_UATTR = 0x0400 TAG_SATTR = 0x0500 TAG_ALT = 0x4000 TAG_CKSUM = 0x2000 -TAG_FCKSUM = 0x2100 +TAG_ECKSUM = 0x2100 @@ -172,8 +172,8 @@ def tagrepr(tag, w, size, off=None): 1 if tag & 0x1 else 0, ' 0x%x' % w if w > 0 else '', size) - elif tag == TAG_FCKSUM: - return 'fcksum%s %d' % ( + elif tag == TAG_ECKSUM: + return 'ecksum%s %d' % ( ' 0x%x' % w if w > 0 else '', size) elif tag & 0x4000: diff --git a/scripts/dbglfs.py b/scripts/dbglfs.py index 25ef5468..789b1d72 100755 --- a/scripts/dbglfs.py +++ b/scripts/dbglfs.py @@ -31,7 +31,7 @@ TAG_UATTR = 0x0400 TAG_SATTR = 0x0500 TAG_ALT = 0x4000 TAG_CKSUM = 0x2000 -TAG_FCKSUM = 0x2100 +TAG_ECKSUM = 0x2100 # parse some rbyd addr encodings @@ -181,8 +181,8 @@ def tagrepr(tag, w, size, off=None): 1 if tag & 0x1 else 0, ' 0x%x' % w if w > 0 else '', size) - elif tag == TAG_FCKSUM: - return 'fcksum%s %d' % ( + elif tag == TAG_ECKSUM: + return 'ecksum%s %d' % ( ' 0x%x' % w if w > 0 else '', size) elif tag & 0x4000: diff --git a/scripts/dbgmtree.py b/scripts/dbgmtree.py index 903fe756..40bb817b 100755 --- a/scripts/dbgmtree.py +++ b/scripts/dbgmtree.py @@ -30,7 +30,7 @@ TAG_UATTR = 0x0400 TAG_SATTR = 0x0500 TAG_ALT = 0x4000 TAG_CKSUM = 0x2000 -TAG_FCKSUM = 0x2100 +TAG_ECKSUM = 0x2100 # parse some rbyd addr encodings @@ -180,8 +180,8 @@ def tagrepr(tag, w, size, off=None): 1 if tag & 0x1 else 0, ' 0x%x' % w if w > 0 else '', size) - elif tag == TAG_FCKSUM: - return 'fcksum%s %d' % ( + elif tag == TAG_ECKSUM: + return 'ecksum%s %d' % ( ' 0x%x' % w if w > 0 else '', size) elif tag & 0x4000: diff --git a/scripts/dbgrbyd.py b/scripts/dbgrbyd.py index db2bf5c3..0e1a0682 100755 --- a/scripts/dbgrbyd.py +++ b/scripts/dbgrbyd.py @@ -39,7 +39,7 @@ TAG_UATTR = 0x0400 TAG_SATTR = 0x0500 TAG_ALT = 0x4000 TAG_CKSUM = 0x2000 -TAG_FCKSUM = 0x2100 +TAG_ECKSUM = 0x2100 @@ -174,8 +174,8 @@ def tagrepr(tag, w, size, off=None): 1 if tag & 0x1 else 0, ' 0x%x' % w if w > 0 else '', size) - elif tag == TAG_FCKSUM: - return 'fcksum%s %d' % ( + elif tag == TAG_ECKSUM: + return 'ecksum%s %d' % ( ' 0x%x' % w if w > 0 else '', size) elif tag & 0x4000: diff --git a/tests/test_mtree.toml b/tests/test_mtree.toml index 1c171d0f..afc9ba67 100644 --- a/tests/test_mtree.toml +++ b/tests/test_mtree.toml @@ -66,7 +66,7 @@ code = ''' for (lfs_size_t i = 0; i < N; i++) { // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(i), 0, &alphas[i % 26], 1))) => 0; @@ -164,7 +164,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -238,7 +238,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -312,7 +312,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -330,7 +330,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // assert mdir was split correctly @@ -412,8 +412,8 @@ code = ''' for (lfs_size_t i = 0; i < N; i++) { // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( @@ -508,8 +508,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } // add to rbyd, potentially splitting the mdir @@ -609,7 +609,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -679,7 +679,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -693,7 +693,7 @@ code = ''' assert(mdir.u.m.weight == 1); // force mdir to compact while we're removing - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(0, UNR, -1, NULL, 0))) => 0; @@ -752,7 +752,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; // remove the entry as we compact, forcing the mdir to be dropped lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( @@ -812,7 +812,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; // remove the left entry as we compact, forcing the left // mdir to be dropped @@ -880,7 +880,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; // remove the right entry as we compact, forcing the right mdir // to be dropped @@ -948,7 +948,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; // remove both entries as we compact, forcing both mdirs to be dropped lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( @@ -999,7 +999,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -1017,7 +1017,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; // remove the left entry as we compact, forcing the left // mdir to be dropped @@ -1094,7 +1094,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -1112,7 +1112,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; // remove the right entry as we compact, forcing the right // mdir to be dropped @@ -1189,7 +1189,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -1207,7 +1207,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; // remove both entries as we compact, forcing both mdirs to be dropped lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( @@ -1289,8 +1289,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( @@ -1410,8 +1410,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( @@ -1471,8 +1471,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } // create @@ -1594,7 +1594,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mtree has one mdir @@ -1609,9 +1609,9 @@ code = ''' lfsr_mdir_t old_mdir = mdir; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[2 % 26], SIZE); lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(0, INLINED, 0, buffer, SIZE))) => 0; @@ -1689,7 +1689,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -1704,9 +1704,9 @@ code = ''' lfsr_mdir_t old_mdir = mdir; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[2 % 26], SIZE); lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(0, INLINED, 0, buffer, SIZE))) => 0; @@ -1784,7 +1784,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -1799,9 +1799,9 @@ code = ''' lfsr_mdir_t old_mdir = mdir; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[2 % 26], SIZE); lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(0, INLINED, 0, buffer, SIZE))) => 0; @@ -1877,9 +1877,9 @@ code = ''' // force mroot to compact twice, this should extend the mroot lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -1938,10 +1938,10 @@ code = ''' lfsr_mdir_t old_mroot = lfs.mroot; for (int i = 0; i < 4; i++) { - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; } - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -1996,9 +1996,9 @@ code = ''' // force mroot to compact twice, this should extend the mroot lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert we relocated @@ -2007,9 +2007,9 @@ code = ''' // force mroot to compact twice again, this should relocate the mroot old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -2067,7 +2067,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mtree has one mdir @@ -2077,7 +2077,7 @@ code = ''' // setup mroot to need to compact, this should trigger a relocation when // we relocate the mdir below - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_t old_mroot = lfs.mroot; // force mdir to compact twice, this should relocate @@ -2087,9 +2087,9 @@ code = ''' lfsr_mdir_t old_mdir = mdir; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[2 % 26], SIZE); lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(0, INLINED, 0, buffer, SIZE))) => 0; @@ -2173,7 +2173,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -2183,7 +2183,7 @@ code = ''' // setup mroot to need to compact, this should trigger a relocation when // we relocate the mdir below - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_t old_mroot = lfs.mroot; // now add another large entry to the mdir, forcing a split @@ -2196,7 +2196,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // assert mdir was split correctly @@ -2287,7 +2287,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -2297,7 +2297,7 @@ code = ''' // setup mroot to need to compact, this should trigger a relocation when // we relocate the mdir below - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_t old_mroot = lfs.mroot; // remove the entry, forcing the mdir to be dropped @@ -2361,7 +2361,7 @@ code = ''' // force mroot to compact once, so the second compact below will trigger // a relocation - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // prepare mroot with a large attr so the next entry can not fit @@ -2377,7 +2377,7 @@ code = ''' // force mroot to compact, this should trigger a relocation lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -2450,7 +2450,7 @@ code = ''' // force mroot to compact once, so the second compact below will trigger // a relocation - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // create 2 large entries that needs to be uninlined and split @@ -2465,7 +2465,7 @@ code = ''' // force mroot to compact, this should trigger a relocation lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -2559,8 +2559,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } // create @@ -2853,7 +2853,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -2936,7 +2936,7 @@ code = ''' LFSR_ATTR(2, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -3001,7 +3001,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -3037,7 +3037,7 @@ code = ''' LFSR_ATTR(2, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // assert mdir was split correctly @@ -3120,9 +3120,9 @@ code = ''' // force mroot to compact twice, this should extend the mroot lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -3179,7 +3179,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -3212,9 +3212,9 @@ code = ''' // force mdir to compact twice, this should relocate lfsr_mdir_t old_mdir = mdir; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[4 % 26], SIZE); lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( LFSR_ATTR(1, INLINED, 0, buffer, SIZE))) => 0; @@ -3278,7 +3278,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // we should now have 2 mdirs @@ -3293,7 +3293,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // we should now have 3 mdirs @@ -3324,7 +3324,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // we should now have 4 mdirs @@ -3375,7 +3375,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // we should now have 2 mdirs @@ -3390,7 +3390,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mdir to compact - mdir.u.r.rbyd.off = BLOCK_SIZE; + mdir.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &mdir, NULL, 0) => 0; // we should now have 3 mdirs @@ -3572,7 +3572,7 @@ code = ''' LFSR_ATTR(0, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdir was unininlined correctly @@ -3707,7 +3707,7 @@ code = ''' LFSR_ATTR(1, INLINED, +1, buffer, SIZE))) => 0; // force mroot to compact - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; // assert mdirs were unininlined and split @@ -3843,9 +3843,9 @@ code = ''' // force mroot to compact twice, this should extend the mroot lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -3960,8 +3960,8 @@ code = ''' for (lfs_size_t i = 0; i < N; i++) { // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS( @@ -4116,8 +4116,8 @@ code = ''' // force a compaction? if (FORCE_COMPACTION) { - mdir.u.r.rbyd.off = CFG->block_size; - lfs.mroot.u.r.rbyd.off = CFG->block_size; + mdir.u.r.rbyd.eoff = CFG->block_size; + lfs.mroot.u.r.rbyd.eoff = CFG->block_size; } // add to rbyd, potentially splitting the mdir @@ -4358,9 +4358,9 @@ code = ''' // force mroot to compact twice, this should extend the mroot lfsr_mdir_t old_mroot = lfs.mroot; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; @@ -4414,10 +4414,10 @@ code = ''' lfsr_mdir_t old_mroot = lfs.mroot; for (int i = 0; i < 4; i++) { - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; lfsr_mdir_commit(&lfs, &lfs.mroot, NULL, 0) => 0; } - lfs.mroot.u.r.rbyd.off = BLOCK_SIZE; + lfs.mroot.u.r.rbyd.eoff = BLOCK_SIZE; memset(buffer, alphas[1 % 26], SIZE); lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS( LFSR_ATTR(-1, UATTR(1), 0, buffer, SIZE))) => 0; diff --git a/tests/test_rbyd.toml b/tests/test_rbyd.toml index 55344392..5f2181ad 100644 --- a/tests/test_rbyd.toml +++ b/tests/test_rbyd.toml @@ -21,7 +21,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -52,7 +52,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -84,7 +84,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -117,7 +117,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -227,7 +227,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -339,7 +339,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -418,7 +418,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -499,7 +499,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -562,7 +562,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -627,7 +627,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -706,7 +706,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -849,7 +849,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1020,7 +1020,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1191,7 +1191,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1370,7 +1370,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1577,7 +1577,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1743,7 +1743,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1930,7 +1930,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -1986,8 +1986,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -2021,7 +2021,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2073,8 +2073,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -2102,7 +2102,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2191,7 +2191,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2286,7 +2286,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2358,7 +2358,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2429,7 +2429,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2454,9 +2454,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N); @@ -2481,7 +2481,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // update each tag in permutation order @@ -2502,8 +2502,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -2539,7 +2539,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2601,7 +2601,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2713,7 +2713,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2757,9 +2757,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N; j++) { @@ -2769,7 +2769,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -2822,8 +2822,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -2863,7 +2863,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -2903,9 +2903,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N; j++) { @@ -2915,7 +2915,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -2957,7 +2957,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3106,7 +3106,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3341,7 +3341,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3429,7 +3429,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3454,9 +3454,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N); @@ -3481,7 +3481,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // remove each tag in permutation order @@ -3514,8 +3514,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -3552,7 +3552,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3660,7 +3660,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3807,7 +3807,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -3968,7 +3968,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4035,8 +4035,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -4070,7 +4070,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4134,8 +4134,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -4163,7 +4163,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4269,7 +4269,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4381,7 +4381,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4473,7 +4473,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4560,7 +4560,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4628,7 +4628,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -4862,7 +4862,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5123,7 +5123,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5201,8 +5201,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -5237,7 +5237,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5312,8 +5312,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -5341,7 +5341,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5507,7 +5507,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5684,7 +5684,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5794,7 +5794,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5903,7 +5903,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -5939,9 +5939,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N*M); @@ -5966,7 +5966,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // update each tag in permutation order @@ -5990,8 +5990,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -6031,7 +6031,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6097,9 +6097,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N*M; j++) { @@ -6109,7 +6109,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -6183,8 +6183,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -6225,7 +6225,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6261,9 +6261,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N*M); @@ -6288,7 +6288,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // remove each tag in permutation order @@ -6311,8 +6311,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -6349,7 +6349,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6440,7 +6440,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6543,8 +6543,8 @@ code = ''' &rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT; // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -6579,7 +6579,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6703,8 +6703,8 @@ code = ''' &rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT; // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -6735,7 +6735,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -6861,7 +6861,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7107,7 +7107,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7166,9 +7166,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try deleting each rid for (unsigned j = 0; j < N; j++) { @@ -7178,7 +7178,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -7219,8 +7219,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -7261,7 +7261,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7326,9 +7326,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try deleting each rid for (unsigned j = 0; j < N; j++) { @@ -7338,7 +7338,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -7410,8 +7410,8 @@ code = ''' } // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -7451,7 +7451,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7509,9 +7509,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try deleting each rid for (unsigned j = 0; j < N; j++) { @@ -7521,7 +7521,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -7575,7 +7575,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7639,9 +7639,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try deleting each rid for (unsigned j = 0; j < N; j++) { @@ -7651,7 +7651,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -7713,7 +7713,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7827,7 +7827,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7960,7 +7960,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -7992,9 +7992,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N); @@ -8019,7 +8019,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // delete each rid in permutation order @@ -8061,8 +8061,8 @@ code = ''' => LFS_ERR_NOENT; // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -8102,7 +8102,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8139,9 +8139,9 @@ code = ''' // copy block so we can reset after each delete lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // test all permutations of a given size size_t perm_count = TEST_FACTORIAL(N); @@ -8166,7 +8166,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // delete each rid in permutation order @@ -8221,8 +8221,8 @@ code = ''' => LFS_ERR_NOENT; // keep track of the worst size - if (rbyd.off > worst_size) { - worst_size = rbyd.off; + if (rbyd.eoff > worst_size) { + worst_size = rbyd.eoff; worst_perm_i = perm_i; } } @@ -8259,7 +8259,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8365,7 +8365,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8602,7 +8602,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8711,7 +8711,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8797,7 +8797,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -8882,7 +8882,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -9554,7 +9554,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -9810,7 +9810,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -9921,7 +9921,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10042,7 +10042,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10100,9 +10100,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try growing each rid for (unsigned j = 0; j < N; j++) { @@ -10112,7 +10112,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10168,7 +10168,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10226,9 +10226,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try growing each rid for (unsigned j = 0; j < N; j++) { @@ -10238,7 +10238,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10303,7 +10303,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10362,9 +10362,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try growing each rid for (unsigned j = 0; j < N; j++) { @@ -10374,7 +10374,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10451,7 +10451,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10509,9 +10509,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try shrinking each rid for (unsigned j = 0; j < N; j++) { @@ -10521,7 +10521,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10577,7 +10577,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10635,9 +10635,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try shrinking each rid for (unsigned j = 0; j < N; j++) { @@ -10647,7 +10647,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10712,7 +10712,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10771,9 +10771,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try shrinking each rid for (unsigned j = 0; j < N; j++) { @@ -10783,7 +10783,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -10859,7 +10859,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -10917,9 +10917,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try deleting each rid for (unsigned j = 0; j < N; j++) { @@ -10929,7 +10929,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -11012,7 +11012,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11070,9 +11070,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try appending an attr to each rid, this should not affect // weights at all! @@ -11083,7 +11083,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS( @@ -11188,7 +11188,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11339,7 +11339,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11534,7 +11534,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11621,7 +11621,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11677,9 +11677,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N; j++) { @@ -11689,7 +11689,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // remove with a wide tag @@ -11758,7 +11758,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11814,9 +11814,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try replacing each tag for (unsigned j = 0; j < N; j++) { @@ -11826,7 +11826,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // replace with bitwise inverse @@ -11897,7 +11897,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -11985,7 +11985,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -12042,9 +12042,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N; j++) { @@ -12054,7 +12054,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // remove with a wide tag @@ -12130,7 +12130,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -12187,9 +12187,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try replacing each tag for (unsigned j = 0; j < N; j++) { @@ -12199,7 +12199,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // replace with bitwise inverse @@ -12277,7 +12277,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -12363,7 +12363,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -12418,9 +12418,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try removing each tag for (unsigned j = 0; j < N; j++) { @@ -12430,7 +12430,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // remove with a wide tag @@ -12502,7 +12502,7 @@ code = ''' lfsr_rbyd_t init_rbyd = { .block = 0, - .off = 0, + .eoff = 0, .cksum = 0, .trunk = 0, .weight = 0, @@ -12557,9 +12557,9 @@ code = ''' // copy block so we can reset after each remove lfsr_rbyd_t backup_rbyd = rbyd; - uint8_t *backup_block = malloc(rbyd.off); - lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.off, - rbyd.block, 0, backup_block, rbyd.off) => 0; + uint8_t *backup_block = malloc(rbyd.eoff); + lfs_bd_read(&lfs, NULL, &lfs.rcache, rbyd.eoff, + rbyd.block, 0, backup_block, rbyd.eoff) => 0; // try replacing each tag for (unsigned j = 0; j < N; j++) { @@ -12569,7 +12569,7 @@ code = ''' rbyd = backup_rbyd; lfs_bd_erase(&lfs, rbyd.block) => 0; lfs_bd_prog(&lfs, &lfs.pcache, &lfs.rcache, false, - rbyd.block, 0, backup_block, rbyd.off) => 0; + rbyd.block, 0, backup_block, rbyd.eoff) => 0; lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0; // replace with bitwise inverse