From 6dc43f880e0279cc2e808fecfd8535262089207f Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 8 Feb 2023 10:23:27 +0100 Subject: [PATCH 1/2] Bump littlefs2 to 0.4.0 --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- src/types.rs | 2 +- src/virt/store.rs | 14 ++++---------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5060030deb..9635092df48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added support for custom backends in `backend` module. - Added optional support for API extensions in `serde_extensions` module behind the `serde-extensions` feature. +- Added `types::Path` re-export of `littlefs2::path::Path`. ### Changed @@ -30,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `PollClient::syscall`. - Upgrade the `interchange` dependency to version 0.3.0 ([#99][]) - As a consequence the type `pipe::TrussedInterchange` becomes a const`pipe::TRUSSED_INTERCHANGE` +- Updated `littlefs2` to 0.4.0. ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 83f8935910a..76dfbcf92a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ delog = "0.1.0" cbor-smol = "0.4" heapless-bytes = { version = "0.3.0", features = ["cbor"] } interchange = "0.3.0" -littlefs2 = "0.3.1" +littlefs2 = "0.4.0" p256-cortex-m4 = { version = "0.1.0-alpha.5", features = ["prehash", "sec1-signatures"] } salty = { version = "0.2.0", features = ["cose"] } serde-indexed = "0.1.0" diff --git a/src/types.rs b/src/types.rs index 8a9e5e89f68..3e41efeb30e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -11,7 +11,7 @@ pub use littlefs2::{ driver::Storage as LfsStorage, fs::{DirEntry, Filesystem, Metadata}, io::Result as LfsResult, - path::PathBuf, + path::{Path, PathBuf}, }; use rand_core::{CryptoRng, RngCore}; diff --git a/src/virt/store.rs b/src/virt/store.rs index 2e1589cf598..43f2c122bc7 100644 --- a/src/virt/store.rs +++ b/src/virt/store.rs @@ -5,7 +5,7 @@ use std::{ path::PathBuf, }; -use generic_array::typenum::{U16, U512}; +use generic_array::typenum::{U512, U8}; use littlefs2::{const_ram_storage, driver::Storage, fs::Allocation}; use crate::{ @@ -53,15 +53,9 @@ impl Storage for FilesystemStorage { const BLOCK_CYCLES: isize = -1; type CACHE_SIZE = U512; - type LOOKAHEADWORDS_SIZE = U16; - // TODO: This can't actually be changed currently - // type FILENAME_MAX_PLUS_ONE = U256; - // type PATH_MAX_PLUS_ONE = U256; - // const FILEBYTES_MAX: usize = littlefs2::ll::LFS_FILE_MAX as _; - // TODO: This can't actually be changed currently - // type ATTRBYTES_MAX = U1022; - - fn read(&self, offset: usize, buffer: &mut [u8]) -> LfsResult { + type LOOKAHEAD_SIZE = U8; + + fn read(&mut self, offset: usize, buffer: &mut [u8]) -> LfsResult { debug!("read: offset: {}, len: {}", offset, buffer.len()); let mut file = File::open(&self.0).unwrap(); file.seek(SeekFrom::Start(offset as _)).unwrap(); From 3b64e9eb973e5cfdbe1d22e1be7d5495efd0ca7b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 7 Apr 2023 11:15:57 +0200 Subject: [PATCH 2/2] Unpin Rust version As the littlefs2 incompatibility is now fixed, we can remove the pinned Rust version. Fixes https://github.com/trussed-dev/trussed/issues/83 --- rust-toolchain.toml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 7b02e0c1085..00000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,4 +0,0 @@ -[toolchain] -channel = "1.66.1" -profile = "minimal" -components = ["rustfmt", "clippy"]