Struct ntfs::structured_values::NtfsFileName
source · pub struct NtfsFileName { /* private fields */ }
Expand description
Structure of a $FILE_NAME attribute.
NTFS creates a $FILE_NAME attribute for every hard link.
Its valuable information is the actual file name and whether this file represents a directory.
Apart from that, it duplicates several fields of $STANDARD_INFORMATION, but these are only updated when the file name changes.
You usually want to use the corresponding fields from NtfsStandardInformation
instead.
A $FILE_NAME attribute can be resident or non-resident.
Reference: https://flatcap.github.io/linux-ntfs/ntfs/attributes/file_name.html
Implementations§
source§impl NtfsFileName
impl NtfsFileName
sourcepub fn access_time(&self) -> NtfsTime
pub fn access_time(&self) -> NtfsTime
Returns the last access time stored in this $FILE_NAME record.
Note that NTFS only updates it when the file name is changed!
Check NtfsStandardInformation::access_time
for a last access time that is always up to date.
sourcepub fn allocated_size(&self) -> u64
pub fn allocated_size(&self) -> u64
Returns the allocated size of the file data, in bytes. “Data” refers to the unnamed $DATA attribute only. Other $DATA attributes are not considered.
Note that NTFS only updates it when the file name is changed!
If you need an always up-to-date allocated size, use NtfsFile::data
to get the unnamed $DATA attribute,
fetch the corresponding NtfsAttribute
, and use NtfsAttribute::value
to fetch the corresponding
NtfsAttributeValue
.
For non-resident attribute values, you now need to walk through each Data Run and sum up the return values of
NtfsDataRun::allocated_size
.
For resident attribute values, the length equals the allocated size.
sourcepub fn creation_time(&self) -> NtfsTime
pub fn creation_time(&self) -> NtfsTime
Returns the creation time stored in this $FILE_NAME record.
Note that NTFS only updates it when the file name is changed!
Check NtfsStandardInformation::creation_time
for a creation time that is always up to date.
sourcepub fn data_size(&self) -> u64
pub fn data_size(&self) -> u64
Returns the size actually used by the file data, in bytes.
“Data” refers to the unnamed $DATA attribute only. Other $DATA attributes are not considered.
This is less or equal than NtfsFileName::allocated_size
.
Note that NTFS only updates it when the file name is changed!
If you need an always up-to-date size, use NtfsFile::data
to get the unnamed $DATA attribute,
fetch the corresponding NtfsAttribute
, and use NtfsAttribute::value
to fetch the corresponding
NtfsAttributeValue
.
Then query NtfsAttributeValue::len
.
sourcepub fn file_attributes(&self) -> NtfsFileAttributeFlags
pub fn file_attributes(&self) -> NtfsFileAttributeFlags
Returns flags that a user can set for a file (Read-Only, Hidden, System, Archive, etc.). Commonly called “File Attributes” in Windows Explorer.
Note that NTFS only updates it when the file name is changed!
Check NtfsStandardInformation::file_attributes
for file attributes that are always up to date.
sourcepub fn is_directory(&self) -> bool
pub fn is_directory(&self) -> bool
Returns whether this file is a directory.
sourcepub fn mft_record_modification_time(&self) -> NtfsTime
pub fn mft_record_modification_time(&self) -> NtfsTime
Returns the MFT record modification time stored in this $FILE_NAME record.
Note that NTFS only updates it when the file name is changed!
Check NtfsStandardInformation::mft_record_modification_time
for an MFT record modification time that is always up to date.
sourcepub fn modification_time(&self) -> NtfsTime
pub fn modification_time(&self) -> NtfsTime
Returns the modification time stored in this $FILE_NAME record.
Note that NTFS only updates it when the file name is changed!
Check NtfsStandardInformation::modification_time
for a modification time that is always up to date.
sourcepub fn name_length(&self) -> usize
pub fn name_length(&self) -> usize
Returns the file name length, in bytes.
A file name has a maximum length of 255 UTF-16 code points (510 bytes).
sourcepub fn namespace(&self) -> NtfsFileNamespace
pub fn namespace(&self) -> NtfsFileNamespace
Returns the NtfsFileNamespace
of this file name.
sourcepub fn parent_directory_reference(&self) -> NtfsFileReference
pub fn parent_directory_reference(&self) -> NtfsFileReference
Returns an NtfsFileReference
for the directory where this file is located.
Trait Implementations§
source§impl Clone for NtfsFileName
impl Clone for NtfsFileName
source§fn clone(&self) -> NtfsFileName
fn clone(&self) -> NtfsFileName
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NtfsFileName
impl Debug for NtfsFileName
source§impl NtfsIndexEntryKey for NtfsFileName
impl NtfsIndexEntryKey for NtfsFileName
fn key_from_slice(slice: &[u8], position: NtfsPosition) -> Result<Self>
source§impl<'n, 'f> NtfsStructuredValue<'n, 'f> for NtfsFileName
impl<'n, 'f> NtfsStructuredValue<'n, 'f> for NtfsFileName
const TY: NtfsAttributeType = NtfsAttributeType::FileName
source§fn from_attribute_value<T>(
fs: &mut T,
value: NtfsAttributeValue<'n, 'f>
) -> Result<Self>where
T: Read + Seek,
fn from_attribute_value<T>( fs: &mut T, value: NtfsAttributeValue<'n, 'f> ) -> Result<Self>where T: Read + Seek,
NtfsAttributeValue
.