We already have the path macro and PathBuf::from_path. Having a
separate path_buf macro makes the code more readable and ensures
compile-time evaluation.
Some functions assume that c_int is always i32. This is not true for
all platforms. This patch adapts those functions to handle those cases.
Some littlefs functions return an error code (c_int) from functions
returning i32. In these cases, error codes are truncated to c_int::MIN.
If unwrap or expect is used on a Result<_, Error>, the Debug
implementation is not always optimized out. This leads to a significant
increase of the binary size. As a short-term fix, this patch changes the
Debug implementation to always returns a static string.
The DynFile::read_to_end, DynFilesystem::read and
DynFilesystem::read_chunk methods use a heapless::Vec to store a
flexible amount of data. This patch introduces a Vec trait that
abstracts over different versions of heapless so that we can optionally
support multiple heapless versions at the same time.
Fixes: https://github.com/trussed-dev/littlefs2/issues/77
The dir-entry-path feature has been enabled by default and only adds a
very small overhead. To decrease complexity, this patch removes the
feature and always enables the previously feature-gated code.
Fixes: https://github.com/trussed-dev/littlefs2/issues/76
This patch refactory the API to read and write attributes so that the
buffer is always provided by the caller. This means that the caller is
not required to always use a 1 kB buffer even if the attribute length is
much smaller.
Fixes: https://github.com/trussed-dev/littlefs2/issues/75
To reduce the number of global items and for consistency with constants
like u8::MAX, this patch replaces the size constants ATTRBYTES_MAX,
PATH_MAX and PATH_MAX_PLUS_ONE with associated constants
Attribute::MAX_SIZE, PathBuf::MAX_SIZE and PathBuf::MAX_SIZE_PLUS_ONE.
To make it easier to maintain applications using littlefs2, this patch
introduces a littlefs2-core crate with the basic types and traits used
by littlefs2, but without a specific implementation.
Fixes: https://github.com/trussed-dev/littlefs2/issues/55
Previously, DynFilesystem used OpenOptions for opening files in a custom
mode. This has two drawbacks: OpenOptions are constructed using a
callback leading to a rather complex method signature. And OpenOption
depends on the Filesystem type, making it impossible to move
DynFilesystem into a separate core crate without also moving Filesystem.
This patch makes the FileOpenFlags struct public, changes its backing
type to i32 to avoid unnecessary conversions and changes the
DynFilesystem trait to accept FileOpenFlags instead of an
OpenOptionsCallback. The affected methods are renamed from
*with_options* to *with_flags*.
The Path::exists method requires access to a Filesystem instance. This
will be a problem once we move Path into a separate core crate (that
does not have access to the Filesystem implementation). Therefore, this
patch replaces Path::exists with Filesystem::exists.
To make it easier to add support for new error codes without breaking
compatibility, this patch replaces the Error enum with a struct and
associated constants. As a part of this change, it also enforces that
Error is not used for return values indicating success, i. e. only for
negative return values.