ntfscp.c: fix bug intoduced by Anton in changeset 1.21

ntfsinfo: more info on index dumping
dir.c, layout.h: minor fixes
edge.strict_endians
cha0smaster 2005-07-25 22:05:27 +00:00
parent 61ee94dfb2
commit 0de66be9c0
4 changed files with 19 additions and 5 deletions

View File

@ -2221,7 +2221,7 @@ typedef struct {
// follows the INDEX_ENTRY_HEADER. Regardless of
// key_length, the address of the 8-byte boundary
// aligned vcn of INDEX_ENTRY{_HEADER} *ie is given by
// (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN),
// (char*)ie + le16_to_cpu(ie->length) - sizeof(VCN),
// where sizeof(VCN) can be hardcoded as 8 if wanted. */
} __attribute__ ((__packed__)) INDEX_ENTRY;

View File

@ -938,7 +938,7 @@ find_next_index_buffer:
}
}
Dprintf("Handling index block 0x%llx.", (long long)bmp_pos);
Dprintf("Handling index block 0x%llx.\n", (long long)bmp_pos);
/* Read the index block starting at bmp_pos. */
br = ntfs_attr_mst_pread(ia_na, bmp_pos << index_block_size_bits, 1,

View File

@ -262,7 +262,7 @@ int main (int argc, char *argv[])
u64 offset;
char *buf;
s64 br, bw;
ntfschar *attr_name = AT_UNNAMED;
ntfschar *attr_name;
int attr_name_len = 0;
if (!parse_options(argc, argv))
@ -363,12 +363,14 @@ int main (int argc, char *argv[])
}
if (opts.attr_name) {
attr_name = NULL;
attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0);
if (attr_name_len == -1) {
perror("ERROR: Failed to parse attribute name");
goto close_dst;
}
}
} else
attr_name = AT_UNNAMED;
na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len);
if (!na) {
if (errno != ENOENT) {
@ -383,6 +385,8 @@ int main (int argc, char *argv[])
goto close_dst;
}
}
if (attr_name != AT_UNNAMED)
free(attr_name);
Vprintf("Old file size: %lld\n", na->data_size);
if (na->data_size != new_size) {

View File

@ -1086,7 +1086,6 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type)
int numb_entries = 1;
char *name = NULL;
Vprintf("\tDumping index entries:");
while(1) {
if (!opts.verbose) {
if (entry->flags & INDEX_ENTRY_END)
@ -1103,6 +1102,10 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type)
le16_to_cpu(entry->key_length));
Vprintf("\t\tFlags:\t\t\t 0x%02x\n", le16_to_cpu(entry->flags));
if (entry->flags & INDEX_ENTRY_NODE)
Vprintf("\t\tSubnode VCN:\t\t %lld\n", le64_to_cpu(
*((u8*)entry + le16_to_cpu(
entry->length) - sizeof(VCN))));
if (entry->flags & INDEX_ENTRY_END)
break;
@ -1224,6 +1227,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr)
entry = (INDEX_ENTRY *)((u8 *)index_root +
le32_to_cpu(index_root->index.entries_offset) + 0x10);
Vprintf("\tDumping index block:");
printf("\tIndex entries total:\t %d\n",
ntfs_dump_index_entries(entry, index_root->type));
}
@ -1344,6 +1348,12 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
}
entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu(
tmp_alloc->index.entries_offset) + 0x18);
Vprintf("\tDumping index block "
"(VCN %lld, used %u/%u):", le64_to_cpu(
tmp_alloc->index_block_vcn),
le32_to_cpu(tmp_alloc->index.
index_length), le32_to_cpu(tmp_alloc->
index.allocated_size));
total_entries += ntfs_dump_index_entries(entry, type);
total_indx_blocks++;
}