Commit Graph

11 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ń
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ń
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ń
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ń
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ń
a88d751c47 refactor: apply most of rustfmt changes 2018-12-09 00:32:52 +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ń
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ń
b9753248f7 Properly initialize file allocation table when formatting a volume 2018-12-05 22:31:59 +01:00
Rafał Harabień
df81d3b9fd Volume format API 2018-12-05 22:31:59 +01:00