Skip to content
4 changes: 4 additions & 0 deletions src/boot_sector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ impl BiosParameterBlock {
FsStatusFlags::decode(self.reserved_1)
}

pub(crate) fn set_status_flags(&mut self, status_flags: FsStatusFlags) {
self.reserved_1 = status_flags.encode();
}

pub(crate) fn is_fat32(&self) -> bool {
// because this field must be zero on FAT32, and
// because it must be non-zero on FAT12/FAT16,
Expand Down
2 changes: 1 addition & 1 deletion src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const LFN_PADDING: u16 = 0xFFFF;

pub(crate) enum DirRawStream<'a, IO: ReadWriteSeek, TP, OCC> {
File(File<'a, IO, TP, OCC>),
Root(DiskSlice<FsIoAdapter<'a, IO, TP, OCC>, FsIoAdapter<'a, IO, TP, OCC>>),
Root(DiskSlice<FsIoAdapter<'a, IO, TP, OCC>, IO::Error>),
}

impl<IO: ReadWriteSeek, TP, OCC> DirRawStream<'_, IO, TP, OCC> {
Expand Down
5 changes: 4 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub enum Error<T> {
DirectoryIsNotEmpty,
/// File system internal structures are corrupted/invalid.
CorruptedFileSystem,
/// File system is marked dirty.
DirtyFileSystem,
/// There is not enough free space on the storage to finish the requested operation.
NotEnoughSpace,
/// The provided file name is either too long or empty.
Expand Down Expand Up @@ -47,7 +49,7 @@ impl From<Error<std::io::Error>> for std::io::Error {
| Error::DirectoryIsNotEmpty => Self::new(std::io::ErrorKind::InvalidInput, error),
Error::NotFound => Self::new(std::io::ErrorKind::NotFound, error),
Error::AlreadyExists => Self::new(std::io::ErrorKind::AlreadyExists, error),
Error::CorruptedFileSystem => Self::new(std::io::ErrorKind::InvalidData, error),
Error::CorruptedFileSystem | Error::DirtyFileSystem => Self::new(std::io::ErrorKind::InvalidData, error),
}
}
}
Expand All @@ -66,6 +68,7 @@ impl<T: core::fmt::Display> core::fmt::Display for Error<T> {
Error::NotFound => write!(f, "No such file or directory"),
Error::AlreadyExists => write!(f, "File or directory already exists"),
Error::CorruptedFileSystem => write!(f, "Corrupted file system"),
Error::DirtyFileSystem => write!(f, "Dirty file system"),
}
}
}
Expand Down
Loading