diff options
author | Colin Finck <colin@reactos.org> | 2021-08-07 11:30:57 +0300 |
---|---|---|
committer | Colin Finck <colin@reactos.org> | 2021-08-07 11:30:57 +0300 |
commit | d69510820adb71e02448801d30d3827993f30dcb (patch) | |
tree | d2620de773448b07571b8c547209e64374646dda | |
parent | 5ab4c082936ebc6163e7a5995840244964fe596d (diff) |
`ntfs_file` -> `file` for consistency
-rw-r--r-- | src/attribute.rs | 2 | ||||
-rw-r--r-- | src/file.rs (renamed from src/ntfs_file.rs) | 0 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/ntfs.rs | 16 | ||||
-rw-r--r-- | src/structured_values/file_name.rs | 6 | ||||
-rw-r--r-- | src/structured_values/standard_information.rs | 6 | ||||
-rw-r--r-- | src/upcase_table.rs | 4 |
7 files changed, 17 insertions, 21 deletions
diff --git a/src/attribute.rs b/src/attribute.rs index 11f19de..5aa3dd9 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -5,7 +5,7 @@ use crate::attribute_value::{ NtfsAttributeValue, NtfsNonResidentAttributeValue, NtfsResidentAttributeValue, }; use crate::error::{NtfsError, Result}; -use crate::ntfs_file::NtfsFile; +use crate::file::NtfsFile; use crate::string::NtfsString; use crate::structured_values::{ NtfsStructuredValueFromNonResidentAttributeValue, NtfsStructuredValueFromSlice, diff --git a/src/ntfs_file.rs b/src/file.rs index 770ca67..770ca67 100644 --- a/src/ntfs_file.rs +++ b/src/file.rs @@ -13,6 +13,7 @@ mod attribute; mod attribute_value; mod boot_sector; mod error; +mod file; mod file_reference; mod guid; mod index; @@ -20,7 +21,6 @@ mod index_entry; mod index_record; pub mod indexes; mod ntfs; -mod ntfs_file; mod record; mod string; pub mod structured_values; @@ -32,11 +32,11 @@ mod upcase_table; pub use crate::attribute::*; pub use crate::attribute_value::*; pub use crate::error::*; +pub use crate::file::*; pub use crate::file_reference::*; pub use crate::guid::*; pub use crate::index::*; pub use crate::ntfs::*; -pub use crate::ntfs_file::*; pub use crate::string::*; pub use crate::time::*; pub use crate::traits::*; diff --git a/src/ntfs.rs b/src/ntfs.rs index ee2f7fc..e1fcb0e 100644 --- a/src/ntfs.rs +++ b/src/ntfs.rs @@ -4,7 +4,7 @@ use crate::attribute::NtfsAttributeType; use crate::boot_sector::BootSector; use crate::error::{NtfsError, Result}; -use crate::ntfs_file::{KnownNtfsFile, NtfsFile}; +use crate::file::{KnownNtfsFile, NtfsFile}; use crate::structured_values::{NtfsVolumeInformation, NtfsVolumeName}; use crate::upcase_table::UpcaseTable; use binread::io::{Read, Seek, SeekFrom}; @@ -66,10 +66,6 @@ impl Ntfs { self.cluster_size } - pub fn file_record_size(&self) -> u32 { - self.file_record_size - } - /// Returns the [`NtfsFile`] for the `n`-th NTFS file record. /// /// The first few NTFS files have fixed indexes and contain filesystem @@ -79,7 +75,7 @@ impl Ntfs { /// - Check if `n` can be u32 instead of u64. /// - Check if `n` should be in a newtype, with easier conversion from /// KnownNtfsFile. - pub fn ntfs_file<'n, T>(&'n self, fs: &mut T, n: u64) -> Result<NtfsFile<'n>> + pub fn file<'n, T>(&'n self, fs: &mut T, n: u64) -> Result<NtfsFile<'n>> where T: Read + Seek, { @@ -93,6 +89,10 @@ impl Ntfs { NtfsFile::new(&self, fs, position) } + pub fn file_record_size(&self) -> u32 { + self.file_record_size + } + /// Reads the $UpCase file from the filesystem and stores it in this [`Ntfs`] object. /// /// This function only needs to be called if case-insensitive comparisons are later performed @@ -143,7 +143,7 @@ impl Ntfs { where T: Read + Seek, { - let volume_file = self.ntfs_file(fs, KnownNtfsFile::Volume as u64)?; + let volume_file = self.file(fs, KnownNtfsFile::Volume as u64)?; let attribute = volume_file .attributes() .find(|attribute| { @@ -168,7 +168,7 @@ impl Ntfs { where T: Read + Seek, { - let volume_file = iter_try!(self.ntfs_file(fs, KnownNtfsFile::Volume as u64)); + let volume_file = iter_try!(self.file(fs, KnownNtfsFile::Volume as u64)); let attribute = volume_file.attributes().find(|attribute| { // TODO: Replace by attribute.ty().contains() once https://github.com/rust-lang/rust/issues/62358 has landed. attribute diff --git a/src/structured_values/file_name.rs b/src/structured_values/file_name.rs index 24dbbde..ad7787e 100644 --- a/src/structured_values/file_name.rs +++ b/src/structured_values/file_name.rs @@ -178,17 +178,15 @@ impl NtfsIndexEntryKey for NtfsFileName { #[cfg(test)] mod tests { use super::*; + use crate::file::KnownNtfsFile; use crate::ntfs::Ntfs; - use crate::ntfs_file::KnownNtfsFile; use crate::time::tests::NT_TIMESTAMP_2021_01_01; #[test] fn test_file_name() { let mut testfs1 = crate::helpers::tests::testfs1(); let ntfs = Ntfs::new(&mut testfs1).unwrap(); - let mft = ntfs - .ntfs_file(&mut testfs1, KnownNtfsFile::MFT as u64) - .unwrap(); + let mft = ntfs.file(&mut testfs1, KnownNtfsFile::MFT as u64).unwrap(); let mut mft_attributes = mft.attributes(); // Check the FileName attribute of the MFT. diff --git a/src/structured_values/standard_information.rs b/src/structured_values/standard_information.rs index bc533c5..3cb9876 100644 --- a/src/structured_values/standard_information.rs +++ b/src/structured_values/standard_information.rs @@ -125,16 +125,14 @@ impl<'s> NtfsStructuredValueFromSlice<'s> for NtfsStandardInformation { #[cfg(test)] mod tests { use super::*; + use crate::file::KnownNtfsFile; use crate::ntfs::Ntfs; - use crate::ntfs_file::KnownNtfsFile; #[test] fn test_standard_information() { let mut testfs1 = crate::helpers::tests::testfs1(); let ntfs = Ntfs::new(&mut testfs1).unwrap(); - let mft = ntfs - .ntfs_file(&mut testfs1, KnownNtfsFile::MFT as u64) - .unwrap(); + let mft = ntfs.file(&mut testfs1, KnownNtfsFile::MFT as u64).unwrap(); let mut mft_attributes = mft.attributes(); // Check the StandardInformation attribute of the MFT. diff --git a/src/upcase_table.rs b/src/upcase_table.rs index b612fa6..51464f7 100644 --- a/src/upcase_table.rs +++ b/src/upcase_table.rs @@ -3,8 +3,8 @@ use crate::attribute::NtfsAttributeType; use crate::error::{NtfsError, Result}; +use crate::file::KnownNtfsFile; use crate::ntfs::Ntfs; -use crate::ntfs_file::KnownNtfsFile; use crate::traits::NtfsReadSeek; use binread::io::{Read, Seek}; use core::convert::TryInto; @@ -35,7 +35,7 @@ impl UpcaseTable { T: Read + Seek, { // Lookup the $UpCase file and its $DATA attribute. - let upcase_file = ntfs.ntfs_file(fs, KnownNtfsFile::UpCase as u64)?; + let upcase_file = ntfs.file(fs, KnownNtfsFile::UpCase as u64)?; let data_attribute = upcase_file .attributes() .find(|attribute| { |