Skip to content

Commit

Permalink
Missed a generic-array type
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Jun 10, 2021
1 parent cdcb99f commit 3fda2fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "littlefs2"
description = "Idiomatic Rust API for littlefs"
version = "0.3.0"
version = "0.3.1"
authors = ["Nicolas Stalder <[email protected]>", "Brandon Edens <[email protected]>"]
edition = "2018"
license = "Apache-2.0 OR MIT"
Expand Down
12 changes: 5 additions & 7 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ pub trait Storage {
///// to the C backend.
//type FILENAME_MAX_PLUS_ONE: ArrayLength<u8>;

/// 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<u8>;
// /// 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<u8>;

///// Maximum size of file. Stored in superblock.
///// Defaults to 2_147_483_647 (or u31, to avoid sign issues in the C code).
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<Storage: driver::Storage> Allocation<Storage> {
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 = <Storage as driver::Storage>::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;
Expand Down
2 changes: 0 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
let read_size: usize = Self::READ_SIZE;
Expand Down Expand Up @@ -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<usize> {
let read_size: usize = Self::READ_SIZE;
Expand Down

0 comments on commit 3fda2fb

Please sign in to comment.