Adopted more macro concatenation in tag defines
This cleans up the code a bit, and means we no longer need to define all of the LFSR_TAG_RMGROWWIDEREG permutations.
This commit is contained in:
@@ -581,59 +581,46 @@ static int lfsr_bd_erase(lfs_t *lfs, lfs_block_t block) {
|
||||
// 16-bit metadata tags
|
||||
enum lfsr_tag_type {
|
||||
LFSR_TAG_NULL = 0x0000,
|
||||
LFSR_TAG_UNR = 0x1000, // in-device only
|
||||
LFSR_TAG_GROW = 0x3000, // in-device only
|
||||
|
||||
LFSR_TAG_SUPERMAGIC = 0x0003,
|
||||
LFSR_TAG_SUPERCONFIG = 0x0004,
|
||||
|
||||
LFSR_TAG_GSTATE = 0x0100,
|
||||
LFSR_TAG_GRM = 0x0100,
|
||||
LFSR_TAG_RMGRM = 0x1100, // in-device only
|
||||
|
||||
LFSR_TAG_NAME = 0x0200,
|
||||
LFSR_TAG_WIDENAME = 0x4200, // in-device only
|
||||
LFSR_TAG_BRANCH = 0x0200,
|
||||
LFSR_TAG_BOOKMARK = 0x0201,
|
||||
LFSR_TAG_REG = 0x0202,
|
||||
LFSR_TAG_GROWREG = 0x2202, // test only? TODO
|
||||
LFSR_TAG_DIR = 0x0203,
|
||||
|
||||
LFSR_TAG_STRUCT = 0x0300,
|
||||
LFSR_TAG_WIDESTRUCT = 0x4300, // in-device only
|
||||
LFSR_TAG_RMWIDESTRUCT = 0x5300, // in-device only
|
||||
LFSR_TAG_INLINED = 0x0300,
|
||||
LFSR_TAG_BLOCK = 0x0302,
|
||||
LFSR_TAG_BTREE = 0x0303,
|
||||
LFSR_TAG_RMBTREE = 0x1303, // in-device only
|
||||
LFSR_TAG_MROOT = 0x0304,
|
||||
LFSR_TAG_MDIR = 0x0305,
|
||||
LFSR_TAG_WIDEMDIR = 0x4305,
|
||||
LFSR_TAG_RMMDIR = 0x1305, // in-device only
|
||||
LFSR_TAG_MTREE = 0x0306,
|
||||
LFSR_TAG_WIDEMTREE = 0x4306,
|
||||
LFSR_TAG_RMMTREE = 0x1306, // in-device only
|
||||
LFSR_TAG_DID = 0x0307,
|
||||
|
||||
LFSR_TAG_UATTR = 0x0400,
|
||||
LFSR_TAG_WIDEUATTR = 0x4400, // test only? TODO
|
||||
LFSR_TAG_GROWUATTR = 0x2400, // test only? TODO
|
||||
LFSR_TAG_RMUATTR = 0x1400, // in-device only
|
||||
LFSR_TAG_RMWIDEUATTR = 0x5400, // test only? TODO
|
||||
LFSR_TAG_SATTR = 0x0500, // test only? TODO
|
||||
LFSR_TAG_RMWIDESATTR = 0x5500, // in-device only
|
||||
LFSR_TAG_SATTR = 0x0500,
|
||||
|
||||
LFSR_TAG_ALT = 0x4000,
|
||||
LFSR_TAG_ALTLE = 0x4000,
|
||||
LFSR_TAG_ALTBLE = 0x4000,
|
||||
LFSR_TAG_ALTRLE = 0x5000,
|
||||
LFSR_TAG_ALTGT = 0x6000,
|
||||
LFSR_TAG_ALTBGT = 0x6000,
|
||||
LFSR_TAG_ALTRGT = 0x7000,
|
||||
LFSR_TAG_LE = 0x0000,
|
||||
LFSR_TAG_GT = 0x2000,
|
||||
LFSR_TAG_B = 0x0000,
|
||||
LFSR_TAG_R = 0x1000,
|
||||
|
||||
LFSR_TAG_CKSUM = 0x2000,
|
||||
LFSR_TAG_ECKSUM = 0x2100,
|
||||
|
||||
// some tag modifiers
|
||||
// in-device only
|
||||
LFSR_TAG_WIDE = 0x4000,
|
||||
LFSR_TAG_GROW = 0x2000,
|
||||
LFSR_TAG_RM = 0x1000,
|
||||
|
||||
// in-device only
|
||||
LFSR_TAG_MOVE = 0x0800,
|
||||
};
|
||||
@@ -642,36 +629,22 @@ enum lfsr_tag_type {
|
||||
// through the LFSR_ATTR macro
|
||||
#define LFSR_TAG_TAG(tag) (tag)
|
||||
|
||||
// some other tag encodings with their own subfields
|
||||
#define LFSR_TAG_ALTLE(red, key) \
|
||||
(LFSR_TAG_ALTLE \
|
||||
| ((0x1 & (lfsr_tag_t)(red)) << 12) \
|
||||
| (0x0fff & (lfsr_tag_t)(key)))
|
||||
// some tag modifiers
|
||||
#define LFSR_TAG_WIDE(tag) (LFSR_TAG_WIDE | LFSR_TAG_##tag)
|
||||
#define LFSR_TAG_GROW(tag) (LFSR_TAG_GROW | LFSR_TAG_##tag)
|
||||
#define LFSR_TAG_RM(tag) (LFSR_TAG_RM | LFSR_TAG_##tag)
|
||||
|
||||
#define LFSR_TAG_ALTGT(red, key) \
|
||||
(LFSR_TAG_ALTGT \
|
||||
| ((0x1 & (lfsr_tag_t)(red)) << 12) \
|
||||
// some other tag encodings with their own subfields
|
||||
#define LFSR_TAG_ALT(d, c, key) \
|
||||
(LFSR_TAG_ALT \
|
||||
| LFSR_TAG_##d \
|
||||
| LFSR_TAG_##c \
|
||||
| (0x0fff & (lfsr_tag_t)(key)))
|
||||
|
||||
#define LFSR_TAG_UATTR(attr) \
|
||||
(LFSR_TAG_UATTR \
|
||||
| (0x7f & (lfsr_tag_t)(attr)))
|
||||
|
||||
// TODO test only?
|
||||
#define LFSR_TAG_WIDEUATTR(attr) \
|
||||
(LFSR_TAG_WIDEUATTR \
|
||||
| (0x7f & (lfsr_tag_t)(attr)))
|
||||
|
||||
// TODO test only?
|
||||
#define LFSR_TAG_GROWUATTR(attr) \
|
||||
(LFSR_TAG_GROWUATTR \
|
||||
| (0x7f & (lfsr_tag_t)(attr)))
|
||||
|
||||
#define LFSR_TAG_RMUATTR(attr) \
|
||||
(LFSR_TAG_RMUATTR \
|
||||
| (0x7f & (lfsr_tag_t)(attr)))
|
||||
|
||||
// TODO test only?
|
||||
#define LFSR_TAG_SATTR(attr) \
|
||||
(LFSR_TAG_SATTR \
|
||||
| (0x7f & (lfsr_tag_t)(attr)))
|
||||
@@ -1341,7 +1314,7 @@ typedef struct lfsr_attr {
|
||||
_delta, \
|
||||
LFSR_DATA_##_data})
|
||||
|
||||
#define LFSR_ATTR_NOOP LFSR_ATTR(-1, UNR, 0, NULL)
|
||||
#define LFSR_ATTR_NOOP LFSR_ATTR(-1, RM, 0, NULL)
|
||||
|
||||
#define LFSR_ATTRS(...) \
|
||||
(const lfsr_attr_t[]){__VA_ARGS__}, \
|
||||
@@ -2268,7 +2241,7 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
|
||||
// ignore noops
|
||||
// TODO is there a better way to represent noops?
|
||||
if (lfsr_tag_cleargrow(tag) == LFSR_TAG_UNR && delta == 0) {
|
||||
if (lfsr_tag_cleargrow(tag) == LFSR_TAG_RM && delta == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2663,13 +2636,16 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
< lfsr_tag_key(tag)))))) {
|
||||
if (lfsr_tag_isrm(tag)) {
|
||||
// if removed, make our tag unreachable
|
||||
alt = LFSR_TAG_ALTGT(false, 0);
|
||||
alt = LFSR_TAG_ALT(GT, B, 0);
|
||||
weight = upper_rid - lower_rid - 1 + delta;
|
||||
upper_rid -= weight;
|
||||
} else {
|
||||
// split less than
|
||||
alt = LFSR_TAG_ALTLE(
|
||||
!lfsr_tag_hasdiverged(tag_),
|
||||
alt = LFSR_TAG_ALT(
|
||||
LE,
|
||||
TAG(!lfsr_tag_hasdiverged(tag_)
|
||||
? LFSR_TAG_R
|
||||
: LFSR_TAG_B),
|
||||
lfsr_tag_key(tag_));
|
||||
weight = rid_ - lower_rid;
|
||||
lower_rid += weight;
|
||||
@@ -2686,13 +2662,16 @@ static int lfsr_rbyd_append(lfs_t *lfs, lfsr_rbyd_t *rbyd,
|
||||
> lfsr_tag_key(tag)))))) {
|
||||
if (lfsr_tag_isrm(tag)) {
|
||||
// if removed, make our tag unreachable
|
||||
alt = LFSR_TAG_ALTGT(false, 0);
|
||||
alt = LFSR_TAG_ALT(GT, B, 0);
|
||||
weight = upper_rid - lower_rid - 1 + delta;
|
||||
upper_rid -= weight;
|
||||
} else {
|
||||
// split greater than
|
||||
alt = LFSR_TAG_ALTGT(
|
||||
!lfsr_tag_hasdiverged(tag_),
|
||||
alt = LFSR_TAG_ALT(
|
||||
GT,
|
||||
TAG(!lfsr_tag_hasdiverged(tag_)
|
||||
? LFSR_TAG_R
|
||||
: LFSR_TAG_B),
|
||||
lfsr_tag_key(tag));
|
||||
weight = upper_rid - rid - 1;
|
||||
upper_rid -= weight;
|
||||
@@ -3008,7 +2987,7 @@ static int lfsr_rbyd_appendgdelta(lfs_t *lfs, lfsr_rbyd_t *rbyd) {
|
||||
lfs_size_t size = lfsr_grm_size(grm_buf);
|
||||
err = lfsr_rbyd_append(lfs, rbyd, -1,
|
||||
// opportunistically remove this tag if delta is all zero
|
||||
(size == 0 ? LFSR_TAG_RMGRM : LFSR_TAG_GRM), 0,
|
||||
(size == 0 ? LFSR_TAG_RM(GRM) : LFSR_TAG_GRM), 0,
|
||||
LFSR_DATA(grm_buf, size));
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -3172,7 +3151,7 @@ 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->eoff,
|
||||
LFSR_TAG_ALTLE(false, lfsr_tag_key(trunk_tag)),
|
||||
LFSR_TAG_ALT(LE, B, lfsr_tag_key(trunk_tag)),
|
||||
trunk_weight,
|
||||
rbyd->eoff - trunk_off,
|
||||
&rbyd->cksum);
|
||||
@@ -3670,7 +3649,7 @@ static int lfsr_btree_lookupnext_(lfs_t *lfs,
|
||||
}
|
||||
|
||||
if (lfsr_tag_suptype(tag__) == LFSR_TAG_NAME) {
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDESTRUCT,
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDE(STRUCT),
|
||||
&tag__, &data__);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||
@@ -3791,7 +3770,7 @@ static int lfsr_btree_parent(lfs_t *lfs,
|
||||
}
|
||||
|
||||
if (lfsr_tag_suptype(tag__) == LFSR_TAG_NAME) {
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDESTRUCT,
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDE(STRUCT),
|
||||
&tag__, &data__);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||
@@ -3921,11 +3900,11 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
// note that since we defer merges to compaction time, we can
|
||||
// end up removing an rbyd here
|
||||
if (rbyd->weight == 0) {
|
||||
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight,
|
||||
attrs[0] = LFSR_ATTR(pid, RM, +rbyd->weight-pweight,
|
||||
BUF(scratch_buf, scratch_dsize));
|
||||
attr_count = 1;
|
||||
} else {
|
||||
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd->weight-pweight, NULL);
|
||||
attrs[0] = LFSR_ATTR(pid, GROW(RM), +rbyd->weight-pweight, NULL);
|
||||
attrs[1] = LFSR_ATTR(pid+rbyd->weight-pweight, BTREE, 0,
|
||||
BUF(scratch_buf, scratch_dsize));
|
||||
attr_count = 2;
|
||||
@@ -4032,11 +4011,11 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
// note that since we defer merges to compaction time, we can
|
||||
// end up removing an rbyd here
|
||||
if (rbyd->weight == 0) {
|
||||
attrs[0] = LFSR_ATTR(pid, UNR, +rbyd->weight-pweight,
|
||||
attrs[0] = LFSR_ATTR(pid, RM, +rbyd->weight-pweight,
|
||||
BUF(scratch_buf, scratch_dsize));
|
||||
attr_count = 1;
|
||||
} else {
|
||||
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd->weight-pweight, NULL);
|
||||
attrs[0] = LFSR_ATTR(pid, GROW(RM), +rbyd->weight-pweight, NULL);
|
||||
attrs[1] = LFSR_ATTR(pid+rbyd->weight-pweight, BTREE, 0,
|
||||
BUF(scratch_buf, scratch_dsize));
|
||||
attr_count = 2;
|
||||
@@ -4166,7 +4145,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
// yes parent? push up split
|
||||
} else {
|
||||
// prepare commit to parent, tail recursing upwards
|
||||
attrs[0] = LFSR_ATTR(pid, GROW, +rbyd_.weight-pweight, NULL);
|
||||
attrs[0] = LFSR_ATTR(pid, GROW(RM), +rbyd_.weight-pweight, NULL);
|
||||
attrs[1] = LFSR_ATTR(pid-(pweight-1)+rbyd_.weight-1, BTREE, 0,
|
||||
BUF(scratch1_buf, scratch1_dsize));
|
||||
attrs[2] = (lfsr_tag_suptype(stag) == LFSR_TAG_NAME
|
||||
@@ -4244,7 +4223,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
|
||||
if (stag == LFSR_TAG_NAME) {
|
||||
err = lfsr_rbyd_lookup(lfs, &parent,
|
||||
sid, LFSR_TAG_WIDESTRUCT,
|
||||
sid, LFSR_TAG_WIDE(STRUCT),
|
||||
&stag, &sdata);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||
@@ -4312,7 +4291,7 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
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_),
|
||||
LFSR_TAG_RM, -(rbyd_.weight-rweight_),
|
||||
LFSR_DATA_NULL);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -4384,8 +4363,8 @@ static int lfsr_btree_commit(lfs_t *lfs,
|
||||
}
|
||||
|
||||
// prepare commit to parent, tail recursing upwards
|
||||
attrs[0] = LFSR_ATTR(sid, UNR, -sweight, NULL);
|
||||
attrs[1] = LFSR_ATTR(pid, GROW, +rbyd_.weight-pweight, NULL);
|
||||
attrs[0] = LFSR_ATTR(sid, RM, -sweight, NULL);
|
||||
attrs[1] = LFSR_ATTR(pid, GROW(RM), +rbyd_.weight-pweight, NULL);
|
||||
attrs[2] = LFSR_ATTR(pid+rbyd_.weight-pweight, BTREE, 0,
|
||||
BUF(scratch_buf, scratch_dsize));
|
||||
attr_count = 3;
|
||||
@@ -4541,7 +4520,7 @@ static int lfsr_btree_set(lfs_t *lfs, lfsr_btree_t *btree,
|
||||
? LFSR_ATTR(rid, TAG(lfsr_tag_setrm(rtag)), 0, NULL)
|
||||
: LFSR_ATTR_NOOP),
|
||||
LFSR_ATTR(rid, TAG(tag), 0, DATA(data)),
|
||||
LFSR_ATTR(rid, GROW, +weight-rweight, NULL)));
|
||||
LFSR_ATTR(rid, GROW(RM), +weight-rweight, NULL)));
|
||||
if (degenerate < 0) {
|
||||
return degenerate;
|
||||
}
|
||||
@@ -4596,7 +4575,7 @@ static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) {
|
||||
// revert to an inlined btree
|
||||
int degenerate = lfsr_btree_commit(lfs, btree, bid, 2, &rbyd,
|
||||
LFSR_BTREE_ATTRS(
|
||||
LFSR_ATTR(rid, UNR, -rweight, NULL)));
|
||||
LFSR_ATTR(rid, RM, -rweight, NULL)));
|
||||
if (degenerate < 0) {
|
||||
return degenerate;
|
||||
}
|
||||
@@ -4627,7 +4606,7 @@ static int lfsr_btree_pop(lfs_t *lfs, lfsr_btree_t *btree, lfs_size_t bid) {
|
||||
}
|
||||
|
||||
if (lfsr_tag_suptype(stag) == LFSR_TAG_NAME) {
|
||||
err = lfsr_rbyd_lookup(lfs, &rbyd, sid, LFSR_TAG_WIDESTRUCT,
|
||||
err = lfsr_rbyd_lookup(lfs, &rbyd, sid, LFSR_TAG_WIDE(STRUCT),
|
||||
&stag, &sdata);
|
||||
if (err) {
|
||||
LFS_ASSERT(err == LFS_ERR_NOENT);
|
||||
@@ -4706,7 +4685,7 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
||||
// of the rest
|
||||
int degenerate = lfsr_btree_commit(lfs, btree, bid, -1, &rbyd,
|
||||
LFSR_BTREE_ATTRS(
|
||||
LFSR_ATTR(rid, GROW, +weight1-rweight, NULL),
|
||||
LFSR_ATTR(rid, GROW(RM), +weight1-rweight, NULL),
|
||||
LFSR_ATTR(rid-(rweight-1)+weight1-1, TAG(tag1), 0,
|
||||
DATA(data1)),
|
||||
(lfsr_data_size(&name) > 0
|
||||
@@ -4772,7 +4751,7 @@ static int lfsr_btree_namelookup(lfs_t *lfs, const lfsr_btree_t *btree,
|
||||
// the name may not match exactly, but indicates which branch to follow
|
||||
lfsr_tag_t tag__;
|
||||
lfsr_data_t data__;
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDESTRUCT,
|
||||
err = lfsr_rbyd_lookup(lfs, &branch, rid__, LFSR_TAG_WIDE(STRUCT),
|
||||
&tag__, &data__);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||
@@ -4903,7 +4882,7 @@ static int lfsr_btree_traversal_next(lfs_t *lfs,
|
||||
|
||||
if (lfsr_tag_suptype(tag__) == LFSR_TAG_NAME) {
|
||||
err = lfsr_rbyd_lookup(lfs, &traversal->branch,
|
||||
rid__, LFSR_TAG_WIDESTRUCT,
|
||||
rid__, LFSR_TAG_WIDE(STRUCT),
|
||||
&tag__, &data__);
|
||||
if (err) {
|
||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||
@@ -5888,15 +5867,15 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
|
||||
uint8_t mtree_buf[LFSR_MTREE_DSIZE];
|
||||
lfs_ssize_t mtree_dsize;
|
||||
if (lfsr_btree_isnull(&mtree_)) {
|
||||
mtree_tag = LFSR_TAG_RMWIDESTRUCT;
|
||||
mtree_tag = LFSR_TAG_RM(WIDE(STRUCT));
|
||||
mtree_dsize = 0;
|
||||
} else if (lfsr_btree_isinlined(&mtree_)) {
|
||||
LFS_ASSERT(mtree_.u.i.tag == LFSR_TAG_MDIR);
|
||||
mtree_tag = LFSR_TAG_WIDEMDIR;
|
||||
mtree_tag = LFSR_TAG_WIDE(MDIR);
|
||||
memcpy(mtree_buf, mtree_.u.i.buffer, mtree_.u.i.size);
|
||||
mtree_dsize = mtree_.u.i.size;
|
||||
} else {
|
||||
mtree_tag = LFSR_TAG_WIDEMTREE;
|
||||
mtree_tag = LFSR_TAG_WIDE(MTREE);
|
||||
mtree_dsize = lfsr_btree_todisk(lfs, &mtree_.u.r.rbyd, mtree_buf);
|
||||
if (mtree_dsize < 0) {
|
||||
return mtree_dsize;
|
||||
@@ -6393,7 +6372,7 @@ static int lfsr_mtree_traversal_next(lfs_t *lfs,
|
||||
lfsr_tag_t tag;
|
||||
lfsr_data_t data;
|
||||
int err = lfsr_mdir_lookup(lfs, &traversal->mdir,
|
||||
-1, LFSR_TAG_WIDESTRUCT,
|
||||
-1, LFSR_TAG_WIDE(STRUCT),
|
||||
&tag, &data);
|
||||
if (err && err != LFS_ERR_NOENT) {
|
||||
return err;
|
||||
@@ -7344,7 +7323,7 @@ int lfsr_remove(lfs_t *lfs, const char *path) {
|
||||
if (err != LFS_ERR_NOENT) {
|
||||
lfsr_tag_t tag_;
|
||||
err = lfsr_mdir_lookup(lfs, &mdir_,
|
||||
mdir_.mid.rid, LFSR_TAG_WIDENAME,
|
||||
mdir_.mid.rid, LFSR_TAG_WIDE(NAME),
|
||||
&tag_, NULL);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -7364,7 +7343,7 @@ int lfsr_remove(lfs_t *lfs, const char *path) {
|
||||
|
||||
// remove the metadata entry
|
||||
err = lfsr_mdir_commit(lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(mdir.mid.rid, UNR, -1, NULL),
|
||||
LFSR_ATTR(mdir.mid.rid, RM, -1, NULL),
|
||||
LFSR_ATTR(-1, GRM, 0, GRM(&grm))));
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -7476,7 +7455,7 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) {
|
||||
if (err != LFS_ERR_NOENT) {
|
||||
lfsr_tag_t tag_;
|
||||
err = lfsr_mdir_lookup(lfs, &mdir_,
|
||||
mdir_.mid.rid, LFSR_TAG_WIDENAME,
|
||||
mdir_.mid.rid, LFSR_TAG_WIDE(NAME),
|
||||
&tag_, NULL);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -7493,7 +7472,7 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) {
|
||||
// new rid, while also marking the old rid for removal
|
||||
err = lfsr_mdir_commit(lfs, &new_mdir, LFSR_ATTRS(
|
||||
(exists
|
||||
? LFSR_ATTR(new_mdir.mid.rid, UNR, -1, NULL)
|
||||
? LFSR_ATTR(new_mdir.mid.rid, RM, -1, NULL)
|
||||
: LFSR_ATTR_NOOP),
|
||||
LFSR_ATTR(new_mdir.mid.rid, TAG(old_tag), +1,
|
||||
NAME(new_did, new_name, new_name_size)),
|
||||
@@ -7623,7 +7602,7 @@ int lfsr_dir_read(lfs_t *lfs, lfsr_dir_t *dir, struct lfs_info *info) {
|
||||
lfsr_tag_t tag;
|
||||
lfsr_data_t data;
|
||||
err = lfsr_mdir_lookup(lfs, &dir->pos_mdir,
|
||||
dir->pos_mdir.mid.rid, LFSR_TAG_WIDENAME,
|
||||
dir->pos_mdir.mid.rid, LFSR_TAG_WIDE(NAME),
|
||||
&tag, &data);
|
||||
if (err) {
|
||||
return err;
|
||||
@@ -7740,7 +7719,7 @@ static int lfsr_fs_fixgrm(lfs_t *lfs) {
|
||||
// remove the rid while also updating our grm
|
||||
LFS_ASSERT(lfs->grm.mids[0].rid < (lfs_ssize_t)mdir.u.m.weight);
|
||||
err = lfsr_mdir_commit(lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(mdir.mid.rid, UNR, -1, NULL),
|
||||
LFSR_ATTR(mdir.mid.rid, RM, -1, NULL),
|
||||
LFSR_ATTR(-1, GRM, 0, GRM(&grm))));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
lfsr_mdir_t mdir;
|
||||
lfsr_mtree_lookup(&lfs, LFSR_MID(lfsr_mtree_weight(&lfs)-1, -1),
|
||||
|
||||
+64
-64
@@ -150,7 +150,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -225,7 +225,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -299,7 +299,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -401,7 +401,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -490,7 +490,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -598,7 +598,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -625,7 +625,7 @@ code = '''
|
||||
assert(mdir.u.m.weight == 1);
|
||||
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -668,7 +668,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -698,7 +698,7 @@ code = '''
|
||||
mdir.u.r.rbyd.eoff = BLOCK_SIZE;
|
||||
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -741,7 +741,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -758,7 +758,7 @@ code = '''
|
||||
|
||||
// remove the entry as we compact, forcing the mdir to be dropped
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -801,7 +801,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -819,7 +819,7 @@ code = '''
|
||||
// remove the left entry as we compact, forcing the left
|
||||
// mdir to be dropped
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 1);
|
||||
@@ -869,7 +869,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -887,7 +887,7 @@ code = '''
|
||||
// remove the right entry as we compact, forcing the right mdir
|
||||
// to be dropped
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 1);
|
||||
@@ -937,7 +937,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -954,8 +954,8 @@ code = '''
|
||||
|
||||
// remove both entries as we compact, forcing both mdirs to be dropped
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -988,7 +988,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1024,7 +1024,7 @@ code = '''
|
||||
// remove the left entry as we compact, forcing the left
|
||||
// mdir to be dropped
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 1);
|
||||
@@ -1083,7 +1083,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1119,7 +1119,7 @@ code = '''
|
||||
// remove the right entry as we compact, forcing the right
|
||||
// mdir to be dropped
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 1);
|
||||
@@ -1178,7 +1178,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1213,8 +1213,8 @@ code = '''
|
||||
|
||||
// remove both entries as we compact, forcing both mdirs to be dropped
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -1260,7 +1260,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -1297,7 +1297,7 @@ code = '''
|
||||
}
|
||||
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
}
|
||||
|
||||
// try looking up each entry
|
||||
@@ -1361,7 +1361,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
for (lfs_size_t cycle = 0; cycle < CYCLES; cycle++) {
|
||||
// create entries
|
||||
@@ -1418,7 +1418,7 @@ code = '''
|
||||
}
|
||||
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
}
|
||||
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -1451,7 +1451,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -1496,7 +1496,7 @@ code = '''
|
||||
// delete
|
||||
} else {
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(mdir.mid.rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(mdir.mid.rid, RM, -1, NULL))) => 0;
|
||||
|
||||
count -= 1;
|
||||
}
|
||||
@@ -1583,7 +1583,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1679,7 +1679,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1774,7 +1774,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1869,7 +1869,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1929,7 +1929,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1988,7 +1988,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2056,7 +2056,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2163,7 +2163,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2277,7 +2277,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2309,7 +2309,7 @@ code = '''
|
||||
assert(mdir.u.m.weight == 1);
|
||||
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert mdir was dropped
|
||||
assert(lfsr_mtree_weight(&lfs) == 0);
|
||||
@@ -2360,7 +2360,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// force mroot to compact once, so the second compact below will trigger
|
||||
// a relocation
|
||||
@@ -2449,7 +2449,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// force mroot to compact once, so the second compact below will trigger
|
||||
// a relocation
|
||||
@@ -2539,7 +2539,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -2597,7 +2597,7 @@ code = '''
|
||||
// delete
|
||||
} else {
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(mdir.mid.rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(mdir.mid.rid, RM, -1, NULL))) => 0;
|
||||
|
||||
count -= 1;
|
||||
}
|
||||
@@ -2679,7 +2679,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -2734,7 +2734,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -2752,7 +2752,7 @@ code = '''
|
||||
|
||||
// try removing our left entry
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert that an entry was removed
|
||||
assert(lfs.mroot.u.m.weight == 1);
|
||||
@@ -2780,7 +2780,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -2798,7 +2798,7 @@ code = '''
|
||||
|
||||
// try removing our left entry
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
// assert that an entry was removed
|
||||
assert(lfs.mroot.u.m.weight == 1);
|
||||
@@ -2828,7 +2828,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -2912,7 +2912,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -2991,7 +2991,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3098,7 +3098,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -3169,7 +3169,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3267,7 +3267,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
//// create a situation where we have 3 mdirs in our tree
|
||||
|
||||
@@ -3364,7 +3364,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
//// create a situation where we have 3 mdirs in our tree
|
||||
|
||||
@@ -3420,7 +3420,7 @@ code = '''
|
||||
lfsr_mtree_lookup(&lfs, LFSR_MID(1, -1), &mdir) => 0;
|
||||
assert(mdir.u.m.weight == 1);
|
||||
lfsr_mdir_commit(&lfs, &mdir, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// we should now have 2 mdirs
|
||||
assert(lfsr_mtree_weight(&lfs) == 2);
|
||||
@@ -3458,7 +3458,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// insert a new entry, this should update our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
@@ -3561,7 +3561,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3697,7 +3697,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3835,7 +3835,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3952,7 +3952,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -4101,7 +4101,7 @@ code = '''
|
||||
lfs_alloc_ack(&lfs);
|
||||
// remove root dstart for now
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
|
||||
+107
-106
@@ -2615,7 +2615,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
@@ -2635,7 +2635,7 @@ code = '''
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(-1, UATTR(2), 0, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
@@ -2671,7 +2671,7 @@ code = '''
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(-1, UATTR(2), 0, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(2), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(2)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
@@ -2771,7 +2771,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(j+1), 0, NULL)))
|
||||
LFSR_ATTR(-1, RM(UATTR(j+1)), 0, NULL)))
|
||||
=> 0;
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -2916,7 +2916,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(j+1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(j+1)), 0, NULL))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -2995,7 +2995,7 @@ code = '''
|
||||
|
||||
// try to remove tags that aren't there, this should do nothing
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3020,7 +3020,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(3), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(3)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3045,7 +3045,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(5), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(5)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3124,9 +3124,9 @@ code = '''
|
||||
LFSR_ATTR(-1, UATTR(5), 0, BUF("\xee\xee\xee\xee", 4)))) => 0;
|
||||
// remove several attributes
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL),
|
||||
LFSR_ATTR(-1, RMUATTR(3), 0, NULL),
|
||||
LFSR_ATTR(-1, RMUATTR(5), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL),
|
||||
LFSR_ATTR(-1, RM(UATTR(3)), 0, NULL),
|
||||
LFSR_ATTR(-1, RM(UATTR(5)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
@@ -3153,7 +3153,7 @@ code = '''
|
||||
|
||||
// try to remove tags that aren't there, this should do nothing
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3178,7 +3178,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(3), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(3)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3203,7 +3203,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(5), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(5)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3230,7 +3230,7 @@ code = '''
|
||||
// try to remove the tags again, just to make sure (keep in mind
|
||||
// these removes still commit to the rbyd)
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3255,7 +3255,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(3), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(3)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3280,7 +3280,7 @@ code = '''
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(5), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(5)), 0, NULL))) => 0;
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR(2));
|
||||
@@ -3354,7 +3354,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
@@ -3374,8 +3374,8 @@ code = '''
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(-1, UATTR(2), 0, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL),
|
||||
LFSR_ATTR(-1, RMUATTR(2), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL),
|
||||
LFSR_ATTR(-1, RM(UATTR(2)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
@@ -3395,8 +3395,8 @@ code = '''
|
||||
LFSR_ATTR(-1, UATTR(1), 0, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(-1, UATTR(2), 0, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(2), 0, NULL),
|
||||
LFSR_ATTR(-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(2)), 0, NULL),
|
||||
LFSR_ATTR(-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(1),
|
||||
&rid_, &tag_, NULL, &data_) => LFS_ERR_NOENT;
|
||||
@@ -3484,7 +3484,7 @@ code = '''
|
||||
// remove each tag in permutation order
|
||||
for (unsigned j = 0; j < N; j++) {
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(perm[j]+1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(perm[j]+1)), 0, NULL))) => 0;
|
||||
}
|
||||
|
||||
// check that all tags are now removed
|
||||
@@ -3600,7 +3600,7 @@ code = '''
|
||||
sim[attr] = '\0';
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(-1, RMUATTR(attr), 0, NULL))) => 0;
|
||||
LFSR_ATTR(-1, RM(UATTR(attr)), 0, NULL))) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6109,7 +6109,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j/M, RMUATTR((j%M)+1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(j/M, RM(UATTR((j%M)+1)), 0, NULL))) => 0;
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
@@ -6291,7 +6291,8 @@ code = '''
|
||||
// remove each tag in permutation order
|
||||
for (unsigned j = 0; j < N*M; j++) {
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(perm[j]/M, RMUATTR(perm[j]%M+1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(perm[j]/M, RM(UATTR(perm[j]%M+1)),
|
||||
0, NULL))) => 0;
|
||||
}
|
||||
|
||||
// check that all tags have been removed
|
||||
@@ -6744,7 +6745,7 @@ code = '''
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 1);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6764,7 +6765,7 @@ code = '''
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 1);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6785,7 +6786,7 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(2, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(2, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6808,7 +6809,7 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6831,7 +6832,7 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6872,7 +6873,7 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF( "\xbb\xbb", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 1);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -6908,7 +6909,7 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF( "\xbb\xbb", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 1);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -6946,7 +6947,7 @@ code = '''
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(2, UATTR(1), 0, BUF( "\xcc\xcc", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(2, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(2, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4) => 4;
|
||||
@@ -6995,7 +6996,7 @@ code = '''
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(2, UATTR(1), 0, BUF( "\xcc\xcc", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7045,7 +7046,7 @@ code = '''
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(2, UATTR(1), 0, BUF( "\xcc\xcc", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 2);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7176,7 +7177,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == N-1);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -7336,7 +7337,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == N-1);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -7519,7 +7520,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == N-1);
|
||||
|
||||
// try traversing over the tags
|
||||
@@ -7649,7 +7650,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == N-1);
|
||||
|
||||
// try traversing over the tags
|
||||
@@ -7721,7 +7722,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7739,8 +7740,8 @@ code = '''
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7758,8 +7759,8 @@ code = '''
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7778,9 +7779,9 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7799,9 +7800,9 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(2, UNR, -1, NULL),
|
||||
LFSR_ATTR(1, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(2, RM, -1, NULL),
|
||||
LFSR_ATTR(1, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7836,7 +7837,7 @@ code = '''
|
||||
LFSR_ATTR(0, REG, +1, BUF("\xaa\xaa\xaa\xaa", 4)),
|
||||
LFSR_ATTR(0, UATTR(1), 0, BUF( "\xaa\xaa", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7856,8 +7857,8 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF( "\xbb\xbb", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7877,8 +7878,8 @@ code = '''
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF( "\xbb\xbb", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(1, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7900,9 +7901,9 @@ code = '''
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(2, UATTR(1), 0, BUF( "\xcc\xcc", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -7924,9 +7925,9 @@ code = '''
|
||||
LFSR_ATTR(2, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(2, UATTR(1), 0, BUF( "\xcc\xcc", 2)))) => 0;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(2, UNR, -1, NULL),
|
||||
LFSR_ATTR(1, UNR, -1, NULL),
|
||||
LFSR_ATTR(0, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(2, RM, -1, NULL),
|
||||
LFSR_ATTR(1, RM, -1, NULL),
|
||||
LFSR_ATTR(0, RM, -1, NULL))) => 0;
|
||||
|
||||
assert(rbyd.weight == 0);
|
||||
lfsr_rbyd_get(&lfs, &rbyd, 0, LFSR_TAG_REG, buffer, 4)
|
||||
@@ -8028,7 +8029,7 @@ code = '''
|
||||
|
||||
lfs_size_t rbyd_weight_before = rbyd.weight;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(rid, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == rbyd_weight_before-1);
|
||||
}
|
||||
|
||||
@@ -8176,7 +8177,7 @@ code = '''
|
||||
|
||||
lfs_size_t rbyd_weight_before = rbyd.weight;
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(rid, RM, -1, NULL))) => 0;
|
||||
assert(rbyd.weight == rbyd_weight_before-1);
|
||||
}
|
||||
|
||||
@@ -8313,7 +8314,7 @@ code = '''
|
||||
count -= 1;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(rid, RM, -1, NULL))) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8955,7 +8956,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF("\xbb\xbb", 2)),
|
||||
LFSR_ATTR(1, UNR, +1, NULL),
|
||||
LFSR_ATTR(1, RM, +1, NULL),
|
||||
LFSR_ATTR(2, UATTR(2), 0, BUF("\xbb\xbb", 2)))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(3),
|
||||
@@ -9049,7 +9050,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(3, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(3, UATTR(1), 0, BUF("\xcc\xcc", 2)),
|
||||
LFSR_ATTR(3, UNR, +2, NULL),
|
||||
LFSR_ATTR(3, RM, +2, NULL),
|
||||
LFSR_ATTR(5, UATTR(2), 0, BUF("\xcc\xcc", 2)))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(3),
|
||||
@@ -9179,7 +9180,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(6, REG, +1, BUF("\xdd\xdd\xdd\xdd", 4)),
|
||||
LFSR_ATTR(6, UATTR(1), 0, BUF("\xdd\xdd", 2)),
|
||||
LFSR_ATTR(6, UNR, +3, NULL),
|
||||
LFSR_ATTR(6, RM, +3, NULL),
|
||||
LFSR_ATTR(9, UATTR(2), 0, BUF("\xdd\xdd", 2)))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(3),
|
||||
@@ -9345,7 +9346,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(10, REG, +1, BUF("\xee\xee\xee\xee", 4)),
|
||||
LFSR_ATTR(10, UATTR(1), 0, BUF("\xee\xee", 2)),
|
||||
LFSR_ATTR(10, UNR, +4, NULL),
|
||||
LFSR_ATTR(10, RM, +4, NULL),
|
||||
LFSR_ATTR(14, UATTR(2), 0, BUF("\xee\xee", 2)))) => 0;
|
||||
|
||||
lfsr_rbyd_lookupnext(&lfs, &rbyd, -1, LFSR_TAG_UATTR(3),
|
||||
@@ -9574,22 +9575,22 @@ code = '''
|
||||
// make id2 with weight w2
|
||||
LFSR_ATTR(1, REG, +1, BUF("\xbb\xbb\xbb\xbb", 4)),
|
||||
LFSR_ATTR(1, UATTR(1), 0, BUF("\xbb\xbb", 2)),
|
||||
LFSR_ATTR(1, UNR, +1, NULL),
|
||||
LFSR_ATTR(1, RM, +1, NULL),
|
||||
LFSR_ATTR(2, UATTR(2), 0, BUF("\xbb\xbb", 2)),
|
||||
// make id5 with weight w3
|
||||
LFSR_ATTR(3, REG, +1, BUF("\xcc\xcc\xcc\xcc", 4)),
|
||||
LFSR_ATTR(3, UATTR(1), 0, BUF("\xcc\xcc", 2)),
|
||||
LFSR_ATTR(3, UNR, +2, NULL),
|
||||
LFSR_ATTR(3, RM, +2, NULL),
|
||||
LFSR_ATTR(5, UATTR(2), 0, BUF("\xcc\xcc", 2)),
|
||||
// make id9 with weight w4
|
||||
LFSR_ATTR(6, REG, +1, BUF("\xdd\xdd\xdd\xdd", 4)),
|
||||
LFSR_ATTR(6, UATTR(1), 0, BUF("\xdd\xdd", 2)),
|
||||
LFSR_ATTR(6, UNR, +3, NULL),
|
||||
LFSR_ATTR(6, RM, +3, NULL),
|
||||
LFSR_ATTR(9, UATTR(2), 0, BUF("\xdd\xdd", 2)),
|
||||
// make id14 with weight w5
|
||||
LFSR_ATTR(10, REG, +1, BUF("\xee\xee\xee\xee", 4)),
|
||||
LFSR_ATTR(10, UATTR(1), 0, BUF("\xee\xee", 2)),
|
||||
LFSR_ATTR(10, UNR, +4, NULL),
|
||||
LFSR_ATTR(10, RM, +4, NULL),
|
||||
LFSR_ATTR(14, UATTR(2), 0, BUF("\xee\xee", 2)))) => 0;
|
||||
|
||||
// traverse, finding tags and weights
|
||||
@@ -9865,7 +9866,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid*W, REG, +1, BUF(names[perm[j] % 6], 4)),
|
||||
LFSR_ATTR(rid*W, UATTR(1), 0, BUF(names[perm[j] % 6], 2)),
|
||||
LFSR_ATTR(rid*W, UNR, +W-1, NULL),
|
||||
LFSR_ATTR(rid*W, RM, +W-1, NULL),
|
||||
LFSR_ATTR(rid*W+W-1, UATTR(2), 0,
|
||||
BUF(names[perm[j] % 6], 2)))) => 0;
|
||||
}
|
||||
@@ -9976,7 +9977,7 @@ code = '''
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid*W, REG, +1, BUF(names[perm[j] % 6], 4)),
|
||||
LFSR_ATTR(rid*W, UATTR(1), 0, BUF(names[perm[j] % 6], 2)),
|
||||
LFSR_ATTR(rid*W, UNR, +W-1, NULL),
|
||||
LFSR_ATTR(rid*W, RM, +W-1, NULL),
|
||||
LFSR_ATTR(rid*W+W-1, UATTR(2), 0,
|
||||
BUF(names[perm[j] % 6], 2)))) => 0;
|
||||
}
|
||||
@@ -10115,7 +10116,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, UNR, +D, NULL))) => 0;
|
||||
LFSR_ATTR(j*W+W-1, RM, +D, NULL))) => 0;
|
||||
assert(rbyd.weight == N*W+D);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -10242,7 +10243,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROWREG, +D,
|
||||
LFSR_ATTR(j*W+W-1, GROW(REG), +D,
|
||||
BUF(names[j % 6], 6)))) => 0;
|
||||
assert(rbyd.weight == N*W+D);
|
||||
|
||||
@@ -10378,7 +10379,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROWUATTR(1), +D,
|
||||
LFSR_ATTR(j*W+W-1, GROW(UATTR(1)), +D,
|
||||
BUF(names[j % 6], 6)))) => 0;
|
||||
assert(rbyd.weight == N*W+D);
|
||||
|
||||
@@ -10526,7 +10527,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROW, -D, NULL))) => 0;
|
||||
LFSR_ATTR(j*W+W-1, GROW(RM), -D, NULL))) => 0;
|
||||
assert(rbyd.weight == N*W-D);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -10653,7 +10654,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROWREG, -D,
|
||||
LFSR_ATTR(j*W+W-1, GROW(REG), -D,
|
||||
BUF(names[j % 6], 6)))) => 0;
|
||||
assert(rbyd.weight == N*W-D);
|
||||
|
||||
@@ -10789,7 +10790,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, GROWUATTR(1), -D,
|
||||
LFSR_ATTR(j*W+W-1, GROW(UATTR(1)), -D,
|
||||
BUF(names[j % 6], 6)))) => 0;
|
||||
assert(rbyd.weight == N*W-D);
|
||||
|
||||
@@ -10936,7 +10937,7 @@ code = '''
|
||||
lfs_bd_flush(&lfs, &lfs.pcache, &lfs.rcache, false) => 0;
|
||||
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, UNR, -W, NULL))) => 0;
|
||||
LFSR_ATTR(j*W+W-1, RM, -W, NULL))) => 0;
|
||||
assert(rbyd.weight == (N-1)*W);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -11122,7 +11123,7 @@ code = '''
|
||||
// now try removing the attr
|
||||
printf("--- removing: %d ---\n", j);
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j*W+W-1, RMUATTR(1), 0, NULL))) => 0;
|
||||
LFSR_ATTR(j*W+W-1, RM(UATTR(1)), 0, NULL))) => 0;
|
||||
assert(rbyd.weight == N*W);
|
||||
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -11265,7 +11266,7 @@ code = '''
|
||||
count -= 1;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, UNR, -1, NULL))) => 0;
|
||||
LFSR_ATTR(rid, RM, -1, NULL))) => 0;
|
||||
} else if (op == 2) {
|
||||
// update our sim
|
||||
sim[rid*(M+1) + u+1] = alpha[i % 26];
|
||||
@@ -11278,7 +11279,7 @@ code = '''
|
||||
sim[rid*(M+1) + u+1] = '\0';
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, RMUATTR(u), 0, NULL))) => 0;
|
||||
LFSR_ATTR(rid, RM(UATTR(u)), 0, NULL))) => 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11435,7 +11436,7 @@ code = '''
|
||||
count -= 1;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(weighted_rid+weight_-1, UNR, -weight_,
|
||||
LFSR_ATTR(weighted_rid+weight_-1, RM, -weight_,
|
||||
NULL))) => 0;
|
||||
} else if (op == 2) {
|
||||
// get the correct weight from the sim
|
||||
@@ -11444,7 +11445,7 @@ code = '''
|
||||
sim_weights[rid] += weight;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW, +weight,
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), +weight,
|
||||
NULL))) => 0;
|
||||
} else if (op == 3) {
|
||||
// get the correct weight from the sim
|
||||
@@ -11456,7 +11457,7 @@ code = '''
|
||||
sim_weights[rid] -= weight;
|
||||
// update our rbyd
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW, -weight,
|
||||
LFSR_ATTR(weighted_rid+weight_-1, GROW(RM), -weight,
|
||||
NULL))) => 0;
|
||||
}
|
||||
}
|
||||
@@ -11601,7 +11602,7 @@ code = '''
|
||||
for (unsigned j = 0; j < N; j++) {
|
||||
lfsr_tag_t tag_;
|
||||
lfsr_data_t data_;
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
|
||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||
@@ -11700,7 +11701,7 @@ code = '''
|
||||
|
||||
// remove with a wide tag
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, RMWIDEUATTR, 0, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM(WIDE(UATTR)), 0, NULL))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -11731,10 +11732,10 @@ code = '''
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
if (k == j) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => LFS_ERR_NOENT;
|
||||
} else {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||
assert(lfsr_data_size(&data_) == 2);
|
||||
@@ -11837,7 +11838,7 @@ code = '''
|
||||
|
||||
// replace with bitwise inverse
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||
LFSR_ATTR(j, WIDE(UATTR(~(j + SHIFT) & 0x7f)), 0,
|
||||
BUF(names[j % 6], 3)))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
@@ -11873,7 +11874,7 @@ code = '''
|
||||
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
if (k == j) {
|
||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||
@@ -11966,7 +11967,7 @@ code = '''
|
||||
for (unsigned j = 0; j < N; j++) {
|
||||
lfsr_tag_t tag_;
|
||||
lfsr_data_t data_;
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
|
||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||
@@ -12067,7 +12068,7 @@ code = '''
|
||||
|
||||
// remove with a wide tag
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, RMWIDEUATTR, 0, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM(WIDE(UATTR)), 0, NULL))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -12105,10 +12106,10 @@ code = '''
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
if (k == j) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => LFS_ERR_NOENT;
|
||||
} else {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||
assert(lfsr_data_size(&data_) == 2);
|
||||
@@ -12213,7 +12214,7 @@ code = '''
|
||||
|
||||
// replace with bitwise inverse
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||
LFSR_ATTR(j, WIDE(UATTR(~(j + SHIFT) & 0x7f)), 0,
|
||||
BUF(names[j % 6], 3)))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
@@ -12256,7 +12257,7 @@ code = '''
|
||||
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
if (k == j) {
|
||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||
@@ -12346,7 +12347,7 @@ code = '''
|
||||
for (unsigned j = 0; j < N; j++) {
|
||||
lfsr_tag_t tag_;
|
||||
lfsr_data_t data_;
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, j, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
|
||||
assert(tag_ == LFSR_TAG_UATTR((j + SHIFT) & 0x7f));
|
||||
@@ -12444,7 +12445,7 @@ code = '''
|
||||
|
||||
// remove with a wide tag
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, RMWIDEUATTR, 0, NULL))) => 0;
|
||||
LFSR_ATTR(j, RM(WIDE(UATTR)), 0, NULL))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
lfsr_rbyd_fetch(&lfs, &rbyd, rbyd.block, CFG->block_size) => 0;
|
||||
@@ -12478,10 +12479,10 @@ code = '''
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
if (k == j) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => LFS_ERR_NOENT;
|
||||
} else {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
assert(tag_ == LFSR_TAG_UATTR((k + SHIFT) & 0x7f));
|
||||
assert(lfsr_data_size(&data_) == 4);
|
||||
@@ -12583,7 +12584,7 @@ code = '''
|
||||
|
||||
// replace with bitwise inverse
|
||||
lfsr_rbyd_commit(&lfs, &rbyd, LFSR_ATTRS(
|
||||
LFSR_ATTR(j, WIDEUATTR(~(j + SHIFT) & 0x7f), 0,
|
||||
LFSR_ATTR(j, WIDE(UATTR(~(j + SHIFT) & 0x7f)), 0,
|
||||
BUF(names[j % 6], 6)))) => 0;
|
||||
|
||||
// try traversing over the tags
|
||||
@@ -12612,7 +12613,7 @@ code = '''
|
||||
|
||||
// also test that we can lookup each tag with a wide lookup
|
||||
for (unsigned k = 0; k < N; k++) {
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDEUATTR,
|
||||
lfsr_rbyd_lookup(&lfs, &rbyd, k, LFSR_TAG_WIDE(UATTR),
|
||||
&tag_, &data_) => 0;
|
||||
if (k == j) {
|
||||
assert(tag_ == LFSR_TAG_UATTR(~(k + SHIFT) & 0x7f));
|
||||
|
||||
Reference in New Issue
Block a user