diff options
author | Colin Finck <colin@reactos.org> | 2021-07-26 20:37:47 +0300 |
---|---|---|
committer | Colin Finck <colin@reactos.org> | 2021-07-26 20:37:47 +0300 |
commit | 55e173e2ca2468551d5cff79478efb0e7a4dd1b5 (patch) | |
tree | 65de8d6a326e2b0e4007ca985fbffd15dac5fa5b /src/index_record.rs | |
parent | 5775089c8e0196fcc50b509138b181551a63a3a2 (diff) |
Introduce typed indexes to support more than just file name indexes.
Index entry keys do not necessarily correspond to the structured values. In fact, file name indexes are the exception and not the rule. All other index types have dedicated key structures.
Likewise, some index types (e.g. SDH and SII) also have extra data structures instead of a file reference.
Finally, some other index types (like R over Reparse points) only have a key structure, but neither data nor a file reference.
Diffstat (limited to 'src/index_record.rs')
-rw-r--r-- | src/index_record.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/index_record.rs b/src/index_record.rs index e6fccd3..e0fab4f 100644 --- a/src/index_record.rs +++ b/src/index_record.rs @@ -4,6 +4,7 @@ use crate::attribute_value::NtfsNonResidentAttributeValue; use crate::error::{NtfsError, Result}; use crate::index_entry::{IndexNodeEntryRanges, NtfsIndexNodeEntries}; +use crate::indexes::NtfsIndexEntryType; use crate::record::Record; use crate::record::RecordHeader; use crate::traits::NtfsReadSeek; @@ -66,7 +67,10 @@ impl<'n> NtfsIndexRecord<'n> { Ok(index_record) } - pub fn entries<'r>(&'r self) -> Result<NtfsIndexNodeEntries<'r>> { + pub fn entries<'r, E>(&'r self) -> Result<NtfsIndexNodeEntries<'r, E>> + where + E: NtfsIndexEntryType, + { let (entries_range, position) = self.entries_range_and_position(); let data = &self.record.data()[entries_range]; @@ -104,7 +108,10 @@ impl<'n> NtfsIndexRecord<'n> { LittleEndian::read_u32(&self.record.data()[start..]) } - pub(crate) fn into_entry_ranges(self) -> IndexNodeEntryRanges { + pub(crate) fn into_entry_ranges<E>(self) -> IndexNodeEntryRanges<E> + where + E: NtfsIndexEntryType, + { let (entries_range, position) = self.entries_range_and_position(); IndexNodeEntryRanges::new(self.record.into_data(), entries_range, position) } |