Commit Graph

240 Commits

Author SHA1 Message Date
Bastien Dejean
0a4850fb33 Add asserts for the encoded values 2020-07-20 23:41:53 +02:00
Bastien Dejean
95def2d4ff Fix time encoding and decoding 2020-07-20 23:41:49 +02:00
Rafał Harabień
0676e40b25 Try to fix CI for old rustc versions by pinning cfg-if to 0.1.9
This should fix error: non-ident macro paths are experimental (see issue #35896)
2019-11-11 00:09:02 +01:00
Rafał Harabień
75789c6a00 Change version to 0.3.3 and complete the changelog 2019-11-10 23:43:43 +01:00
Rafał Harabień
3fb3a993fe Fix build 2019-07-17 21:12:49 +02:00
Rafał Harabień
082e79e321 Hide warnings which require bumping Rust compiler version 2019-07-17 20:57:46 +02:00
Rafał Harabień
59ef23ec98 Update no_std usage in README file 2019-07-17 20:00:37 +02:00
Rafał Harabień
240fd01a9d Fix no_std build with "alloc" feature in Rust 1.29 and newer 2019-07-17 20:00:37 +02:00
Rafał Harabień
0792b167ae Use alloc compiler feature only if "alloc" feature is active
This brings fatfs closer to working on stable Rust - only stable core-io
crate is needed now.
This change was merged previously to master in commit
64eec4b3ad3981ff1c3f5225897d26e5b427a4df
2019-07-17 19:06:11 +02:00
Rafał Harabień
35ebf03405 Fix false comment that crate does not support volume label in root dir 2019-07-17 17:45:02 +02:00
Fabrice Desclaux
9b4c3548dc Add regression test for short name generation 2019-07-17 17:41:29 +02:00
Fabrice Desclaux
f13f720cda Fix bad . .. name entries generation 2019-07-17 17:41:21 +02:00
Rafał Harabień
85a3aeb262 Fix build with std feature 2019-07-17 17:40:32 +02:00
Scott Mabin
307357d404 Refrain from using std features in byteorder 2019-07-17 17:38:14 +02:00
Fabrice Desclaux
f72da63d2d Fix unused mutability 2019-07-17 17:38:06 +02:00
Louis
861426db22 complete allowed char list 2019-07-17 17:37:33 +02:00
Rafał Harabień
0a68d8f0d5 Fix the workaround for no_std build failure in travis 2019-06-20 02:41:08 +02:00
Rafał Harabień
44d01bb164 Work around no_std build failure in travis
Issue is caused by core_io crate requiring very old rustc which is not
compatible with byteorder create since version 1.3.
In crates depending on fatfs byteorder version can be overriden in
their Cargo.toml file.
2019-06-20 02:13:59 +02:00
Rafał Harabień
6ee7e3fc16 Fix example in README file 2019-05-21 00:48:26 +02:00
Rafał Harabień
8178908e06 Add changelog entries for v0.3.2 2018-12-29 20:57:16 +01:00
Rafał Harabień
3628ec9825 Add mkfatfs example 2018-12-29 20:42:49 +01:00
Rafał Harabień
a63458b150 Change version to 0.3.2 2018-12-29 20:22:10 +01:00
Rafał Harabień
812f61e393 Change rustfmt options and reformat code
Option 'use_small_heuristics' is too abstract for me.
Smaller lines and disabled heuristics should work better.
2018-12-29 20:21:24 +01:00
Rafał Harabień
8ddd1de5fc Add basic validation in FormatVolumeOptions setters 2018-12-29 19:43:42 +01:00
Rafał Harabień
dc128b7308 Refactor FAT type determination, rename and add option for format_volume
* FAT type should be properly selected even if custom cluster size is used.
* root_entries has been renamed to max_root_dir_entries in FormatVolumeOptions
* added option FormatVolumeOptions::fats
2018-12-29 19:37:46 +01:00
Rafał Harabień
131f047c91 Fix build on old Rustc 2018-12-20 02:43:04 +01:00
Rafał Harabień
8502edb7b8 feat: Make sector size and total sectors optional for format_volume
* moved bytes_per_sector and total_sectors from FormatVolumeOptions::new
to a dedicated methods (it is optional now)
* calculate total number of sectors using seek() to disk end if not provided
* added more doc comments
* added assertions about disk handle position being zero
2018-12-20 01:47:34 +01:00
Rafał Harabień
c372429951 feat: check more BPB fields when mounting fs
Fail mounting if:
* root_entries is zero (only on FAT12/FAT16)
* backup_boot_sector is outside of the reserved region (only on FAT32)
* fs_info_sector is outside of the reserved region (only on FAT32)
2018-12-12 22:21:12 +01:00
Rafał Harabień
b4455a86a8 fix: Make backup boot-sector part of reserved region when formatting volume
Change number of reserved sectors to 8.
Previously backup boot-sector was over-written by FAT formatting code soon
after it was initialized.
2018-12-12 22:10:10 +01:00
Rafał Harabień
f2863e8f46 fix: Rework FAT size calculation for volume formatting
New formula gives nearly perfect results (according to tests) and is
better than formula from specification.
Also all math transformations are provided in comments so it is no longer
a blindly copied formula from spec but a Math supported formula.
Old formula was not taking into account sector size (it resulted in too
big FATs for sector size different than 512) and had rounding issues for
FAT12 and FAT32.
2018-12-12 21:28:05 +01:00
Rafał Harabień
a88d751c47 refactor: apply most of rustfmt changes 2018-12-09 00:32:52 +01:00
Rafał Harabień
a3ab0098da refactor: fix some lints from Clippy tool 2018-12-09 00:22:21 +01:00
Rafał Harabień
96339ff7e6 fix: use write_all in serialize method for FS Info sector 2018-12-08 23:45:31 +01:00
Rafał Harabień
70b0a771b8 refactor: Convert between sectors, clusters and bytes in one place (BPB)
Change encapsulates method of calculating it so it can be optimized in
future in one place (e.g. using bit shifts).
2018-12-08 19:38:31 +01:00
Rafał Harabień
cf3256bfda fix: clear directory returned from create_dir method
Previous implementation did not zero allocated cluster so created directory
could have garbage contents.
Bug exists in code since version 0.2 and all code using create_dir is
affected.
This commit also improves tests of volume formatting so a dirty partition
is used allowing to detect bugs like this.
2018-12-08 19:34:47 +01:00
Rafał Harabień
647ca9252a fix: when formatting FAT32 volume properly clear root directory cluster 2018-12-08 19:29:44 +01:00
Rafał Harabień
4727b170df Add more logging on trace channel 2018-12-08 19:29:02 +01:00
Rafał Harabień
1768b0fe7e Move Boot Sector/BPB related code to boot_sector.rs 2018-12-08 17:17:08 +01:00
Rafał Harabień
15b45f2457 Add docs for formatting API 2018-12-08 16:59:10 +01:00
Rafał Harabień
41c3d31ba2 New syntax for FormatVolumeOptions 2018-12-05 22:31:59 +01:00
Rafał Harabień
fd89185461 Add more format_volume tests and simlify code 2018-12-05 22:31:59 +01:00
Rafał Harabień
e8a313ac4c Change total FAT entries calculation
Old way of doing it was wrong because 512 (standard sector size) is not
dividable by 12.
Also fix the build...
2018-12-05 22:31:59 +01:00
Rafał Harabień
253f816c40 Check if total clusters after formatting and fat type matches 2018-12-05 22:31:59 +01:00
Rafał Harabień
b9753248f7 Properly initialize file allocation table when formatting a volume 2018-12-05 22:31:59 +01:00
Rafał Harabień
447c9dda35 Improve formulas for volume formatting
* Fix bytes per cluster and sectors per fat calculations + add tests
* Fix boot code in FAT12/16
2018-12-05 22:31:59 +01:00
Rafał Harabień
df81d3b9fd Volume format API 2018-12-05 22:31:59 +01:00
Rafał Harabień
e45cfb5188 fix: do not use hard-coded sector size when dealing with FSInfo sector
Previous code is not working correctly if sector size is different than 512.
Creating test for this issue would require another binary blob in
repository so I am leaving it without test for now.
2018-12-05 01:38:51 +01:00
Rafał Harabień
77be6dd9d0 Fix build 2018-10-22 21:40:03 +02:00
Rafał
c4ffb2ccf5
Add more checks of BPB (#21) 2018-10-22 14:51:32 +02:00
Rafał Harabień
a1db3e82c7 Simplify FAT tests 2018-10-20 15:34:00 +02:00