Commit Graph

249 Commits

Author SHA1 Message Date
Rafał Harabień
75bb9d1293 Create volume label dir entry when formatting
Fixes #41
2023-01-17 00:09:19 +01:00
Rafał Harabień
954c68457f Release version 0.3.5 2021-01-23 23:49:42 +01:00
Rafał Harabień
01b4d0d6f1 Fix CI for Rust 1.24.0 2021-01-22 21:53:02 +01:00
Rafał Harabień
e4b72836f0 Fix file-system corruption when creating directory entries
Corruption happens if:
* files are created in non-root directory
* directory size becomes greater or equal to cluster size
Creating last directory entry in the directory cluster corrupts the
cluster directly preceding the directory cluster.
For 512 bytes long cluster creating 8th directory entry (counted from 1)
will cause first corruption.
Directory entry that causes the corruption will not be updated correctly.

Fixes #42
2021-01-22 00:22:54 +01:00
Rafał Harabień
7b18222941 Change version to 0.3.4 2020-07-21 00:00:08 +02:00
Rafał Harabień
dffded82e9 Update changelog 2020-07-20 23:59:09 +02:00
Rafał Harabień
56a18cf054 Try to fix Travis build 2020-07-20 23:54:21 +02:00
Rafał Harabień
bd73f8a770 Fix log version in Travis for nightly-2018-03-07 build as well 2020-07-20 23:51:03 +02:00
Rafał Harabień
d942cabd82 Fix Rust 1.24 build in Travis by fixing log version 2020-07-20 23:49:59 +02:00
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