Skip to content

Commit 6d889f0

Browse files
authored
Merge pull request #672 from nicholasbishop/bishop-fatfs-036
xtask: Switch fatfs to latest crates.io release
2 parents c854578 + cc68dad commit 6d889f0

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

xtask/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ publish = false
77
[dependencies]
88
anyhow = "1.0.51"
99
clap = { version = "4.0.4", features = ["derive"] }
10-
# The latest fatfs release (0.3.5) is old, use git instead to pick up some fixes.
11-
fatfs = { git = "https://github.com/rafalh/rust-fatfs.git", rev = "87fc1ed5074a32b4e0344fcdde77359ef9e75432" }
10+
fatfs = "0.3.6"
1211
fs-err = "2.6.0"
1312
heck = "0.4.0"
1413
itertools = "0.10.5"

xtask/src/disk.rs

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use fatfs::{Date, DateTime, FileSystem, FormatVolumeOptions, FsOptions, StdIoWrapper, Time};
2+
use fatfs::{Date, DateTime, FileSystem, FormatVolumeOptions, FsOptions, Time};
33
use mbrman::{MBRPartitionEntry, BOOT_INACTIVE, CHS, MBR};
44
use std::io::{Cursor, Read, Write};
55
use std::ops::Range;
@@ -45,9 +45,9 @@ pub fn create_mbr_test_disk(path: &Path) -> Result<()> {
4545

4646
fn init_fat_test_partition(disk: &mut [u8], partition_byte_range: Range<usize>) -> Result<()> {
4747
{
48-
let mut cursor = StdIoWrapper::from(Cursor::new(&mut disk[partition_byte_range.clone()]));
48+
let cursor = Cursor::new(&mut disk[partition_byte_range.clone()]);
4949
fatfs::format_volume(
50-
&mut cursor,
50+
cursor,
5151
FormatVolumeOptions::new().volume_label(*b"MbrTestDisk"),
5252
)?;
5353
}
@@ -72,10 +72,33 @@ fn init_fat_test_partition(disk: &mut [u8], partition_byte_range: Range<usize>)
7272
// test.
7373
#[allow(deprecated)]
7474
{
75-
let time = Time::new(0, 0, 0, 0);
76-
file.set_created(DateTime::new(Date::new(2000, 1, 24), time));
77-
file.set_accessed(Date::new(2001, 2, 25));
78-
file.set_modified(DateTime::new(Date::new(2002, 3, 26), time));
75+
let time = Time {
76+
hour: 0,
77+
min: 0,
78+
sec: 0,
79+
millis: 0,
80+
};
81+
file.set_created(DateTime {
82+
date: Date {
83+
year: 2000,
84+
month: 1,
85+
day: 24,
86+
},
87+
time,
88+
});
89+
file.set_accessed(Date {
90+
year: 2001,
91+
month: 2,
92+
day: 25,
93+
});
94+
file.set_modified(DateTime {
95+
date: Date {
96+
year: 2002,
97+
month: 3,
98+
day: 26,
99+
},
100+
time,
101+
});
79102
}
80103

81104
let stats = fs.stats()?;

0 commit comments

Comments
 (0)