Renamed a couple directory related things
- dstart -> bookmark - *dnamelookup -> *namelookup
This commit is contained in:
@@ -594,7 +594,7 @@ enum lfsr_tag_type {
|
|||||||
LFSR_TAG_NAME = 0x0200,
|
LFSR_TAG_NAME = 0x0200,
|
||||||
LFSR_TAG_WIDENAME = 0x4200, // in-device only
|
LFSR_TAG_WIDENAME = 0x4200, // in-device only
|
||||||
LFSR_TAG_BRANCH = 0x0200,
|
LFSR_TAG_BRANCH = 0x0200,
|
||||||
LFSR_TAG_DSTART = 0x0201,
|
LFSR_TAG_BOOKMARK = 0x0201,
|
||||||
LFSR_TAG_REG = 0x0202,
|
LFSR_TAG_REG = 0x0202,
|
||||||
LFSR_TAG_GROWREG = 0x2202, // test only? TODO
|
LFSR_TAG_GROWREG = 0x2202, // test only? TODO
|
||||||
LFSR_TAG_DIR = 0x0203,
|
LFSR_TAG_DIR = 0x0203,
|
||||||
@@ -1043,7 +1043,7 @@ typedef union lfsr_data {
|
|||||||
.buffer=(const void*)(_buffer), \
|
.buffer=(const void*)(_buffer), \
|
||||||
.did=-1}})
|
.did=-1}})
|
||||||
|
|
||||||
#define LFSR_DATA_DNAME(_did, _buffer, _size) \
|
#define LFSR_DATA_NAME(_did, _buffer, _size) \
|
||||||
((lfsr_data_t){.buf={ \
|
((lfsr_data_t){.buf={ \
|
||||||
/* note this find the effective leb128 size */ \
|
/* note this find the effective leb128 size */ \
|
||||||
.size=_size + (lfs_nlog2((_did)+1)+7-1)/7, \
|
.size=_size + (lfs_nlog2((_did)+1)+7-1)/7, \
|
||||||
@@ -1158,7 +1158,7 @@ static lfs_scmp_t lfsr_data_cmp(lfs_t *lfs, lfsr_data_t data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static lfs_scmp_t lfsr_data_dnamecmp(lfs_t *lfs, lfsr_data_t data,
|
static lfs_scmp_t lfsr_data_namecmp(lfs_t *lfs, lfsr_data_t data,
|
||||||
lfs_off_t off, lfs_size_t did, const char *name, lfs_size_t name_size) {
|
lfs_off_t off, lfs_size_t did, const char *name, lfs_size_t name_size) {
|
||||||
// first compare the did
|
// first compare the did
|
||||||
lfs_size_t did_;
|
lfs_size_t did_;
|
||||||
@@ -1283,11 +1283,11 @@ typedef struct lfsr_attr {
|
|||||||
#define LFSR_ATTR_GRM(_new_id, _type, _delta, _grm) \
|
#define LFSR_ATTR_GRM(_new_id, _type, _delta, _grm) \
|
||||||
LFSR_ATTR_GRM_(_new_id, LFSR_TAG_##_type, _delta, _grm)
|
LFSR_ATTR_GRM_(_new_id, LFSR_TAG_##_type, _delta, _grm)
|
||||||
|
|
||||||
#define LFSR_ATTR_DNAME_(_id, _tag, _delta, _did, _buffer, _size) \
|
#define LFSR_ATTR_NAME_(_id, _tag, _delta, _did, _buffer, _size) \
|
||||||
LFSR_ATTR_DATA_(_id, _tag, _delta, LFSR_DATA_DNAME(_did, _buffer, _size))
|
LFSR_ATTR_DATA_(_id, _tag, _delta, LFSR_DATA_NAME(_did, _buffer, _size))
|
||||||
|
|
||||||
#define LFSR_ATTR_DNAME(_id, _type, _delta, _did, _buffer, _size) \
|
#define LFSR_ATTR_NAME(_id, _type, _delta, _did, _buffer, _size) \
|
||||||
LFSR_ATTR_DNAME_(_id, LFSR_TAG_##_type, _delta, _did, _buffer, _size)
|
LFSR_ATTR_NAME_(_id, LFSR_TAG_##_type, _delta, _did, _buffer, _size)
|
||||||
|
|
||||||
#define LFSR_ATTR_LEB128_(_id, _tag, _delta, _did) \
|
#define LFSR_ATTR_LEB128_(_id, _tag, _delta, _did) \
|
||||||
LFSR_ATTR_DATA_(_id, _tag, _delta, LFSR_DATA_LEB128(_did))
|
LFSR_ATTR_DATA_(_id, _tag, _delta, LFSR_DATA_LEB128(_did))
|
||||||
@@ -1538,7 +1538,7 @@ static inline int lfsr_mid_cmp(lfsr_mid_t a, lfsr_mid_t b) {
|
|||||||
return a_u.w - b_u.w;
|
return a_u.w - b_u.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we use the root's dstart at 0.0 to represent root
|
// we use the root's bookmark at 0.0 to represent root
|
||||||
static inline bool lfsr_mid_isroot(lfsr_mid_t mid) {
|
static inline bool lfsr_mid_isroot(lfsr_mid_t mid) {
|
||||||
return lfsr_mid_cmp(mid, LFSR_MID(0, 0)) == 0;
|
return lfsr_mid_cmp(mid, LFSR_MID(0, 0)) == 0;
|
||||||
}
|
}
|
||||||
@@ -3388,13 +3388,13 @@ static int lfsr_rbyd_isdegenerate(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// some low-level dname things
|
// some low-level name things
|
||||||
//
|
//
|
||||||
// dnames in littlefs are tuples of directory-ids + ascii/utf8 strings
|
// names in littlefs are tuples of directory-ids + ascii/utf8 strings
|
||||||
|
|
||||||
// binary search an rbyd for a name, leaving the id_/weight_ with the best
|
// binary search an rbyd for a name, leaving the id_/weight_ with the best
|
||||||
// matching name if not found
|
// matching name if not found
|
||||||
static int lfsr_rbyd_dnamelookup(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
|
static int lfsr_rbyd_namelookup(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
|
||||||
lfs_size_t did, const char *name, lfs_size_t name_size,
|
lfs_size_t did, const char *name, lfs_size_t name_size,
|
||||||
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
||||||
lfsr_data_t *data_) {
|
lfsr_data_t *data_) {
|
||||||
@@ -3438,7 +3438,7 @@ static int lfsr_rbyd_dnamelookup(lfs_t *lfs, const lfsr_rbyd_t *rbyd,
|
|||||||
|
|
||||||
// compare names
|
// compare names
|
||||||
} else {
|
} else {
|
||||||
cmp = lfsr_data_dnamecmp(lfs, data__, 0, did, name, name_size);
|
cmp = lfsr_data_namecmp(lfs, data__, 0, did, name, name_size);
|
||||||
if (cmp < 0) {
|
if (cmp < 0) {
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
@@ -4733,8 +4733,8 @@ static int lfsr_btree_split(lfs_t *lfs, lfsr_btree_t *btree,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup in a btree by dname
|
// lookup in a btree by name
|
||||||
static int lfsr_btree_dnamelookup(lfs_t *lfs, const lfsr_btree_t *btree,
|
static int lfsr_btree_namelookup(lfs_t *lfs, const lfsr_btree_t *btree,
|
||||||
lfs_size_t did, const char *name, lfs_size_t name_size,
|
lfs_size_t did, const char *name, lfs_size_t name_size,
|
||||||
lfs_size_t *bid_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
lfs_size_t *bid_, lfsr_tag_t *tag_, lfs_size_t *weight_,
|
||||||
lfsr_data_t *data_) {
|
lfsr_data_t *data_) {
|
||||||
@@ -4768,7 +4768,7 @@ static int lfsr_btree_dnamelookup(lfs_t *lfs, const lfsr_btree_t *btree,
|
|||||||
// lookup our name in the rbyd via binary search
|
// lookup our name in the rbyd via binary search
|
||||||
lfs_ssize_t rid__;
|
lfs_ssize_t rid__;
|
||||||
lfs_size_t weight__;
|
lfs_size_t weight__;
|
||||||
int err = lfsr_rbyd_dnamelookup(lfs, &branch, did, name, name_size,
|
int err = lfsr_rbyd_namelookup(lfs, &branch, did, name, name_size,
|
||||||
&rid__, NULL, &weight__, NULL);
|
&rid__, NULL, &weight__, NULL);
|
||||||
if (err && err != LFS_ERR_NOENT) {
|
if (err && err != LFS_ERR_NOENT) {
|
||||||
return err;
|
return err;
|
||||||
@@ -6104,15 +6104,15 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// lookup dnames in our mtree
|
// lookup names in our mtree
|
||||||
static int lfsr_mdir_dnamelookup(lfs_t *lfs, const lfsr_mdir_t *mdir,
|
static int lfsr_mdir_namelookup(lfs_t *lfs, const lfsr_mdir_t *mdir,
|
||||||
lfs_size_t did, const char *name, lfs_size_t name_size,
|
lfs_size_t did, const char *name, lfs_size_t name_size,
|
||||||
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfsr_data_t *data_) {
|
lfs_ssize_t *id_, lfsr_tag_t *tag_, lfsr_data_t *data_) {
|
||||||
int err = lfsr_rbyd_dnamelookup(lfs, &mdir->u.r.rbyd,
|
int err = lfsr_rbyd_namelookup(lfs, &mdir->u.r.rbyd,
|
||||||
did, name, name_size,
|
did, name, name_size,
|
||||||
id_, tag_, NULL, data_);
|
id_, tag_, NULL, data_);
|
||||||
|
|
||||||
// When not found, lfsr_rbyd_dnamelookup returns the id smaller than our
|
// When not found, lfsr_rbyd_namelookup returns the id smaller than our
|
||||||
// expected name. This is correct for btree lookups, but not correct for
|
// expected name. This is correct for btree lookups, but not correct for
|
||||||
// mdir insertions. For mdirs we need to adjust this by 1 so we insert
|
// mdir insertions. For mdirs we need to adjust this by 1 so we insert
|
||||||
// _after_ the smaller id.
|
// _after_ the smaller id.
|
||||||
@@ -6124,7 +6124,7 @@ static int lfsr_mdir_dnamelookup(lfs_t *lfs, const lfsr_mdir_t *mdir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// note if we fail, we at least leave mdir_/rid_ with the best place to insert
|
// note if we fail, we at least leave mdir_/rid_ with the best place to insert
|
||||||
static int lfsr_mtree_dnamelookup(lfs_t *lfs,
|
static int lfsr_mtree_namelookup(lfs_t *lfs,
|
||||||
lfs_size_t did, const char *name, lfs_size_t name_size,
|
lfs_size_t did, const char *name, lfs_size_t name_size,
|
||||||
lfsr_mdir_t *mdir_, lfsr_tag_t *tag_, lfsr_data_t *data_) {
|
lfsr_mdir_t *mdir_, lfsr_tag_t *tag_, lfsr_data_t *data_) {
|
||||||
// do we only have mroot?
|
// do we only have mroot?
|
||||||
@@ -6132,12 +6132,12 @@ static int lfsr_mtree_dnamelookup(lfs_t *lfs,
|
|||||||
if (lfsr_mtree_isinlined(lfs)) {
|
if (lfsr_mtree_isinlined(lfs)) {
|
||||||
mdir = lfs->mroot;
|
mdir = lfs->mroot;
|
||||||
|
|
||||||
// lookup dname in actual mtree
|
// lookup name in actual mtree
|
||||||
} else {
|
} else {
|
||||||
lfs_size_t bid;
|
lfs_size_t bid;
|
||||||
lfsr_tag_t tag;
|
lfsr_tag_t tag;
|
||||||
lfsr_data_t data;
|
lfsr_data_t data;
|
||||||
int err = lfsr_btree_dnamelookup(lfs, &lfs->mtree,
|
int err = lfsr_btree_namelookup(lfs, &lfs->mtree,
|
||||||
did, name, name_size,
|
did, name, name_size,
|
||||||
&bid, &tag, NULL, &data);
|
&bid, &tag, NULL, &data);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -6158,9 +6158,9 @@ static int lfsr_mtree_dnamelookup(lfs_t *lfs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// and finally lookup dname in our mdir
|
// and finally lookup name in our mdir
|
||||||
lfs_ssize_t rid;
|
lfs_ssize_t rid;
|
||||||
int err = lfsr_mdir_dnamelookup(lfs, &mdir,
|
int err = lfsr_mdir_namelookup(lfs, &mdir,
|
||||||
did, name, name_size,
|
did, name, name_size,
|
||||||
&rid, tag_, data_);
|
&rid, tag_, data_);
|
||||||
|
|
||||||
@@ -6270,8 +6270,8 @@ static int lfsr_mtree_pathlookup(lfs_t *lfs, const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup up this dname in the mtree
|
// lookup up this name in the mtree
|
||||||
int err = lfsr_mtree_dnamelookup(lfs, did, name, name_size,
|
int err = lfsr_mtree_namelookup(lfs, did, name, name_size,
|
||||||
&mdir, &tag, NULL);
|
&mdir, &tag, NULL);
|
||||||
if (err && err != LFS_ERR_NOENT) {
|
if (err && err != LFS_ERR_NOENT) {
|
||||||
return err;
|
return err;
|
||||||
@@ -6999,11 +6999,11 @@ static int lfsr_formatinited(lfs_t *lfs) {
|
|||||||
// our initial superblock contains a couple things:
|
// our initial superblock contains a couple things:
|
||||||
// - our magic string, "littlefs"
|
// - our magic string, "littlefs"
|
||||||
// - the superconfig, format-time configuration
|
// - the superconfig, format-time configuration
|
||||||
// - the root's dstart tag, which reserves did = 0 for the root
|
// - the root's bookmark tag, which reserves did = 0 for the root
|
||||||
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
|
err = lfsr_rbyd_commit(lfs, &rbyd, LFSR_ATTRS(
|
||||||
LFSR_ATTR(-1, SUPERMAGIC, 0, "littlefs", 8),
|
LFSR_ATTR(-1, SUPERMAGIC, 0, "littlefs", 8),
|
||||||
LFSR_ATTR(-1, SUPERCONFIG, 0, buf, d),
|
LFSR_ATTR(-1, SUPERCONFIG, 0, buf, d),
|
||||||
LFSR_ATTR_DNAME(0, DSTART, +1, 0, NULL, 0)));
|
LFSR_ATTR_NAME(0, BOOKMARK, +1, 0, NULL, 0)));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -7219,7 +7219,7 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) {
|
|||||||
// but we can use a heuristic based on the maximum possible number of
|
// but we can use a heuristic based on the maximum possible number of
|
||||||
// directories in the current mtree assuming our block size.
|
// directories in the current mtree assuming our block size.
|
||||||
//
|
//
|
||||||
// - Each directory needs 1 name tag, 1 did tag, and 1 dstart
|
// - Each directory needs 1 name tag, 1 did tag, and 1 bookmark
|
||||||
// - Each tag needs ~2 alts+null with our current compaction strategy
|
// - Each tag needs ~2 alts+null with our current compaction strategy
|
||||||
// - Each tag/alt encodes to a minimum of 4 bytes
|
// - Each tag/alt encodes to a minimum of 4 bytes
|
||||||
// - We can also assume ~1/2 block utilization due to our split threshold
|
// - We can also assume ~1/2 block utilization due to our split threshold
|
||||||
@@ -7244,7 +7244,7 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) {
|
|||||||
// available did
|
// available did
|
||||||
lfsr_mdir_t mdir;
|
lfsr_mdir_t mdir;
|
||||||
while (true) {
|
while (true) {
|
||||||
int err = lfsr_mtree_dnamelookup(lfs, did, NULL, 0,
|
int err = lfsr_mtree_namelookup(lfs, did, NULL, 0,
|
||||||
&mdir, NULL, NULL);
|
&mdir, NULL, NULL);
|
||||||
if (err && err != LFS_ERR_NOENT) {
|
if (err && err != LFS_ERR_NOENT) {
|
||||||
return err;
|
return err;
|
||||||
@@ -7266,14 +7266,14 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) {
|
|||||||
parent.mdir.mid.rid -= 1;
|
parent.mdir.mid.rid -= 1;
|
||||||
lfsr_mdir_addopened(lfs, LFS_TYPE_REG, &parent);
|
lfsr_mdir_addopened(lfs, LFS_TYPE_REG, &parent);
|
||||||
|
|
||||||
// Conveniently, we just found where our dstart should go. The dstart
|
// Conveniently, we just found where our bookmark should go. The bookmark
|
||||||
// tag is an empty entry that marks our directory as being allocated.
|
// tag is an empty entry that marks our directory as being allocated.
|
||||||
//
|
//
|
||||||
// We include a GRM here so the dstart is automatically removed if we
|
// We include a GRM here so the bookmark is automatically removed if we
|
||||||
// lose power before writing the entry in our parent
|
// lose power before writing the entry in our parent
|
||||||
//
|
//
|
||||||
err = lfsr_mdir_commit(lfs, &mdir, LFSR_ATTRS(
|
err = lfsr_mdir_commit(lfs, &mdir, LFSR_ATTRS(
|
||||||
LFSR_ATTR_DNAME(mdir.mid.rid, DSTART, +1, did, NULL, 0),
|
LFSR_ATTR_NAME(mdir.mid.rid, BOOKMARK, +1, did, NULL, 0),
|
||||||
LFSR_ATTR_GRM(-1, GRM, 0, &((lfsr_grm_t){{
|
LFSR_ATTR_GRM(-1, GRM, 0, &((lfsr_grm_t){{
|
||||||
mdir.mid,
|
mdir.mid,
|
||||||
LFSR_MID(-1, -1)}}))));
|
LFSR_MID(-1, -1)}}))));
|
||||||
@@ -7287,7 +7287,7 @@ int lfsr_mkdir(lfs_t *lfs, const char *path) {
|
|||||||
// commit our new directory into our parent, zeroing out our grm
|
// commit our new directory into our parent, zeroing out our grm
|
||||||
// in the process
|
// in the process
|
||||||
err = lfsr_mdir_commit(lfs, &parent.mdir, LFSR_ATTRS(
|
err = lfsr_mdir_commit(lfs, &parent.mdir, LFSR_ATTRS(
|
||||||
LFSR_ATTR_DNAME(parent.mdir.mid.rid, DIR, +1,
|
LFSR_ATTR_NAME(parent.mdir.mid.rid, DIR, +1,
|
||||||
parent_did, name, name_size),
|
parent_did, name, name_size),
|
||||||
LFSR_ATTR_LEB128(parent.mdir.mid.rid, DID, 0, did),
|
LFSR_ATTR_LEB128(parent.mdir.mid.rid, DID, 0, did),
|
||||||
LFSR_ATTR_GRM(-1, GRM, 0, &((lfsr_grm_t){{
|
LFSR_ATTR_GRM(-1, GRM, 0, &((lfsr_grm_t){{
|
||||||
@@ -7322,7 +7322,7 @@ int lfsr_remove(lfs_t *lfs, const char *path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we're removing a directory, we need to also remove the
|
// if we're removing a directory, we need to also remove the
|
||||||
// dstart entry
|
// bookmark entry
|
||||||
lfsr_grm_t grm = lfs->grm;
|
lfsr_grm_t grm = lfs->grm;
|
||||||
if (tag == LFSR_TAG_DIR) {
|
if (tag == LFSR_TAG_DIR) {
|
||||||
// first lets figure out the did
|
// first lets figure out the did
|
||||||
@@ -7339,16 +7339,16 @@ int lfsr_remove(lfs_t *lfs, const char *path) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// then lookup the dstart entry
|
// then lookup the bookmark entry
|
||||||
lfsr_mdir_t mdir_;
|
lfsr_mdir_t mdir_;
|
||||||
err = lfsr_mtree_dnamelookup(lfs, did, NULL, 0,
|
err = lfsr_mtree_namelookup(lfs, did, NULL, 0,
|
||||||
&mdir_, NULL, NULL);
|
&mdir_, NULL, NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a grm to remove the dstart entry
|
// create a grm to remove the bookmark entry
|
||||||
lfsr_grm_pushrm(&grm, mdir_.mid);
|
lfsr_grm_pushrm(&grm, mdir_.mid);
|
||||||
|
|
||||||
// check that the directory is empty
|
// check that the directory is empty
|
||||||
@@ -7366,7 +7366,7 @@ int lfsr_remove(lfs_t *lfs, const char *path) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_ != LFSR_TAG_DSTART) {
|
if (tag_ != LFSR_TAG_BOOKMARK) {
|
||||||
return LFS_ERR_NOTEMPTY;
|
return LFS_ERR_NOTEMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7471,16 +7471,16 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// then lookup the dstart entry
|
// then lookup the bookmark entry
|
||||||
lfsr_mdir_t mdir_;
|
lfsr_mdir_t mdir_;
|
||||||
err = lfsr_mtree_dnamelookup(lfs, did, NULL, 0,
|
err = lfsr_mtree_namelookup(lfs, did, NULL, 0,
|
||||||
&mdir_, NULL, NULL);
|
&mdir_, NULL, NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a grm to remove the dstart entry
|
// create a grm to remove the bookmark entry
|
||||||
lfsr_grm_pushrm(&grm, mdir_.mid);
|
lfsr_grm_pushrm(&grm, mdir_.mid);
|
||||||
|
|
||||||
// check that the directory is empty
|
// check that the directory is empty
|
||||||
@@ -7498,7 +7498,7 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag_ != LFSR_TAG_DSTART) {
|
if (tag_ != LFSR_TAG_BOOKMARK) {
|
||||||
return LFS_ERR_NOTEMPTY;
|
return LFS_ERR_NOTEMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7511,7 +7511,7 @@ int lfsr_rename(lfs_t *lfs, const char *old_path, const char *new_path) {
|
|||||||
(exists
|
(exists
|
||||||
? LFSR_ATTR(new_mdir.mid.rid, UNR, -1, NULL, 0)
|
? LFSR_ATTR(new_mdir.mid.rid, UNR, -1, NULL, 0)
|
||||||
: LFSR_ATTR_NOOP),
|
: LFSR_ATTR_NOOP),
|
||||||
LFSR_ATTR_DNAME_(new_mdir.mid.rid, old_tag, +1,
|
LFSR_ATTR_NAME_(new_mdir.mid.rid, old_tag, +1,
|
||||||
new_did, new_name, new_name_size),
|
new_did, new_name, new_name_size),
|
||||||
LFSR_ATTR_MOVE(new_mdir.mid.rid, MOVE, 0, &old_mdir),
|
LFSR_ATTR_MOVE(new_mdir.mid.rid, MOVE, 0, &old_mdir),
|
||||||
LFSR_ATTR_GRM(-1, GRM, 0, &grm)));
|
LFSR_ATTR_GRM(-1, GRM, 0, &grm)));
|
||||||
@@ -7588,9 +7588,9 @@ int lfsr_dir_open(lfs_t *lfs, lfsr_dir_t *dir, const char *path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookup our dstart in the mtree
|
// lookup our bookmark in the mtree
|
||||||
err = lfsr_mtree_dnamelookup(lfs, dir->did, NULL, 0,
|
err = lfsr_mtree_namelookup(lfs, dir->did, NULL, 0,
|
||||||
&dir->dstart_mdir, NULL, NULL);
|
&dir->bookmark_mdir, NULL, NULL);
|
||||||
if (err) {
|
if (err) {
|
||||||
LFS_ASSERT(err != LFS_ERR_NOENT);
|
LFS_ASSERT(err != LFS_ERR_NOENT);
|
||||||
return err;
|
return err;
|
||||||
@@ -7709,17 +7709,17 @@ lfs_soff_t lfsr_dir_tell(lfs_t *lfs, lfsr_dir_t *dir) {
|
|||||||
|
|
||||||
int lfsr_dir_rewind(lfs_t *lfs, lfsr_dir_t *dir) {
|
int lfsr_dir_rewind(lfs_t *lfs, lfsr_dir_t *dir) {
|
||||||
// do nothing if removed
|
// do nothing if removed
|
||||||
if (lfsr_mdir_isdropped(&dir->dstart_mdir)) {
|
if (lfsr_mdir_isdropped(&dir->bookmark_mdir)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset pos
|
// reset pos
|
||||||
dir->pos = 0;
|
dir->pos = 0;
|
||||||
|
|
||||||
// copy dstart mdir and eagerly look up the next entry
|
// copy bookmark mdir and eagerly look up the next entry
|
||||||
//
|
//
|
||||||
// this makes handling of corner cases with mixed removes/dir reads easier
|
// this makes handling of corner cases with mixed removes/dir reads easier
|
||||||
dir->pos_mdir = dir->dstart_mdir;
|
dir->pos_mdir = dir->bookmark_mdir;
|
||||||
int err = lfsr_mtree_seek(lfs, &dir->pos_mdir, 1);
|
int err = lfsr_mtree_seek(lfs, &dir->pos_mdir, 1);
|
||||||
if (err && err != LFS_ERR_NOENT) {
|
if (err && err != LFS_ERR_NOENT) {
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ typedef struct lfsr_dir {
|
|||||||
// - lfsr_openedmdir_t
|
// - lfsr_openedmdir_t
|
||||||
// - lfsr_mdir_t[2]
|
// - lfsr_mdir_t[2]
|
||||||
struct lfsr_openedmdir *next;
|
struct lfsr_openedmdir *next;
|
||||||
lfsr_mdir_t dstart_mdir;
|
lfsr_mdir_t bookmark_mdir;
|
||||||
lfsr_mdir_t pos_mdir;
|
lfsr_mdir_t pos_mdir;
|
||||||
lfs_size_t did;
|
lfs_size_t did;
|
||||||
lfs_off_t pos;
|
lfs_off_t pos;
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ TAG_GSTATE = 0x0100
|
|||||||
TAG_GRM = 0x0100
|
TAG_GRM = 0x0100
|
||||||
TAG_NAME = 0x0200
|
TAG_NAME = 0x0200
|
||||||
TAG_BRANCH = 0x0200
|
TAG_BRANCH = 0x0200
|
||||||
TAG_DSTART = 0x0201
|
TAG_BOOKMARK = 0x0201
|
||||||
TAG_REG = 0x0202
|
TAG_REG = 0x0202
|
||||||
TAG_DIR = 0x0203
|
TAG_DIR = 0x0203
|
||||||
TAG_STRUCT = 0x0300
|
TAG_STRUCT = 0x0300
|
||||||
@@ -139,7 +139,7 @@ def tagrepr(tag, w, size, off=None):
|
|||||||
elif (tag & 0xff00) == TAG_NAME:
|
elif (tag & 0xff00) == TAG_NAME:
|
||||||
return '%s%s %d' % (
|
return '%s%s %d' % (
|
||||||
'branch' if tag == TAG_BRANCH
|
'branch' if tag == TAG_BRANCH
|
||||||
else 'dstart' if tag == TAG_DSTART
|
else 'bookmark' if tag == TAG_BOOKMARK
|
||||||
else 'reg' if tag == TAG_REG
|
else 'reg' if tag == TAG_REG
|
||||||
else 'dir' if tag == TAG_DIR
|
else 'dir' if tag == TAG_DIR
|
||||||
else 'name 0x%02x' % (tag & 0xff),
|
else 'name 0x%02x' % (tag & 0xff),
|
||||||
|
|||||||
+32
-30
@@ -16,7 +16,7 @@ TAG_GSTATE = 0x0100
|
|||||||
TAG_GRM = 0x0100
|
TAG_GRM = 0x0100
|
||||||
TAG_NAME = 0x0200
|
TAG_NAME = 0x0200
|
||||||
TAG_BRANCH = 0x0200
|
TAG_BRANCH = 0x0200
|
||||||
TAG_DSTART = 0x0201
|
TAG_BOOKMARK = 0x0201
|
||||||
TAG_REG = 0x0202
|
TAG_REG = 0x0202
|
||||||
TAG_DIR = 0x0203
|
TAG_DIR = 0x0203
|
||||||
TAG_STRUCT = 0x0300
|
TAG_STRUCT = 0x0300
|
||||||
@@ -148,7 +148,7 @@ def tagrepr(tag, w, size, off=None):
|
|||||||
elif (tag & 0xff00) == TAG_NAME:
|
elif (tag & 0xff00) == TAG_NAME:
|
||||||
return '%s%s %d' % (
|
return '%s%s %d' % (
|
||||||
'branch' if tag == TAG_BRANCH
|
'branch' if tag == TAG_BRANCH
|
||||||
else 'dstart' if tag == TAG_DSTART
|
else 'bookmark' if tag == TAG_BOOKMARK
|
||||||
else 'reg' if tag == TAG_REG
|
else 'reg' if tag == TAG_REG
|
||||||
else 'dir' if tag == TAG_DIR
|
else 'dir' if tag == TAG_DIR
|
||||||
else 'name 0x%02x' % (tag & 0xff),
|
else 'name 0x%02x' % (tag & 0xff),
|
||||||
@@ -591,10 +591,10 @@ class Rbyd:
|
|||||||
|
|
||||||
# iterate through a directory assuming this is the mtree root
|
# iterate through a directory assuming this is the mtree root
|
||||||
def mtree_dir(self, f, block_size, did):
|
def mtree_dir(self, f, block_size, did):
|
||||||
# lookup the dstart
|
# lookup the bookmark
|
||||||
found, mid, mdir, rid, tag, w = self.mtree_namelookup(
|
found, mid, mdir, rid, tag, w = self.mtree_namelookup(
|
||||||
f, block_size, did, b'')
|
f, block_size, did, b'')
|
||||||
# iterate through all files until the next dstart
|
# iterate through all files until the next bookmark
|
||||||
while found:
|
while found:
|
||||||
# lookup each rid
|
# lookup each rid
|
||||||
done, rid, tag, w, j, d, data, _ = mdir.lookup(rid, TAG_NAME)
|
done, rid, tag, w, j, d, data, _ = mdir.lookup(rid, TAG_NAME)
|
||||||
@@ -708,14 +708,14 @@ def grepr(tag, data):
|
|||||||
return 'gstate 0x%02x %d' % (tag, len(data))
|
return 'gstate 0x%02x %d' % (tag, len(data))
|
||||||
|
|
||||||
def frepr(mdir, rid, tag):
|
def frepr(mdir, rid, tag):
|
||||||
if tag == TAG_DSTART:
|
if tag == TAG_BOOKMARK:
|
||||||
# read the did
|
# read the did
|
||||||
did = '?'
|
did = '?'
|
||||||
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, tag)
|
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(rid, tag)
|
||||||
if not done and rid_ == rid and tag_ == tag:
|
if not done and rid_ == rid and tag_ == tag:
|
||||||
did, _ = fromleb128(data)
|
did, _ = fromleb128(data)
|
||||||
did = '0x%x' % did
|
did = '0x%x' % did
|
||||||
return 'dstart %s' % did
|
return 'bookmark %s' % did
|
||||||
elif tag == TAG_DIR:
|
elif tag == TAG_DIR:
|
||||||
# read the did
|
# read the did
|
||||||
did = '?'
|
did = '?'
|
||||||
@@ -758,14 +758,14 @@ def main(disk, mroots=None, *,
|
|||||||
# - are we corrupted?
|
# - are we corrupted?
|
||||||
# - collect superconfig
|
# - collect superconfig
|
||||||
# - collect gstate
|
# - collect gstate
|
||||||
# - any missing or orphaned dstart entries
|
# - any missing or orphaned bookmark entries
|
||||||
mweight = 0
|
mweight = 0
|
||||||
rweight = 0
|
rweight = 0
|
||||||
corrupted = False
|
corrupted = False
|
||||||
gstate = GState()
|
gstate = GState()
|
||||||
config = {}
|
config = {}
|
||||||
dir_dids = [(0, b'', -1, None, -1, TAG_DID, 0)]
|
dir_dids = [(0, b'', -1, None, -1, TAG_DID, 0)]
|
||||||
dstart_dids = []
|
bookmark_dids = []
|
||||||
|
|
||||||
mroot = Rbyd.fetch(f, block_size, mroots)
|
mroot = Rbyd.fetch(f, block_size, mroots)
|
||||||
mdepth = 1
|
mdepth = 1
|
||||||
@@ -785,10 +785,12 @@ def main(disk, mroots=None, *,
|
|||||||
for rid, tag, w, j, d, data in mroot:
|
for rid, tag, w, j, d, data in mroot:
|
||||||
if tag == TAG_DID:
|
if tag == TAG_DID:
|
||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dir_dids.append((did, data[d:], -1, mroot, rid, tag, w))
|
dir_dids.append(
|
||||||
elif tag == TAG_DSTART:
|
(did, data[d:], -1, mroot, rid, tag, w))
|
||||||
|
elif tag == TAG_BOOKMARK:
|
||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dstart_dids.append((did, data[d:], -1, mroot, rid, tag, w))
|
bookmark_dids.append(
|
||||||
|
(did, data[d:], -1, mroot, rid, tag, w))
|
||||||
|
|
||||||
# fetch the next mroot
|
# fetch the next mroot
|
||||||
done, rid, tag, w, j, d, data, _ = mroot.lookup(-1, TAG_MROOT)
|
done, rid, tag, w, j, d, data, _ = mroot.lookup(-1, TAG_MROOT)
|
||||||
@@ -819,9 +821,9 @@ def main(disk, mroots=None, *,
|
|||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dir_dids.append((
|
dir_dids.append((
|
||||||
did, data[d:], 0, mdir, rid, tag, w))
|
did, data[d:], 0, mdir, rid, tag, w))
|
||||||
elif tag == TAG_DSTART:
|
elif tag == TAG_BOOKMARK:
|
||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dstart_dids.append((
|
bookmark_dids.append((
|
||||||
did, data[d:], 0, mdir, rid, tag, w))
|
did, data[d:], 0, mdir, rid, tag, w))
|
||||||
|
|
||||||
# fetch the actual mtree, if there is one
|
# fetch the actual mtree, if there is one
|
||||||
@@ -870,22 +872,22 @@ def main(disk, mroots=None, *,
|
|||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dir_dids.append((
|
dir_dids.append((
|
||||||
did, data[d:], mid, mdir_, rid, tag, w))
|
did, data[d:], mid, mdir_, rid, tag, w))
|
||||||
elif tag == TAG_DSTART:
|
elif tag == TAG_BOOKMARK:
|
||||||
did, d = fromleb128(data)
|
did, d = fromleb128(data)
|
||||||
dstart_dids.append((
|
bookmark_dids.append((
|
||||||
did, data[d:], mid, mdir_, rid, tag, w))
|
did, data[d:], mid, mdir_, rid, tag, w))
|
||||||
|
|
||||||
# remove grms from our found dids, we treat these as already deleted
|
# remove grms from our found dids, we treat these as already deleted
|
||||||
grmed_dir_dids = {did_
|
grmed_dir_dids = {did_
|
||||||
for (did_, name_, mid_, mdir_, rid_, tag_, w_) in dir_dids
|
for (did_, name_, mid_, mdir_, rid_, tag_, w_) in dir_dids
|
||||||
if (max(mid_, 0), rid_) not in gstate.grm}
|
if (max(mid_, 0), rid_) not in gstate.grm}
|
||||||
grmed_dstart_dids = {did_
|
grmed_bookmark_dids = {did_
|
||||||
for (did_, name_, mid_, mdir_, rid_, tag_, w_) in dstart_dids
|
for (did_, name_, mid_, mdir_, rid_, tag_, w_) in bookmark_dids
|
||||||
if (max(mid_, 0), rid_) not in gstate.grm}
|
if (max(mid_, 0), rid_) not in gstate.grm}
|
||||||
|
|
||||||
# treat the filesystem as corrupted if our dirs and dstarts are
|
# treat the filesystem as corrupted if our dirs and bookmarks are
|
||||||
# mismatched, this should never happen unless there's a bug
|
# mismatched, this should never happen unless there's a bug
|
||||||
if grmed_dir_dids != grmed_dstart_dids:
|
if grmed_dir_dids != grmed_bookmark_dids:
|
||||||
corrupted = True
|
corrupted = True
|
||||||
|
|
||||||
# are we going to end up rendering the dtree?
|
# are we going to end up rendering the dtree?
|
||||||
@@ -1066,18 +1068,18 @@ def main(disk, mroots=None, *,
|
|||||||
for name, mid, mdir, rid, tag, w in mroot.mtree_dir(
|
for name, mid, mdir, rid, tag, w in mroot.mtree_dir(
|
||||||
f, block_size, did):
|
f, block_size, did):
|
||||||
if not args.get('all'):
|
if not args.get('all'):
|
||||||
# skip dstarts
|
# skip bookmarks
|
||||||
if tag == TAG_DSTART:
|
if tag == TAG_BOOKMARK:
|
||||||
continue
|
continue
|
||||||
# skip grmed entries
|
# skip grmed entries
|
||||||
if (max(mid, 0), rid) in gstate.grm:
|
if (max(mid, 0), rid) in gstate.grm:
|
||||||
continue
|
continue
|
||||||
dir.append((name, mid, mdir, rid, tag, w))
|
dir.append((name, mid, mdir, rid, tag, w))
|
||||||
|
|
||||||
# if we're root, append any orphaned dstart entries so they
|
# if we're root, append any orphaned bookmark entries so they
|
||||||
# get reported
|
# get reported
|
||||||
if did == 0:
|
if did == 0:
|
||||||
for did, name, mid, mdir, rid, tag, w in dstart_dids:
|
for did, name, mid, mdir, rid, tag, w in bookmark_dids:
|
||||||
if did in grmed_dir_dids:
|
if did in grmed_dir_dids:
|
||||||
continue
|
continue
|
||||||
# skip grmed entries
|
# skip grmed entries
|
||||||
@@ -1093,16 +1095,16 @@ def main(disk, mroots=None, *,
|
|||||||
# grmed?
|
# grmed?
|
||||||
if grmed:
|
if grmed:
|
||||||
notes.append('grmed')
|
notes.append('grmed')
|
||||||
# missing dstart?
|
# missing bookmark?
|
||||||
if tag == TAG_DIR:
|
if tag == TAG_DIR:
|
||||||
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(
|
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(
|
||||||
rid, TAG_DID)
|
rid, TAG_DID)
|
||||||
if not done and rid_ == rid and tag_ == TAG_DID:
|
if not done and rid_ == rid and tag_ == TAG_DID:
|
||||||
did_, _ = fromleb128(data)
|
did_, _ = fromleb128(data)
|
||||||
if did_ not in grmed_dstart_dids:
|
if did_ not in grmed_bookmark_dids:
|
||||||
notes.append('missing dstart')
|
notes.append('missing bookmark')
|
||||||
# orphaned?
|
# orphaned?
|
||||||
if tag == TAG_DSTART:
|
if tag == TAG_BOOKMARK:
|
||||||
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(
|
done, rid_, tag_, w_, j, d, data, _ = mdir.lookup(
|
||||||
rid, tag)
|
rid, tag)
|
||||||
if not done and rid_ == rid and tag_ == tag:
|
if not done and rid_ == rid and tag_ == tag:
|
||||||
@@ -1112,7 +1114,7 @@ def main(disk, mroots=None, *,
|
|||||||
|
|
||||||
# print human readable dtree entry
|
# print human readable dtree entry
|
||||||
print('%s%12s %*s %-*s %s%s%s' % (
|
print('%s%12s %*s %-*s %s%s%s' % (
|
||||||
'\x1b[90m' if color and (grmed or tag == TAG_DSTART)
|
'\x1b[90m' if color and (grmed or tag == TAG_BOOKMARK)
|
||||||
else '',
|
else '',
|
||||||
'{%s}:' % ','.join('%04x' % block
|
'{%s}:' % ','.join('%04x' % block
|
||||||
for block in it.chain([mdir.block],
|
for block in it.chain([mdir.block],
|
||||||
@@ -1130,7 +1132,7 @@ def main(disk, mroots=None, *,
|
|||||||
', '.join(notes),
|
', '.join(notes),
|
||||||
'\x1b[m' if color and not grmed else '')
|
'\x1b[m' if color and not grmed else '')
|
||||||
if notes else '',
|
if notes else '',
|
||||||
'\x1b[m' if color and (grmed or tag == TAG_DSTART)
|
'\x1b[m' if color and (grmed or tag == TAG_BOOKMARK)
|
||||||
else ''))
|
else ''))
|
||||||
pmid = mid
|
pmid = mid
|
||||||
|
|
||||||
@@ -1248,7 +1250,7 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-a', '--all',
|
'-a', '--all',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Show all files including dstarts and grmed files.")
|
help="Show all files including bookmarks and grmed files.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-r', '--raw',
|
'-r', '--raw',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@ TAG_GSTATE = 0x0100
|
|||||||
TAG_GRM = 0x0100
|
TAG_GRM = 0x0100
|
||||||
TAG_NAME = 0x0200
|
TAG_NAME = 0x0200
|
||||||
TAG_BRANCH = 0x0200
|
TAG_BRANCH = 0x0200
|
||||||
TAG_DSTART = 0x0201
|
TAG_BOOKMARK = 0x0201
|
||||||
TAG_REG = 0x0202
|
TAG_REG = 0x0202
|
||||||
TAG_DIR = 0x0203
|
TAG_DIR = 0x0203
|
||||||
TAG_STRUCT = 0x0300
|
TAG_STRUCT = 0x0300
|
||||||
@@ -147,7 +147,7 @@ def tagrepr(tag, w, size, off=None):
|
|||||||
elif (tag & 0xff00) == TAG_NAME:
|
elif (tag & 0xff00) == TAG_NAME:
|
||||||
return '%s%s %d' % (
|
return '%s%s %d' % (
|
||||||
'branch' if tag == TAG_BRANCH
|
'branch' if tag == TAG_BRANCH
|
||||||
else 'dstart' if tag == TAG_DSTART
|
else 'bookmark' if tag == TAG_BOOKMARK
|
||||||
else 'reg' if tag == TAG_REG
|
else 'reg' if tag == TAG_REG
|
||||||
else 'dir' if tag == TAG_DIR
|
else 'dir' if tag == TAG_DIR
|
||||||
else 'name 0x%02x' % (tag & 0xff),
|
else 'name 0x%02x' % (tag & 0xff),
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ TAG_GSTATE = 0x0100
|
|||||||
TAG_GRM = 0x0100
|
TAG_GRM = 0x0100
|
||||||
TAG_NAME = 0x0200
|
TAG_NAME = 0x0200
|
||||||
TAG_BRANCH = 0x0200
|
TAG_BRANCH = 0x0200
|
||||||
TAG_DSTART = 0x0201
|
TAG_BOOKMARK = 0x0201
|
||||||
TAG_REG = 0x0202
|
TAG_REG = 0x0202
|
||||||
TAG_DIR = 0x0203
|
TAG_DIR = 0x0203
|
||||||
TAG_STRUCT = 0x0300
|
TAG_STRUCT = 0x0300
|
||||||
@@ -141,7 +141,7 @@ def tagrepr(tag, w, size, off=None):
|
|||||||
elif (tag & 0xff00) == TAG_NAME:
|
elif (tag & 0xff00) == TAG_NAME:
|
||||||
return '%s%s %d' % (
|
return '%s%s %d' % (
|
||||||
'branch' if tag == TAG_BRANCH
|
'branch' if tag == TAG_BRANCH
|
||||||
else 'dstart' if tag == TAG_DSTART
|
else 'bookmark' if tag == TAG_BOOKMARK
|
||||||
else 'reg' if tag == TAG_REG
|
else 'reg' if tag == TAG_REG
|
||||||
else 'dir' if tag == TAG_DIR
|
else 'dir' if tag == TAG_DIR
|
||||||
else 'name 0x%02x' % (tag & 0xff),
|
else 'name 0x%02x' % (tag & 0xff),
|
||||||
|
|||||||
+35
-35
@@ -2746,7 +2746,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, "aaa", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, "aaa", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => LFS_ERR_NOENT;
|
&id_, &tag_, &weight_, &data_) => LFS_ERR_NOENT;
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@@ -2782,7 +2782,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 0);
|
assert(id_ == 0);
|
||||||
@@ -2790,7 +2790,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "0", 1) == 0);
|
assert(memcmp(buffer, "0", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 1*DID, "aab", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 1*DID, "aab", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 0);
|
assert(id_ == 0);
|
||||||
@@ -2818,7 +2818,7 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("0", 1)) => 0;
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_DNAME(0*DID, "aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_NAME(0*DID, "aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -2834,7 +2834,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, "aaa", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, "aaa", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 0);
|
assert(id_ == 0);
|
||||||
@@ -2842,7 +2842,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "0", 1) == 0);
|
assert(memcmp(buffer, "0", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, "aab", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, "aab", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 1);
|
assert(id_ == 1);
|
||||||
@@ -2850,7 +2850,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "1", 1) == 0);
|
assert(memcmp(buffer, "1", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, "aac", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, "aac", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 1);
|
assert(id_ == 1);
|
||||||
@@ -2878,10 +2878,10 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("0", 1)) => 0;
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_DNAME(1*DID, "aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_NAME(1*DID, "aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 1, LFSR_DATA_DNAME(2*DID, "aac", 3),
|
lfsr_btree_split(&lfs, &btree, 1, LFSR_DATA_NAME(2*DID, "aac", 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -2897,7 +2897,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 0);
|
assert(id_ == 0);
|
||||||
@@ -2905,7 +2905,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "0", 1) == 0);
|
assert(memcmp(buffer, "0", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 1*DID, "aab", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 1*DID, "aab", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 1);
|
assert(id_ == 1);
|
||||||
@@ -2913,7 +2913,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "1", 1) == 0);
|
assert(memcmp(buffer, "1", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 2*DID, "aac", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 2*DID, "aac", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 2);
|
assert(id_ == 2);
|
||||||
@@ -2921,7 +2921,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "2", 1) == 0);
|
assert(memcmp(buffer, "2", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 3*DID, "aad", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 3*DID, "aad", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 2);
|
assert(id_ == 2);
|
||||||
@@ -2949,10 +2949,10 @@ code = '''
|
|||||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF("0", 1)) => 0;
|
LFSR_DATA_BUF("0", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_DNAME(2*DID, "aac", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_NAME(2*DID, "aac", 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("2", 1)) => 0;
|
||||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_DNAME(1*DID, "aab", 3),
|
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_NAME(1*DID, "aab", 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("0", 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF("1", 1)) => 0;
|
||||||
printf("btree: w%d 0x%x.%x\n",
|
printf("btree: w%d 0x%x.%x\n",
|
||||||
@@ -2968,7 +2968,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0*DID, "aaa", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 0);
|
assert(id_ == 0);
|
||||||
@@ -2976,7 +2976,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "0", 1) == 0);
|
assert(memcmp(buffer, "0", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 1*DID, "aab", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 1*DID, "aab", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 1);
|
assert(id_ == 1);
|
||||||
@@ -2984,7 +2984,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "1", 1) == 0);
|
assert(memcmp(buffer, "1", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 2*DID, "aac", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 2*DID, "aac", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 2);
|
assert(id_ == 2);
|
||||||
@@ -2992,7 +2992,7 @@ code = '''
|
|||||||
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
lfsr_data_read(&lfs, data_, 0, buffer, 4) => 1;
|
||||||
assert(memcmp(buffer, "2", 1) == 0);
|
assert(memcmp(buffer, "2", 1) == 0);
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 3*DID, "aad", 3,
|
lfsr_btree_namelookup(&lfs, &btree, 3*DID, "aad", 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == 2);
|
assert(id_ == 2);
|
||||||
@@ -3029,7 +3029,7 @@ code = '''
|
|||||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||||
};
|
};
|
||||||
int err = lfsr_btree_split(&lfs, &btree, i-1,
|
int err = lfsr_btree_split(&lfs, &btree, i-1,
|
||||||
LFSR_DATA_DNAME(i*DID, name, 3),
|
LFSR_DATA_NAME(i*DID, name, 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3057,7 +3057,7 @@ code = '''
|
|||||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||||
};
|
};
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, i*DID, name, 3,
|
lfsr_btree_namelookup(&lfs, &btree, i*DID, name, 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == i);
|
assert(id_ == i);
|
||||||
@@ -3122,7 +3122,7 @@ code = '''
|
|||||||
|
|
||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree, id,
|
int err = lfsr_btree_split(&lfs, &btree, id,
|
||||||
LFSR_DATA_DNAME(0, name, 3),
|
LFSR_DATA_NAME(0, name, 3),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1));
|
LFSR_TAG_INLINED, 1, LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3163,7 +3163,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
for (lfs_size_t i = 0; i < sim_size; i++) {
|
for (lfs_size_t i = 0; i < sim_size; i++) {
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, sim_names[i], 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, sim_names[i], 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == i);
|
assert(id_ == i);
|
||||||
@@ -3207,7 +3207,7 @@ code = '''
|
|||||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||||
};
|
};
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
(i-1)*W+W-1, LFSR_DATA_DNAME(i*DID, name, 3),
|
(i-1)*W+W-1, LFSR_DATA_NAME(i*DID, name, 3),
|
||||||
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-1) % 10], 1),
|
||||||
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
LFSR_TAG_INLINED, W, LFSR_DATA_BUF(&nums[(i-0) % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3235,7 +3235,7 @@ code = '''
|
|||||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||||
};
|
};
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, i*DID, name, 3,
|
lfsr_btree_namelookup(&lfs, &btree, i*DID, name, 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == i*W+W-1);
|
assert(id_ == i*W+W-1);
|
||||||
@@ -3314,7 +3314,7 @@ code = '''
|
|||||||
// split btree
|
// split btree
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
weighted_id+sim_weights[id]-1,
|
weighted_id+sim_weights[id]-1,
|
||||||
LFSR_DATA_DNAME(0, name, 3),
|
LFSR_DATA_NAME(0, name, 3),
|
||||||
LFSR_TAG_INLINED, weight1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
LFSR_TAG_INLINED, weight1, LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, weight2, LFSR_DATA_BUF(&nums[i % 10], 1));
|
LFSR_TAG_INLINED, weight2, LFSR_DATA_BUF(&nums[i % 10], 1));
|
||||||
// ignore space issues
|
// ignore space issues
|
||||||
@@ -3380,7 +3380,7 @@ code = '''
|
|||||||
weighted_id += sim_weights[j];
|
weighted_id += sim_weights[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, sim_names[i], 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, sim_names[i], 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == weighted_id+sim_weights[i]-1);
|
assert(id_ == weighted_id+sim_weights[i]-1);
|
||||||
@@ -3460,14 +3460,14 @@ code = '''
|
|||||||
// split btree
|
// split btree
|
||||||
lfs_size_t split_id;
|
lfs_size_t split_id;
|
||||||
lfsr_data_t split_data;
|
lfsr_data_t split_data;
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, name, 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, name, 3,
|
||||||
&split_id, NULL, NULL, &split_data) => 0;
|
&split_id, NULL, NULL, &split_data) => 0;
|
||||||
uint8_t split_buf[4];
|
uint8_t split_buf[4];
|
||||||
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
||||||
if (split_id > id) {
|
if (split_id > id) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id,
|
split_id,
|
||||||
LFSR_DATA_DNAME(0, sim_names[id+1], 3),
|
LFSR_DATA_NAME(0, sim_names[id+1], 3),
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(&nums[i % 10], 1),
|
LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
@@ -3479,7 +3479,7 @@ code = '''
|
|||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
} else {
|
} else {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_DNAME(0, name, 3),
|
split_id, LFSR_DATA_NAME(0, name, 3),
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
LFSR_DATA_BUF(split_buf, 1),
|
LFSR_DATA_BUF(split_buf, 1),
|
||||||
LFSR_TAG_INLINED, 1,
|
LFSR_TAG_INLINED, 1,
|
||||||
@@ -3557,7 +3557,7 @@ code = '''
|
|||||||
lfs_size_t weight_;
|
lfs_size_t weight_;
|
||||||
lfsr_data_t data_;
|
lfsr_data_t data_;
|
||||||
for (lfs_size_t i = 0; i < sim_size; i++) {
|
for (lfs_size_t i = 0; i < sim_size; i++) {
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, sim_names[i], 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, sim_names[i], 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == i);
|
assert(id_ == i);
|
||||||
@@ -3653,14 +3653,14 @@ code = '''
|
|||||||
lfs_size_t split_id;
|
lfs_size_t split_id;
|
||||||
lfs_size_t split_weight;
|
lfs_size_t split_weight;
|
||||||
lfsr_data_t split_data;
|
lfsr_data_t split_data;
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, name, 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, name, 3,
|
||||||
&split_id, NULL, &split_weight,
|
&split_id, NULL, &split_weight,
|
||||||
&split_data) => 0;
|
&split_data) => 0;
|
||||||
uint8_t split_buf[4];
|
uint8_t split_buf[4];
|
||||||
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
||||||
if (split_id > weighted_id+sim_weights[id]-1) {
|
if (split_id > weighted_id+sim_weights[id]-1) {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_DNAME(0, sim_names[id+1], 3),
|
split_id, LFSR_DATA_NAME(0, sim_names[id+1], 3),
|
||||||
LFSR_TAG_INLINED, weight,
|
LFSR_TAG_INLINED, weight,
|
||||||
LFSR_DATA_BUF(&nums[i % 10], 1),
|
LFSR_DATA_BUF(&nums[i % 10], 1),
|
||||||
LFSR_TAG_INLINED, split_weight,
|
LFSR_TAG_INLINED, split_weight,
|
||||||
@@ -3672,7 +3672,7 @@ code = '''
|
|||||||
assert(err == 0);
|
assert(err == 0);
|
||||||
} else {
|
} else {
|
||||||
int err = lfsr_btree_split(&lfs, &btree,
|
int err = lfsr_btree_split(&lfs, &btree,
|
||||||
split_id, LFSR_DATA_DNAME(0, name, 3),
|
split_id, LFSR_DATA_NAME(0, name, 3),
|
||||||
LFSR_TAG_INLINED, split_weight,
|
LFSR_TAG_INLINED, split_weight,
|
||||||
LFSR_DATA_BUF(split_buf, 1),
|
LFSR_DATA_BUF(split_buf, 1),
|
||||||
LFSR_TAG_INLINED, weight,
|
LFSR_TAG_INLINED, weight,
|
||||||
@@ -3778,7 +3778,7 @@ code = '''
|
|||||||
weighted_id += sim_weights[j];
|
weighted_id += sim_weights[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
lfsr_btree_dnamelookup(&lfs, &btree, 0, sim_names[i], 3,
|
lfsr_btree_namelookup(&lfs, &btree, 0, sim_names[i], 3,
|
||||||
&id_, &tag_, &weight_, &data_) => 0;
|
&id_, &tag_, &weight_, &data_) => 0;
|
||||||
assert(tag_ == LFSR_TAG_INLINED);
|
assert(tag_ == LFSR_TAG_INLINED);
|
||||||
assert(id_ == weighted_id+sim_weights[i]-1);
|
assert(id_ == weighted_id+sim_weights[i]-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user