Skip to content

Commit 8bbadd7

Browse files
sosthene-nitrokeyrobin-nitrokey
authored andcommitted
Bump littlefs to version 2.9
1 parent 341d3de commit 8bbadd7

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10-
-
10+
### Changed
11+
12+
- Updated to [`littlefs2-sys` v0.3.1](https://github.com/trussed-dev/littlefs2-sys/releases/tag/0.3.1) and [`littlefs` v2.9.3](https://github.com/littlefs-project/littlefs/releases/tag/v2.9.3).
13+
- `littlefs2` v2.6 introduced a new on-disk format (lfs2.1).
14+
We use the multiversion feature to keep the old on-disk format (lfs2.0) to not break compatibility with older versions of this crate.
1115

1216
## [v0.5.0](https://github.com/trussed-dev/littlefs2/releases/tag/0.5.0) - 2024-10-25
1317

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ delog = "0.1.0"
2424
generic-array = "0.14"
2525
heapless = "0.7"
2626
littlefs2-core = { version = "0.1", path = "core" }
27-
littlefs2-sys = "0.2"
27+
littlefs2-sys = { version = "0.3.1", features = ["multiversion"] }
2828

2929
[dev-dependencies]
3030
ssmarshal = "1"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ The low-level bindings are provided by the [littlefs2-sys][littlefs2-sys] librar
3737

3838
The core types that are independent of a specific implementation version are provided by the `littlefs2-core` crate, see the [`core`](./core) directory. These types are re-exported from the `littlefs2` crate too.
3939

40-
Upstream release: [v2.2.1][upstream-release]
40+
Upstream release: [v2.9.3][upstream-release]
4141

4242
[geky]: https://github.com/geky
4343
[littlefs]: https://github.com/littlefs-project/littlefs
4444
[release-notes-2]: https://github.com/littlefs-project/littlefs/releases/tag/v2.0.0
4545
[std-fs]: https://doc.rust-lang.org/std/fs/index.html
4646
[littlefs2-sys]: https://lib.rs/littlefs2-sys
47-
[upstream-release]: https://github.com/littlefs-project/littlefs/releases/tag/v2.2.1
47+
[upstream-release]: https://github.com/littlefs-project/littlefs/releases/tag/v2.9.3
4848

4949
## `no_std`
5050

src/fs.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ impl<Storage: driver::Storage> Allocation<Storage> {
158158
name_max: filename_max_plus_one.wrapping_sub(1),
159159
file_max,
160160
attr_max,
161+
compact_thresh: 0,
162+
metadata_max: 0,
163+
inline_max: 0,
164+
disk_version: 0x0002_0000,
161165
};
162166

163167
Self {
@@ -1224,6 +1228,28 @@ mod tests {
12241228
use io::Result as LfsResult;
12251229
const_ram_storage!(TestStorage, 4096);
12261230

1231+
#[test]
1232+
fn disk_version() {
1233+
let mut test_storage = TestStorage::new();
1234+
Filesystem::format(&mut test_storage).unwrap();
1235+
Filesystem::mount_and_then(&mut test_storage, |fs| {
1236+
let mut fs_info = ll::lfs_fsinfo {
1237+
disk_version: 0,
1238+
block_size: 0,
1239+
block_count: 0,
1240+
name_max: 0,
1241+
file_max: 0,
1242+
attr_max: 0,
1243+
};
1244+
let return_code =
1245+
unsafe { ll::lfs_fs_stat(&mut fs.alloc.borrow_mut().state, &mut fs_info) };
1246+
result_from((), return_code).unwrap();
1247+
assert_eq!(fs_info.disk_version, 0x0002_0000);
1248+
Ok(())
1249+
})
1250+
.unwrap();
1251+
}
1252+
12271253
#[test]
12281254
fn todo() {
12291255
let mut test_storage = TestStorage::new();

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ pub fn version() -> Version {
175175
/// Information about the C backend
176176
#[derive(Clone, Copy, Debug)]
177177
pub struct Version {
178-
/// On-disk format (currently: 2.0)
178+
/// On-disk format
179179
pub format: (u32, u32),
180-
/// Backend release (currently: 2.1)
180+
/// Backend release
181181
pub backend: (u32, u32),
182182
}
183183

src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ ram_storage!(
4242

4343
#[test]
4444
fn version() {
45-
assert_eq!(crate::version().format, (2, 0));
46-
assert_eq!(crate::version().backend, (2, 2));
45+
assert_eq!(crate::version().format, (2, 1));
46+
assert_eq!(crate::version().backend, (2, 9));
4747
}
4848

4949
#[test]

0 commit comments

Comments
 (0)