diff --git a/README.md b/README.md index dabd8875..a06e5f2c 100644 --- a/README.md +++ b/README.md @@ -267,7 +267,11 @@ License Identifiers that are here available: http://spdx.org/licenses/ to create images of the filesystem on your PC. Check if littlefs will fit your needs, create images for a later download to the target memory or inspect the content of a binary image of the target memory. - + +- [littlefs-toy] - A command-line tool for creating and working with littlefs + images. Uses syntax similar to tar command for ease of use. Supports working + on littlefs images embedded inside another file (firmware image, etc). + - [littlefs2-rust] - A Rust wrapper for littlefs. This project allows you to use littlefs in a Rust-friendly API, reaping the benefits of Rust's memory safety and other guarantees. @@ -321,6 +325,7 @@ License Identifiers that are here available: http://spdx.org/licenses/ [littlefs-js]: https://github.com/geky/littlefs-js [littlefs-js-demo]:http://littlefs.geky.net/demo.html [littlefs-python]: https://pypi.org/project/littlefs-python/ +[littlefs-toy]: https://github.com/tjko/littlefs-toy [littlefs2-rust]: https://crates.io/crates/littlefs2 [nim-littlefs]: https://github.com/Graveflo/nim-littlefs [chamelon]: https://github.com/yomimono/chamelon diff --git a/lfs2.c b/lfs2.c index 7defe54e..6c3c3ece 100644 --- a/lfs2.c +++ b/lfs2.c @@ -93,6 +93,7 @@ static int lfs2_bd_read(lfs2_t *lfs2, // bypass cache? diff = lfs2_aligndown(diff, lfs2->cfg->read_size); int err = lfs2->cfg->read(lfs2->cfg, block, off, data, diff); + LFS2_ASSERT(err <= 0); if (err) { return err; } @@ -739,6 +740,7 @@ static lfs2_stag_t lfs2_dir_getslice(lfs2_t *lfs2, const lfs2_mdir_t *dir, int err = lfs2_bd_read(lfs2, NULL, &lfs2->rcache, sizeof(ntag), dir->pair[0], off, &ntag, sizeof(ntag)); + LFS2_ASSERT(err <= 0); if (err) { return err; } @@ -767,6 +769,7 @@ static lfs2_stag_t lfs2_dir_getslice(lfs2_t *lfs2, const lfs2_mdir_t *dir, err = lfs2_bd_read(lfs2, NULL, &lfs2->rcache, diff, dir->pair[0], off+sizeof(tag)+goff, gbuffer, diff); + LFS2_ASSERT(err <= 0); if (err) { return err; } @@ -1279,6 +1282,7 @@ static lfs2_stag_t lfs2_dir_fetchmatch(lfs2_t *lfs2, if (err == LFS2_ERR_CORRUPT) { break; } + return err; } lfs2_fcrc_fromle32(&fcrc); @@ -2264,7 +2268,7 @@ static int lfs2_dir_relocatingcommit(lfs2_t *lfs2, lfs2_mdir_t *dir, } } - if (dir->erased) { + if (dir->erased && dir->count < 0xff) { // try to commit struct lfs2_commit commit = { .block = dir->pair[0],