From ddeee65b8d8c506ca9fcebd45abbafd7a455d52a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH] Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- ChangeLog | 4 +- ntfsprogs/dumplog.c | 37 ++++++++------ ntfsprogs/mkntfs.c | 21 +++++--- ntfsprogs/ntfsdump_logfile.c | 37 ++++++++------ ntfsprogs/ntfsinfo.c | 94 ++++++++++++++++++++---------------- ntfsprogs/ntfsls.c | 12 +++-- ntfsprogs/ntfstruncate.c | 26 ++++++---- ntfsprogs/ntfsundelete.h | 8 +-- 8 files changed, 142 insertions(+), 97 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83329b69..91e6f787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,7 +36,9 @@ xx/xx/2004 - 1.8.6-WIP - Make the device fd in unix_io.c be stored in malloc()ed space pointed to by the d_private pointer instead of inside the d_private pointer itself. Makes the warnings on 64 bit architectures go away. - + - Fix all occurences of printf with %ll length modifiers but 64 bit + arguments to typecast the arguments to (unsigned) long long to avoid + the warnings when compiling on 64 bit architectures. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index a97a2039..e48c92bf 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -159,12 +159,14 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", + (unsigned long long)sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -175,8 +177,9 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), - sle64_to_cpu(rr->file_size)); + printf("FileSize = %lld (0x%llx)\n", + (long long)sle64_to_cpu(rr->file_size), + (unsigned long long)sle64_to_cpu(rr->file_size)); printf("LastLsnDataLength = 0x%x\n", le32_to_cpu(rr->last_lsn_data_length)); printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); @@ -184,12 +187,14 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", + printf("OldestLsn = 0x%llx\n", (unsigned long long) + sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", (unsigned long long) + le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -228,14 +233,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%llx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%llx\n", + printf("header.next_record_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", + printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -245,10 +250,11 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", + printf("this lsn = 0x%llx\n", + (unsigned long long)le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", + printf("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -285,11 +291,12 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2576a431..e4c82ad3 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -776,7 +776,8 @@ static void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %lli (0x%llx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->highest_vcn); printf("Highest VCN = %lli (0x%llx)\n", l, l); printf("Mapping pairs array offset = 0x%x\n", @@ -787,14 +788,18 @@ static void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %lli (0x%llx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->data_size); - printf("Data size = %lli (0x%llx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %lli (0x%llx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", + (long long)l, (unsigned long long)l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %lli (0x%llx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", + (long long)l, (unsigned long long)l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -912,7 +917,8 @@ static void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", + (unsigned long long)le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -932,7 +938,8 @@ static void dump_mft_record(MFT_RECORD *m) printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); printf("Base mft record reference:\n\tMft record number = %llu\n\t" - "Sequence number = %u\n", MREF(r), MSEQNO(r)); + "Sequence number = %u\n", (unsigned long long)MREF(r), + MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 2315cb78..b12587a3 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -209,12 +209,14 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", + (unsigned long long)sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -225,8 +227,9 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), - sle64_to_cpu(rr->file_size)); + printf("FileSize = %lld (0x%llx)\n", + (long long)sle64_to_cpu(rr->file_size), + (unsigned long long)sle64_to_cpu(rr->file_size)); if (sle64_to_cpu(rr->file_size) != l) puts("$LogFile restart area indicates a log file size" "different from the actual size!"); @@ -237,12 +240,14 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", + printf("OldestLsn = 0x%llx\n", (unsigned long long) + sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", (unsigned long long) + le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -281,14 +286,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%llx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%llx\n", + printf("header.next_record_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", + printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -298,10 +303,11 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", + printf("this lsn = 0x%llx\n", + (unsigned long long)le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", + printf("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -338,11 +344,12 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 34dc9e05..d6ef6537 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -254,27 +254,31 @@ void ntfs_dump_volume(ntfs_volume *vol) printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); printf("\tSector Size: %hu\n", vol->sector_size); printf("\tCluster Size: %u\n", vol->cluster_size); - printf("\tVolume Size in Clusters: %lld\n", vol->nr_clusters); - + printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); printf("MFT Information \n"); printf("\tMFT Record Size: %u\n", vol->mft_record_size); printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); - printf("\tMFT Data Position: %lld\n", vol->mft_data_pos); - printf("\tMFT Zone Start: %lld\n", vol->mft_zone_start); - printf("\tMFT Zone End: %lld\n", vol->mft_zone_end); - printf("\tMFT Zone Position: %lld\n", vol->mft_zone_pos); - printf("\tCurrent Position in First Data Zone: %lld\n", vol->data1_zone_pos); - printf("\tCurrent Position in Second Data Zone: %lld\n", vol->data2_zone_pos); - printf("\tNumber of Records in MFT: %lld\n", vol->nr_mft_records); - printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", vol->mft_lcn); + printf("\tMFT Data Position: %lld\n", (long long)vol->mft_data_pos); + printf("\tMFT Zone Start: %lld\n", (long long)vol->mft_zone_start); + printf("\tMFT Zone End: %lld\n", (long long)vol->mft_zone_end); + printf("\tMFT Zone Position: %lld\n", (long long)vol->mft_zone_pos); + printf("\tCurrent Position in First Data Zone: %lld\n", + (long long)vol->data1_zone_pos); + printf("\tCurrent Position in Second Data Zone: %lld\n", + (long long)vol->data2_zone_pos); + printf("\tNumber of Records in MFT: %lld\n", + (long long)vol->nr_mft_records); + printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", + (long long)vol->mft_lcn); printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); - printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", vol->mftmirr_lcn); + printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", + (long long)vol->mftmirr_lcn); printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); - printf("FILE_Bitmap Information \n"); - printf("\tFILE_Bitmap MFT Record Number: %lld\n", vol->lcnbmp_ni->mft_no); + printf("\tFILE_Bitmap MFT Record Number: %llu\n", + (unsigned long long)vol->lcnbmp_ni->mft_no); printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); @@ -284,26 +288,30 @@ void ntfs_dump_volume(ntfs_volume *vol) printf("FILE_Bitmap Data Attribute Information\n"); printf("\tDecompressed Runlist: not done yet\n"); - printf("\tBase Inode: %lld\n", vol->lcnbmp_na->ni->mft_no); + printf("\tBase Inode: %llu\n", + (unsigned long long)vol->lcnbmp_na->ni->mft_no); printf("\tAttribute Types: not done yet\n"); //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); - printf("\tAttribute Allocated Size: %lld\n", vol->lcnbmp_na->allocated_size); - printf("\tAttribute Data Size: %lld\n", vol->lcnbmp_na->data_size); - printf("\tAttribute Initialized Size: %lld\n", vol->lcnbmp_na->initialized_size); - printf("\tAttribute Compressed Size: %lld\n", vol->lcnbmp_na->compressed_size); - printf("\tCompression Block Size: %u\n", vol->lcnbmp_na->compression_block_size); - printf("\tCompression Block Size Bits: %u\n", vol->lcnbmp_na->compression_block_size_bits); - printf("\tCompression Block Clusters: %u\n", vol->lcnbmp_na->compression_block_clusters); - + printf("\tAttribute Allocated Size: %lld\n", + (long long)vol->lcnbmp_na->allocated_size); + printf("\tAttribute Data Size: %lld\n", + (long long)vol->lcnbmp_na->data_size); + printf("\tAttribute Initialized Size: %lld\n", + (long long)vol->lcnbmp_na->initialized_size); + printf("\tAttribute Compressed Size: %lld\n", + (long long)vol->lcnbmp_na->compressed_size); + printf("\tCompression Block Size: %u\n", + vol->lcnbmp_na->compression_block_size); + printf("\tCompression Block Size Bits: %u\n", + vol->lcnbmp_na->compression_block_size_bits); + printf("\tCompression Block Clusters: %u\n", + vol->lcnbmp_na->compression_block_clusters); //TODO: Still need to add a few more attributes - } - - /** * ntfs_dump_standard_information */ @@ -336,25 +344,25 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) not been upgraded\n"); } if (sizeof(STANDARD_INFORMATION) == 72) { - printf("\tMaximum Number of Versions: \t %d \n", le32_to_cpu (standard_attr->maximum_versions)); - printf("\tVersion Number: \t\t %d \n", le32_to_cpu (standard_attr->version_number)); - printf("\tClass ID: \t\t\t %d \n", le32_to_cpu (standard_attr->class_id)); - printf("\tUser ID: \t\t\t %d \n", le32_to_cpu (standard_attr->owner_id)); - printf("\tSecurity ID: \t\t\t %d \n", le32_to_cpu (standard_attr->security_id)); + printf("\tMaximum Number of Versions: \t %u \n", + le32_to_cpu(standard_attr->maximum_versions)); + printf("\tVersion Number: \t\t %u \n", + le32_to_cpu(standard_attr->version_number)); + printf("\tClass ID: \t\t\t %u \n", + le32_to_cpu(standard_attr->class_id)); + printf("\tUser ID: \t\t\t %u \n", + le32_to_cpu (standard_attr->owner_id)); + printf("\tSecurity ID: \t\t\t %u \n", + le32_to_cpu(standard_attr->security_id)); + } else { + printf("\tSize of STANDARD_INFORMATION is %u. It should be either 72 or 48, \ + something is wrong...\n", sizeof(STANDARD_INFORMATION)); } - else { - printf("\tSize of STANDARD_INFORMATION is %d. It should be either 72 or 48, \ - something is wrong...\n",sizeof(STANDARD_INFORMATION)); - } - - ntfs_attr_put_search_ctx(ctx); //free ctx } - - /** * ntfs_dump_file_name_attribute */ @@ -385,10 +393,12 @@ do_next: printf("Dumping $FILE_NAME (0x30)\n"); //basic stuff about the file - printf("\tFile Name: \t\t %s\n",file_name); - printf("\tFile Name Length: \t %d\n",file_name_attr->file_name_length); - printf("\tAllocated File Size: \t %lld\n", sle64_to_cpu(file_name_attr->allocated_size)); - printf("\tReal File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); + printf("\tFile Name: \t\t %s\n", file_name); + printf("\tFile Name Length: \t %d\n", file_name_attr->file_name_length); + printf("\tAllocated File Size: \t %lld\n", + (long long)sle64_to_cpu(file_name_attr->allocated_size)); + printf("\tReal File Size: \t %lld\n", + (long long)sle64_to_cpu(file_name_attr->data_size)); //time conversion stuff if (!opts.notime) { diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 7c77270e..9e2a186d 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -260,7 +260,8 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, if (!opts.inode) printf("%s\n", filename); else - printf("%7lld %s\n", MREF(mref), filename); + printf("%7llu %s\n", (unsigned long long)MREF(mref), + filename); result = 0; } else { s64 filesize = 0; @@ -304,10 +305,13 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, } if (opts.inode) - printf("%7lld %8lld %s %s\n", MREF(mref), filesize, - t_buf + 4, filename); + printf("%7llu %8lld %s %s\n", + (unsigned long long)MREF(mref), + (long long)filesize, t_buf + 4, + filename); else - printf("%8lld %s %s\n", filesize, t_buf + 4, filename); + printf("%8lld %s %s\n", (long long)filesize, t_buf + 4, + filename); result = 0; release: diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index da4f79f0..9e6441b9 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -511,9 +511,11 @@ void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %lli (0x%llx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %lli (0x%llx)\n", l, l); + printf("Highest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); printf("Mapping pairs array offset = 0x%x\n", le16_to_cpu(a->mapping_pairs_offset)); printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, @@ -522,14 +524,18 @@ void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %lli (0x%llx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->data_size); - printf("Data size = %lli (0x%llx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %lli (0x%llx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %lli (0x%llx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -545,7 +551,7 @@ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) int i; printf("-- Beginning dump of attribute record at offset 0x%x. --\n", - (u8*)a - (u8*)m); + (unsigned)((u8*)a - (u8*)m)); if (a->type == AT_END) { printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); @@ -648,7 +654,8 @@ void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", + (unsigned long long)le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -668,7 +675,8 @@ void dump_mft_record(MFT_RECORD *m) printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); printf("Base mft record reference:\n\tMft record number = %llu\n\t" - "Sequence number = %u\n", MREF(r), MSEQNO(r)); + "Sequence number = %u\n", + (unsigned long long)MREF(r), MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 400c33d2..9378229c 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -50,10 +50,10 @@ struct options { int verbose; /* Extra output */ int force; /* Override common sense */ time_t since; /* Since this time */ - long long size_begin; /* Range for file size */ - long long size_end; - long long mft_begin; /* Range for mft copy */ - long long mft_end; + s64 size_begin; /* Range for file size */ + s64 size_end; + s64 mft_begin; /* Range for mft copy */ + s64 mft_end; }; struct filename {