-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update littlefs to v2.8.0 * Add block_count and block_size to LFSFSInfo * lfs.format cannot autodetect block_count * support lfs_fs_grow
- Loading branch information
Showing
9 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule littlefs
updated
17 files
+4 −1 | .github/workflows/release.yml | |
+44 −61 | bd/lfs_emubd.c | |
+13 −5 | bd/lfs_emubd.h | |
+24 −19 | bd/lfs_filebd.c | |
+19 −2 | bd/lfs_filebd.h | |
+26 −39 | bd/lfs_rambd.c | |
+15 −4 | bd/lfs_rambd.h | |
+128 −34 | lfs.c | |
+30 −1 | lfs.h | |
+16 −12 | runners/bench_runner.c | |
+19 −13 | runners/bench_runner.h | |
+36 −16 | runners/test_runner.c | |
+20 −14 | runners/test_runner.h | |
+26 −8 | tests/test_alloc.toml | |
+3 −3 | tests/test_badblocks.toml | |
+5 −5 | tests/test_exhaustion.toml | |
+267 −0 | tests/test_superblocks.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import pytest | ||
from littlefs import LittleFS, LittleFSError | ||
from littlefs.context import UserContext | ||
|
||
|
||
def test_block_count_autodetect(): | ||
block_size = 256 | ||
block_count = 57 | ||
context = UserContext(block_size * block_count) | ||
|
||
# Create the filesystem with 57 blocks | ||
fs = LittleFS(context=context, | ||
block_size=block_size, | ||
block_count=block_count, | ||
) | ||
assert fs.block_count == 57 | ||
|
||
fs = LittleFS(context=context, | ||
block_size=block_size, | ||
block_count=0, # infer from superblock | ||
) | ||
|
||
assert fs.block_count == 57 | ||
|
||
|
||
def test_block_count_autodetect_format_fail(): | ||
with pytest.raises(LittleFSError) as e: | ||
fs = LittleFS(block_count=0) | ||
assert e.value.code == LittleFSError.Error.LFS_ERR_INVAL | ||
|
||
|
||
def test_fs_stat_block_count_autodetect(): | ||
block_size = 256 | ||
block_count = 57 | ||
context = UserContext(block_size * block_count) | ||
|
||
# Create the filesystem with 57 blocks | ||
fs = LittleFS(context=context, | ||
block_size=block_size, | ||
block_count=block_count, | ||
) | ||
assert fs.block_count == 57 | ||
|
||
fs = LittleFS(context=context, | ||
block_size=block_size, | ||
block_count=0, # infer from superblock | ||
) | ||
|
||
# Note: filesystem has to be mounted for fs_stat to work. | ||
info = fs.fs_stat() | ||
assert info.block_count == 57 | ||
assert info.block_size == 256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from littlefs import LittleFS, LittleFSError | ||
|
||
|
||
def test_fs_grow_basic(): | ||
fs = LittleFS(block_count=32) | ||
fs.fs_grow(40) | ||
assert fs.block_count == 40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters