* Fix copy/paste errors in ls example so file sizes are correctly output.
* BPB updates.
Fix bug in bpb.active_fat(), because active_fat is
only valid when mirroring is disabled.
Add additional santiy checks to BPB deserialization:
1. bytes per sector must be a power of 2
2. 512 <= bytes per sector <= 4096
3. sectors per cluster must be a power of 2
4. 1 <= sectors per cluster <= 128
Also added some comments relating to conditions that
may be useful to WARN about for BPB deserialization:
Z. bpb.reserved_sectors should be 1
Y. bpb.fats should be either 1 or 2
X. bpb.fs_version should be validated as zero
Add syntactic sugar for:
A. bpb.is_fat32()
B. bpb.sectors_per_fat()
C. bpb.total_sectors()
Encoder is not yet used but will be in future.
This is implemented as static reference for now to avoid adding additional
type parameters to all main types. It should be enough for most of cases
where encoder/decoder does not have any state and can be implemented as
static variable.
Instead methods returning &[u8] were added.
It is API preparation for proper OEM codepage decoding.
Previous behavior would require to store duplicated short names
(one lossy and one real).
Previous code removed source file before returning an error.
It also caused a clusters leak. Now it returns error before doing any
modifications on the partition.
Affects debug build only. Overflow was not handled when calculating
checksum used for short name generation when avoiding a conflict.
LFN checksum was working properly but got refactored in this commit to
use num::Wrapping as well.
BufStream is universal and can be used with any filesystem so its place is
in different crate. Also moved Partition struct from examples to
fscommon::StreamSlice struct (please note constructor arguments has changed).
This change allows for moving an object ownership to FileSystem object
instead of borrowing it. It makes usage of library easier in some cases.
Unfortunately it is a breaking change.
Dir methods do not change Dir object itself. They usually clone inner
stream so no change really happens self struct. Underlying partition is
modified but it does not have to affect API. For example see
std::fs::File::set_len. This change greatly simplifies rename API usage.