11use anyhow:: Result ;
2- use fatfs:: { Date , DateTime , FileSystem , FormatVolumeOptions , FsOptions , StdIoWrapper , Time } ;
2+ use fatfs:: { Date , DateTime , FileSystem , FormatVolumeOptions , FsOptions , Time } ;
33use mbrman:: { MBRPartitionEntry , BOOT_INACTIVE , CHS , MBR } ;
44use std:: io:: { Cursor , Read , Write } ;
55use std:: ops:: Range ;
@@ -45,9 +45,9 @@ pub fn create_mbr_test_disk(path: &Path) -> Result<()> {
4545
4646fn 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