Remove update_fs_info option
FSInfo sector should always be saved if it has changed.
This commit is contained in:
parent
0077ee43e4
commit
8be8c68eab
12
src/fs.rs
12
src/fs.rs
@ -294,7 +294,6 @@ impl FsInfoSector {
|
|||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct FsOptions {
|
pub struct FsOptions {
|
||||||
pub(crate) update_accessed_date: bool,
|
pub(crate) update_accessed_date: bool,
|
||||||
pub(crate) update_fs_info: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FsOptions {
|
impl FsOptions {
|
||||||
@ -302,7 +301,6 @@ impl FsOptions {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
FsOptions {
|
FsOptions {
|
||||||
update_accessed_date: false,
|
update_accessed_date: false,
|
||||||
update_fs_info: true,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,12 +309,6 @@ impl FsOptions {
|
|||||||
self.update_accessed_date = enabled;
|
self.update_accessed_date = enabled;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If enabled library updates FSInfo sector when unmounting (only if modified).
|
|
||||||
pub fn update_fs_info(mut self, enabled: bool) -> Self {
|
|
||||||
self.update_fs_info = enabled;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FAT volume statistics.
|
/// FAT volume statistics.
|
||||||
@ -569,15 +561,13 @@ impl <T: ReadWriteSeek> FileSystem<T> {
|
|||||||
|
|
||||||
/// Unmounts the filesystem.
|
/// Unmounts the filesystem.
|
||||||
///
|
///
|
||||||
/// Updates FSInfo sector if `update_fs_info` mount option is enabled.
|
/// Updates FSInfo sector if needed.
|
||||||
pub fn unmount(self) -> io::Result<()> {
|
pub fn unmount(self) -> io::Result<()> {
|
||||||
self.unmount_internal()
|
self.unmount_internal()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unmount_internal(&self) -> io::Result<()> {
|
fn unmount_internal(&self) -> io::Result<()> {
|
||||||
if self.options.update_fs_info {
|
|
||||||
self.flush_fs_info()?;
|
self.flush_fs_info()?;
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user