From 3fda2fb7e8a949e30b017ba4329cd8cd9525f26c Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Thu, 10 Jun 2021 22:20:14 +0200 Subject: [PATCH] Missed a generic-array type --- Cargo.toml | 2 +- src/driver.rs | 12 +++++------- src/fs.rs | 2 +- src/macros.rs | 2 -- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e928110b..8cf398d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "littlefs2" description = "Idiomatic Rust API for littlefs" -version = "0.3.0" +version = "0.3.1" authors = ["Nicolas Stalder ", "Brandon Edens "] edition = "2018" license = "Apache-2.0 OR MIT" diff --git a/src/driver.rs b/src/driver.rs index 68d29e4b..acd19704 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -67,11 +67,11 @@ pub trait Storage { ///// to the C backend. //type FILENAME_MAX_PLUS_ONE: ArrayLength; - /// Maximum length of a path plus one. Necessary to convert Rust string slices - /// to C strings, which requires an allocation for the terminating - /// zero-byte. If in doubt, set to `FILENAME_MAX_PLUS_ONE`. - /// Must be larger than `FILENAME_MAX_PLUS_ONE`. - type PATH_MAX_PLUS_ONE: ArrayLength; + // /// Maximum length of a path plus one. Necessary to convert Rust string slices + // /// to C strings, which requires an allocation for the terminating + // /// zero-byte. If in doubt, set to `FILENAME_MAX_PLUS_ONE`. + // /// Must be larger than `FILENAME_MAX_PLUS_ONE`. + // type PATH_MAX_PLUS_ONE: ArrayLength; ///// Maximum size of file. Stored in superblock. ///// Defaults to 2_147_483_647 (or u31, to avoid sign issues in the C code). @@ -136,8 +136,6 @@ mod future { // TODO: this supposedly influences whether files are inlined or not. Clarify type CACHE_SIZE; type LOOKAHEADWORDS_SIZE; - // not part of littlefs - type PATH_MAX_PLUS_ONE; } pub trait RuntimeParameters { diff --git a/src/fs.rs b/src/fs.rs index 971b834e..f4063129 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -96,7 +96,7 @@ impl Allocation { debug_assert!(filename_max_plus_one <= 1_022+1); // limitation of ll-bindings debug_assert!(filename_max_plus_one == 255+1); - let path_max_plus_one: u32 = ::PATH_MAX_PLUS_ONE::to_u32(); + let path_max_plus_one: u32 = crate::consts::PATH_MAX_PLUS_ONE as _; // TODO: any upper limit? debug_assert!(path_max_plus_one >= filename_max_plus_one); let file_max = crate::consts::FILEBYTES_MAX; diff --git a/src/macros.rs b/src/macros.rs index a8f3ebab..d0b59e2e 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -50,7 +50,6 @@ macro_rules! ram_storage { ( const BLOCK_SIZE: usize = $block_size; const BLOCK_COUNT: usize = $block_count; type LOOKAHEADWORDS_SIZE = $lookaheadwords_size; - type PATH_MAX_PLUS_ONE = $path_max_plus_one; fn read(&self, offset: usize, buf: &mut [u8]) -> $Result { let read_size: usize = Self::READ_SIZE; @@ -180,7 +179,6 @@ macro_rules! const_ram_storage { ( const BLOCK_SIZE: usize = $block_size; const BLOCK_COUNT: usize = $block_count; type LOOKAHEADWORDS_SIZE = $lookaheadwords_size; - type PATH_MAX_PLUS_ONE = $path_max_plus_one; fn read(&self, offset: usize, buf: &mut [u8]) -> $Result { let read_size: usize = Self::READ_SIZE;