Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.c
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-08-07 22:10:03 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-17 04:18:24 +0300
commit3b3981eb7468714d1c938b52a13a20f003d8ae1d (patch)
tree940af05fc88738c8aa2bb4e005a95bdc0cad5631 /lfs.c
parentd8f930eeabe7c494d5f81a41a52da519617f66d8 (diff)
Fixed testing issues introduced by expanding superblocks
This was mostly tweaking test cases to be accommodating for variable sized superblock-lists. Though there were a few bugs that needed fixing: - Changed compact to use source dir for move since the original dir could have changed as a result of an expand. - Created copy of current directory so we don't overwrite ourselves during an internal commit update. Also made sure all of the test suites provide reproducable results when ran independently (the entry tests were behaving differently based on which tests were ran before). (Some where legitimate test failures)
Diffstat (limited to 'lfs.c')
-rw-r--r--lfs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lfs.c b/lfs.c
index ee8a7a8..2d174a2 100644
--- a/lfs.c
+++ b/lfs.c
@@ -658,7 +658,7 @@ static int lfs_commit_move(lfs_t *lfs, struct lfs_commit *commit,
int32_t res = lfs_commit_get(lfs, commit->block,
commit->off, commit->ptag,
lfs_tag_isuser(tag) ? 0x7ffff000 : 0x7c3ff000,
- LFS_MKTAG(lfs_tag_type(tag), toid, 0),
+ (tag & 0x7fc00000) | LFS_MKTAG(0, toid, 0),
0, NULL, true);
if (res < 0 && res != LFS_ERR_NOENT) {
return res;
@@ -1166,7 +1166,7 @@ split:
tail.tail[0] = dir->tail[0];
tail.tail[1] = dir->tail[1];
- err = lfs_dir_compact(lfs, &tail, attrs, dir, ack+1-expanding, end);
+ err = lfs_dir_compact(lfs, &tail, attrs, source, ack+1-expanding, end);
if (err) {
return err;
}
@@ -1346,8 +1346,12 @@ compact:
lfs_global_xor(&lfs->globals, &canceldiff);
// update any directories that are affected
+ lfs_mdir_t copy = *dir;
+
+ // two passes, once for things that aren't us, and one
+ // for things that are
for (lfs_mlist_t *d = lfs->mlist; d; d = d->next) {
- if (lfs_pair_cmp(d->m.pair, dir->pair) == 0) {
+ if (lfs_pair_cmp(d->m.pair, copy.pair) == 0) {
d->m = *dir;
if (d->id == lfs_tag_id(deletetag)) {
d->m.pair[0] = 0xffffffff;