@@ -16,7 +16,7 @@ use crate::error::Error;
1616use  crate :: file:: File ; 
1717use  crate :: io:: { self ,  IoBase ,  Read ,  ReadLeExt ,  Seek ,  SeekFrom ,  Write ,  WriteLeExt } ; 
1818use  crate :: table:: { 
19-     alloc_cluster,  count_free_clusters,  format_fat,  read_fat_flags,  ClusterIterator ,  RESERVED_FAT_ENTRIES , 
19+     alloc_cluster,  count_free_clusters,  format_fat,  read_fat_flags,  write_fat_flags ,   ClusterIterator ,  RESERVED_FAT_ENTRIES , 
2020} ; 
2121use  crate :: time:: { DefaultTimeProvider ,  TimeProvider } ; 
2222
@@ -506,14 +506,18 @@ impl<IO: Read + Write + Seek, TP, OCC> FileSystem<IO, TP, OCC> {
506506        Ok ( cluster) 
507507    } 
508508
509+     fn  fat_status_flags ( & self )  -> Result < FsStatusFlags ,  Error < IO :: Error > >  { 
510+         read_fat_flags ( & mut  self . fat_slice ( ) ,  self . fat_type ) 
511+     } 
512+ 
509513    /// Returns status flags for this volume. 
510514     /// 
511515     /// # Errors 
512516     /// 
513517     /// `Error::Io` will be returned if the underlying storage object returned an I/O error. 
514518     pub  fn  read_status_flags ( & self )  -> Result < FsStatusFlags ,  Error < IO :: Error > >  { 
515519        let  bpb_status = self . bpb . status_flags ( ) ; 
516-         let  fat_status = read_fat_flags ( & mut   self . fat_slice ( ) ,   self . fat_type ) ?; 
520+         let  fat_status = self . fat_status_flags ( ) ?; 
517521        Ok ( FsStatusFlags  { 
518522            dirty :  bpb_status. dirty  || fat_status. dirty , 
519523            io_error :  bpb_status. io_error  || fat_status. io_error , 
@@ -604,6 +608,15 @@ impl<IO: Read + Write + Seek, TP, OCC> FileSystem<IO, TP, OCC> {
604608        Ok ( ( ) ) 
605609    } 
606610
611+     pub  fn  set_fat_dirty_flag ( & self ,  dirty :  bool )  -> Result < ( ) ,  Error < IO :: Error > >  { 
612+       let  mut  fat_status = self . fat_status_flags ( ) ?; 
613+       fat_status. dirty  = dirty; 
614+ 
615+       write_fat_flags ( & mut  self . fat_slice ( ) ,  self . fat_type ,  fat_status) ?; 
616+ 
617+       Ok ( ( ) ) 
618+     } 
619+ 
607620    /// Returns a root directory object allowing for futher penetration of a filesystem structure. 
608621     pub  fn  root_dir ( & self )  -> Dir < IO ,  TP ,  OCC >  { 
609622        trace ! ( "root_dir" ) ; 
0 commit comments