Compare commits

..

1 Commits

Author SHA1 Message Date
Christopher Haster
3f99e73841 Fixed some issues in lfs_migrate
- Bad size used for writing out softtail tag
- Use of sizeof address instead of intended target
2019-11-14 14:34:49 -06:00

12
lfs.c
View File

@@ -466,15 +466,9 @@ static int lfs_alloc(lfs_t *lfs, lfs_block_t *block) {
}
}
// no free blocks in lookahead buffer, need to scan tree
LFS_DEBUG("Scanning for free blocks %"PRIx32"-%"PRIx32,
lfs->free.i + lfs->free.off,
(lfs->free.i + lfs->free.off + 8*lfs->cfg->lookahead_size)
% lfs->cfg->block_count);
// check if we have looked at all blocks since last ack
if (lfs->free.ack == 0) {
LFS_ERROR("No more free space %"PRIx32,
LFS_ERROR("No more free space %"PRIu32,
lfs->free.i + lfs->free.off);
return LFS_ERR_NOSPC;
}
@@ -4620,7 +4614,7 @@ int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg) {
id, entry1.d.nlen), name},
{LFS_MKTAG(
isdir ? LFS_TYPE_DIRSTRUCT : LFS_TYPE_CTZSTRUCT,
id, sizeof(&entry1.d.u)), &entry1.d.u}));
id, sizeof(entry1.d.u)), &entry1.d.u}));
lfs1_entry_fromle32(&entry1.d);
if (err) {
goto cleanup;
@@ -4643,7 +4637,7 @@ int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg) {
lfs_pair_tole32(dir2.pair);
err = lfs_dir_commit(lfs, &dir2, LFS_MKATTRS(
{LFS_MKTAG(LFS_TYPE_SOFTTAIL, 0x3ff, 0),
{LFS_MKTAG(LFS_TYPE_SOFTTAIL, 0x3ff, 8),
dir1.d.tail}));
lfs_pair_fromle32(dir2.pair);
if (err) {