Dump USA, USN and LSN for index records
parent
422725fce4
commit
63b431150e
|
@ -30,8 +30,9 @@ xx/xx/2006 - 1.13.1-WIP
|
||||||
- Change ntfsinfo to dump the key data as well as the keys themselves
|
- Change ntfsinfo to dump the key data as well as the keys themselves
|
||||||
when dumping the $ObjId/$O index. (Anton)
|
when dumping the $ObjId/$O index. (Anton)
|
||||||
- ntfsinfo: dump either a minimal (default) or the entire attribute
|
- ntfsinfo: dump either a minimal (default) or the entire attribute
|
||||||
header (--verbose) for all attributes types. Also removed a lot of
|
header (--verbose) for all attribute types. Dump USA, USN and LSN
|
||||||
redundant code and made some formatting corrections. (Szaka)
|
for index records. Removed a lot of redundant code, made some
|
||||||
|
formatting and stylistic corrections. (Szaka)
|
||||||
- libntfs: add ntfs_str2ucs(), ntfs_freeucs(), ntfs_mft_usn_dec()
|
- libntfs: add ntfs_str2ucs(), ntfs_freeucs(), ntfs_mft_usn_dec()
|
||||||
and ntfs_inode_badclus_bad() functions, and convert all copy-pastes
|
and ntfs_inode_badclus_bad() functions, and convert all copy-pastes
|
||||||
to use them. (Szaka)
|
to use them. (Szaka)
|
||||||
|
|
|
@ -1366,7 +1366,6 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type)
|
||||||
numb_entries++;
|
numb_entries++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ntfs_log_verbose("\n");
|
|
||||||
ntfs_log_verbose("\t\tEntry length:\t\t %u\n",
|
ntfs_log_verbose("\t\tEntry length:\t\t %u\n",
|
||||||
le16_to_cpu(entry->length));
|
le16_to_cpu(entry->length));
|
||||||
ntfs_log_verbose("\t\tKey length:\t\t %u\n",
|
ntfs_log_verbose("\t\tKey length:\t\t %u\n",
|
||||||
|
@ -1400,6 +1399,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type)
|
||||||
entry = (INDEX_ENTRY *)((u8 *)entry +
|
entry = (INDEX_ENTRY *)((u8 *)entry +
|
||||||
le16_to_cpu(entry->length));
|
le16_to_cpu(entry->length));
|
||||||
numb_entries++;
|
numb_entries++;
|
||||||
|
ntfs_log_verbose("\n");
|
||||||
}
|
}
|
||||||
ntfs_log_verbose("\tEnd of index block reached\n");
|
ntfs_log_verbose("\tEnd of index block reached\n");
|
||||||
return numb_entries;
|
return numb_entries;
|
||||||
|
@ -1515,11 +1515,23 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr, ntfs_inode *ni)
|
||||||
|
|
||||||
entry = (INDEX_ENTRY *)((u8 *)index_root +
|
entry = (INDEX_ENTRY *)((u8 *)index_root +
|
||||||
le32_to_cpu(index_root->index.entries_offset) + 0x10);
|
le32_to_cpu(index_root->index.entries_offset) + 0x10);
|
||||||
ntfs_log_verbose("\tDumping index block:");
|
ntfs_log_verbose("\tDumping index block:\n");
|
||||||
printf("\tIndex entries total:\t %d\n",
|
printf("\tIndex entries total:\t %d\n",
|
||||||
ntfs_dump_index_entries(entry, type));
|
ntfs_dump_index_entries(entry, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ntfs_dump_usa_lsn(const char *indent, MFT_RECORD *mrec)
|
||||||
|
{
|
||||||
|
printf("%sUpd. Seq. Array Offset:\t %hu\n", indent,
|
||||||
|
le16_to_cpu(mrec->usa_ofs));
|
||||||
|
printf("%sUpd. Seq. Array Count: \t %hu\n", indent,
|
||||||
|
le16_to_cpu(mrec->usa_count));
|
||||||
|
printf("%sUpd. Seq. Number:\t %hu\n", indent,
|
||||||
|
*(u16 *)((u8 *)mrec + le16_to_cpu(mrec->usa_ofs)));
|
||||||
|
printf("%sLogFile Seq. Number:\t 0x%llx\n", indent,
|
||||||
|
(long long int)sle64_to_cpu(mrec->lsn));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ntfs_dump_attr_index_allocation()
|
* ntfs_dump_attr_index_allocation()
|
||||||
*
|
*
|
||||||
|
@ -1565,7 +1577,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
|
||||||
|
|
||||||
bit = 0;
|
bit = 0;
|
||||||
while ((u8 *)tmp_alloc < (u8 *)allocation + data_size) {
|
while ((u8 *)tmp_alloc < (u8 *)allocation + data_size) {
|
||||||
if (*byte & (1 << bit)) {
|
if (*byte & (1 << bit)) {
|
||||||
if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc,
|
if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc,
|
||||||
index_root->index_block_size)) {
|
index_root->index_block_size)) {
|
||||||
ntfs_log_perror("Damaged INDX record");
|
ntfs_log_perror("Damaged INDX record");
|
||||||
|
@ -1573,13 +1585,18 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
|
||||||
}
|
}
|
||||||
entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu(
|
entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu(
|
||||||
tmp_alloc->index.entries_offset) + 0x18);
|
tmp_alloc->index.entries_offset) + 0x18);
|
||||||
ntfs_log_verbose("\tDumping index block "
|
ntfs_log_verbose("\tDumping index block (VCN %lld, "
|
||||||
"(VCN %lld, used %u/%u):", le64_to_cpu(
|
"used %u/%u):\n", le64_to_cpu(
|
||||||
tmp_alloc->index_block_vcn),
|
tmp_alloc->index_block_vcn),
|
||||||
(unsigned int)le32_to_cpu(tmp_alloc->
|
(unsigned int)le32_to_cpu(tmp_alloc->
|
||||||
index.index_length), (unsigned int)
|
index.index_length), (unsigned int)
|
||||||
le32_to_cpu(tmp_alloc->index.
|
le32_to_cpu(tmp_alloc->index.
|
||||||
allocated_size));
|
allocated_size));
|
||||||
|
if (opts.verbose) {
|
||||||
|
ntfs_dump_usa_lsn("\t\t",
|
||||||
|
(MFT_RECORD *)tmp_alloc);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
total_entries += ntfs_dump_index_entries(entry, type);
|
total_entries += ntfs_dump_index_entries(entry, type);
|
||||||
total_indx_blocks++;
|
total_indx_blocks++;
|
||||||
}
|
}
|
||||||
|
@ -1803,22 +1820,15 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode)
|
||||||
|
|
||||||
printf("Dumping Inode #%llu\n",(long long)inode->mft_no);
|
printf("Dumping Inode #%llu\n",(long long)inode->mft_no);
|
||||||
|
|
||||||
printf("Update Sequence Offset:\t\t %hu\n",
|
ntfs_dump_usa_lsn("", inode->mrec);
|
||||||
le16_to_cpu(inode->mrec->usa_ofs));
|
printf("MFT Record Seq. Number:\t %hu\n",
|
||||||
printf("Update Sequence Array Count:\t %hu\n",
|
|
||||||
le16_to_cpu(inode->mrec->usa_count));
|
|
||||||
printf("Update Sequence Number:\t\t %hu\n",
|
|
||||||
*(u16*)((u8*)inode->mrec + le16_to_cpu(inode->mrec->usa_ofs)));
|
|
||||||
printf("$LogFile Sequence Number:\t 0x%llx\n",
|
|
||||||
(signed long long int)sle64_to_cpu(inode->mrec->lsn));
|
|
||||||
printf("MFT Record Sequence Number:\t %hu\n",
|
|
||||||
(short unsigned int)le16_to_cpu(inode->mrec->sequence_number));
|
(short unsigned int)le16_to_cpu(inode->mrec->sequence_number));
|
||||||
printf("Number of hard links:\t\t %hu\n",
|
printf("Number of Hard Links:\t %hu\n",
|
||||||
le16_to_cpu(inode->mrec->link_count));
|
le16_to_cpu(inode->mrec->link_count));
|
||||||
printf("First attribute offset:\t\t %hu\n",
|
printf("Attribute Offset:\t %hu\n",
|
||||||
le16_to_cpu(inode->mrec->attrs_offset));
|
le16_to_cpu(inode->mrec->attrs_offset));
|
||||||
|
|
||||||
printf("MFT record Flags:\t\t ");
|
printf("MFT Record Flags:\t ");
|
||||||
if (inode_flags) {
|
if (inode_flags) {
|
||||||
if (MFT_RECORD_IN_USE & inode_flags) {
|
if (MFT_RECORD_IN_USE & inode_flags) {
|
||||||
printf("IN_USE ");
|
printf("IN_USE ");
|
||||||
|
@ -1844,16 +1854,16 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Size - Used:\t\t\t %u bytes\n",
|
printf("Bytes Used:\t\t %u bytes\n",
|
||||||
(unsigned int)le32_to_cpu(inode->mrec->bytes_in_use));
|
(unsigned int)le32_to_cpu(inode->mrec->bytes_in_use));
|
||||||
printf("Size - Allocated:\t\t %u bytes\n",
|
printf("Bytes Allocated:\t %u bytes\n",
|
||||||
(unsigned int)le32_to_cpu(inode->mrec->bytes_allocated));
|
(unsigned int)le32_to_cpu(inode->mrec->bytes_allocated));
|
||||||
|
|
||||||
if (inode->mrec->base_mft_record) {
|
if (inode->mrec->base_mft_record) {
|
||||||
printf("base MFT record:\t\t %llu\n",
|
printf("Base MFT Record:\t %llu\n",
|
||||||
MREF_LE(inode->mrec->base_mft_record));
|
MREF_LE(inode->mrec->base_mft_record));
|
||||||
}
|
}
|
||||||
printf("Next Attribute Instance:\t %hu\n",
|
printf("Next Attribute Instance: %hu\n",
|
||||||
le16_to_cpu(inode->mrec->next_attr_instance));
|
le16_to_cpu(inode->mrec->next_attr_instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue