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:
Diffstat (limited to 'src/file_reference.rs')
-rw-r--r--src/file_reference.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/file_reference.rs b/src/file_reference.rs
index 836bfbf..65b443f 100644
--- a/src/file_reference.rs
+++ b/src/file_reference.rs
@@ -7,6 +7,9 @@ use crate::ntfs::Ntfs;
use binread::io::{Read, Seek};
use binread::BinRead;
+/// Absolute reference to a File Record on the filesystem, composed out of a File Record Number and a Sequence Number.
+///
+/// Reference: <https://flatcap.github.io/linux-ntfs/ntfs/concepts/file_reference.html>
#[derive(BinRead, Clone, Copy, Debug)]
pub struct NtfsFileReference([u8; 8]);
@@ -15,10 +18,17 @@ impl NtfsFileReference {
Self(file_reference_bytes)
}
+ /// Returns the 48-bit File Record Number.
+ ///
+ /// This can be fed into [`Ntfs::file`] to create an [`NtfsFile`] object for the corresponding File Record
+ /// (if you cannot use [`Self::to_file`] for some reason).
pub fn file_record_number(&self) -> u64 {
u64::from_le_bytes(self.0) & 0xffff_ffff_ffff
}
+ /// Returns the 16-bit sequence number of the File Record.
+ ///
+ /// In a consistent file system, this number matches what [`NtfsFile::sequence_number`] returns.
pub fn sequence_number(&self) -> u16 {
(u64::from_le_bytes(self.0) >> 48) as u16
}