Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Finck <colin@reactos.org>2021-06-05 17:01:57 +0300
committerColin Finck <colin@reactos.org>2021-06-05 17:01:57 +0300
commit6d174c7910237a592cf811ab5d406599130401d6 (patch)
tree3e6126a3d03b4a010aa43013e9f12351091a608e /src/index_entry.rs
parent4d4357d22497943e535fe16ca299d2ff6644f431 (diff)
Add `Lcn`, `Vcn` to simplify cluster calculations and make them typesafe
Diffstat (limited to 'src/index_entry.rs')
-rw-r--r--src/index_entry.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/index_entry.rs b/src/index_entry.rs
index f1a3ad3..98c2c7e 100644
--- a/src/index_entry.rs
+++ b/src/index_entry.rs
@@ -6,6 +6,7 @@ use crate::error::Result;
use crate::ntfs::Ntfs;
use crate::structured_values::NewNtfsStructuredValue;
use crate::traits::NtfsReadSeek;
+use crate::types::Vcn;
use binread::io::{Read, Seek, SeekFrom};
use binread::{BinRead, BinReaderExt};
use bitflags::bitflags;
@@ -99,7 +100,7 @@ where
/// Returns the Virtual Cluster Number (VCN) of the subnode of this Index Entry,
/// or `None` if this Index Entry has no subnode.
- pub fn subnode_vcn<T>(&self, fs: &mut T) -> Option<Result<u64>>
+ pub fn subnode_vcn<T>(&self, fs: &mut T) -> Option<Result<Vcn>>
where
T: Read + Seek,
{
@@ -110,9 +111,9 @@ where
// Read the subnode VCN from the very end of the Index Entry.
let mut value_attached = self.value.clone().attach(fs);
iter_try!(value_attached.seek(SeekFrom::Current(
- self.index_entry_length() as i64 - mem::size_of::<u64>() as i64
+ self.index_entry_length() as i64 - mem::size_of::<Vcn>() as i64
)));
- let vcn = iter_try!(value_attached.read_le::<u64>());
+ let vcn = iter_try!(value_attached.read_le::<Vcn>());
Some(Ok(vcn))
}