This PR adds a check in the remove_dir_all method to avoid removing the root directory.
This Gives a simple fix to the case where one wants to remove all files in the filesystem,
and therefore calls remove_dir_all on `/`, which would previously fail because it can't delete the root.
Fixes#35
`remove_dir_all_where` correctly handles the case where a file in the directory was skipped, but not if a subdirectory was skipped.
This commit fixes it
This patch replaces the LOOKAHEADWORDS_SIZE in driver::Storage (measured
in 4 bytes) with LOOKAHEAD_SIZE (measure in 8 bytes). This makes it
impossible to set illegal values.
Previously, we reported the lookahead buffer size in bytes but
littlefs2-sys expects the lookahead buffer size as a multiple of 8
bytes. This could lead to a buffer overflow causing filesystem
corruption. This patch fixes the reported lookahead buffer size.
Note that Storage::LOOKAHEAD_WORDS_SIZE allows users to set invalid
values (as it is measured in 4 bytes, not in 8 bytes). Invalid values
that were previously accepted because of the wrong buffer size
calculation can now be rejected by littlefs2-sys.
This is a combination of two previous patches:
https://github.com/trussed-dev/littlefs2/pull/19https://github.com/Nitrokey/littlefs2/pull/1
Fixes: https://github.com/trussed-dev/littlefs2/issues/16
Previously, we could simply construct a PathBuf from a str using
PathBuf::from, but not a Path. This patch changes this by adding the
Path::from_str_with_nul method and the path! macro. This even makes it
possible to create Path constants.