From 65f63fe2b36fe5f00923e062a743a52f7915b151 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Tue, 21 Mar 2017 11:55:41 +0100 Subject: [PATCH] Use signed endian conversion macros for signed little-endian members. --- ntfsprogs/ntfsrecover.c | 36 ++++++++--------- ntfsprogs/playlog.c | 88 ++++++++++++++++++++--------------------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c index 3bf175ad..957c0390 100644 --- a/ntfsprogs/ntfsrecover.c +++ b/ntfsprogs/ntfsrecover.c @@ -1322,7 +1322,7 @@ static void fixup(CONTEXT *ctx, const LOG_RECORD *logr, const char *buf, } printf(" new base MFT record, attr 0x%x (%s)\n",attr,attrname(attr)); printf(" inode %lld\n", - (((long long)le64_to_cpu(logr->target_vcn) + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); @@ -1371,7 +1371,7 @@ static void fixup(CONTEXT *ctx, const LOG_RECORD *logr, const char *buf, printf(" free base MFT record, attr 0x%x (%s)\n", attr,attrname(attr)); printf(" inode %lld\n", - (((long long)le64_to_cpu(logr->target_vcn) << clusterbits) + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); break; case CreateAttribute : /* 5 */ @@ -1880,20 +1880,20 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) (int)le16_to_cpu(logr->attribute_flags)); if (mftrecbits && onmft) printf("target_vcn %016llx (inode %lld)\n", - (long long)le64_to_cpu(logr->target_vcn), - (((long long)le64_to_cpu(logr->target_vcn) + (long long)sle64_to_cpu(logr->target_vcn), + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); else printf("target_vcn %016llx\n", - (long long)le64_to_cpu(logr->target_vcn)); + (long long)sle64_to_cpu(logr->target_vcn)); /* Compute a base for the current run of mft */ - baselcn = le64_to_cpu(logr->lcn_list[0]) - - le64_to_cpu(logr->target_vcn); + baselcn = sle64_to_cpu(logr->lcn_list[0]) + - sle64_to_cpu(logr->target_vcn); for (i=0; ilcns_to_follow) && (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); printf(" (%d offs 0x%x) lcn %016llx",i, (int)(8*i + sizeof(LOG_RECORD) - 8), (long long)lcn); @@ -1992,7 +1992,7 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) off = le16_to_cpu(logr->record_offset) + le16_to_cpu(logr->attribute_offset); printf("redo data (new data) cluster 0x%llx pos 0x%x :\n", - (long long)le64_to_cpu(logr->lcn_list[off + (long long)sle64_to_cpu(logr->lcn_list[off >> clusterbits]), (int)(off & (clustersz - 1))); } @@ -2021,7 +2021,7 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) off = le16_to_cpu(logr->record_offset) + le16_to_cpu(logr->attribute_offset); printf("undo data (old data) cluster 0x%llx pos 0x%x :\n", - (long long)le64_to_cpu(logr->lcn_list[off + (long long)sle64_to_cpu(logr->lcn_list[off >> clusterbits]), (int)(off & (clustersz - 1))); } @@ -2120,7 +2120,7 @@ BOOL within_lcn_range(const LOG_RECORD *logr) switch (logr->record_type) { case LOG_STANDARD : for (i=0; ilcns_to_follow); i++) { - lcn = MREF(le64_to_cpu(logr->lcn_list[i])); + lcn = MREF(sle64_to_cpu(logr->lcn_list[i])); if ((lcn >= firstlcn) && (lcn <= lastlcn)) within = TRUE; } @@ -2709,9 +2709,9 @@ static void showrest(const RESTART_PAGE_HEADER *rest) printf("restart_area_offset %04x\n", (int)le16_to_cpu(rest->restart_area_offset)); printf("minor_vers %d\n", - (int)le16_to_cpu(rest->minor_ver)); + (int)sle16_to_cpu(rest->minor_ver)); printf("major_vers %d\n", - (int)le16_to_cpu(rest->major_ver)); + (int)sle16_to_cpu(rest->major_ver)); printf("usn %04x\n", (int)le16_to_cpu(rest->usn)); printf("\n"); @@ -2740,7 +2740,7 @@ static void showrest(const RESTART_PAGE_HEADER *rest) printf("client_array_offset %04x\n", (int)le16_to_cpu(resa->client_array_offset)); printf("file_size %016llx\n", - (long long)le64_to_cpu(resa->file_size)); + (long long)sle64_to_cpu(resa->file_size)); printf("last_lsn_data_len %08lx\n", (long)le32_to_cpu(resa->last_lsn_data_length)); printf("record_length %04x\n", @@ -2945,8 +2945,8 @@ static const struct BUFFER *read_restart(CONTEXT *ctx) } if (!bad && !ctx->vol) dorest(ctx, 0, &buf->block.restart, TRUE); - major = le16_to_cpu(buf->block.restart.major_ver); - minor = le16_to_cpu(buf->block.restart.minor_ver); + major = sle16_to_cpu(buf->block.restart.major_ver); + minor = sle16_to_cpu(buf->block.restart.minor_ver); if ((major == 2) && (minor == 0)) { if (!optk) { printf("** Fast restart mode detected," @@ -2986,8 +2986,8 @@ static int reset_logfile(CONTEXT *ctx __attribute__((unused))) restart.flags |= RESTART_VOLUME_IS_CLEAN; client.oldest_lsn = cpu_to_sle64(restart_lsn); /* Set $LogFile version to 1.1 so that volume can be mounted */ - log_header.major_ver = const_cpu_to_le16(1); - log_header.minor_ver = const_cpu_to_le16(1); + log_header.major_ver = const_cpu_to_sle16(1); + log_header.minor_ver = const_cpu_to_sle16(1); memcpy(buffer, &log_header, sizeof(RESTART_PAGE_HEADER)); off = le16_to_cpu(log_header.restart_area_offset); diff --git a/ntfsprogs/playlog.c b/ntfsprogs/playlog.c index 8bc5cf2f..69584694 100644 --- a/ntfsprogs/playlog.c +++ b/ntfsprogs/playlog.c @@ -122,7 +122,7 @@ static u64 inode_number(const LOG_RECORD *logr) { u64 offset; - offset = ((u64)le64_to_cpu(logr->target_vcn) + offset = ((u64)sle64_to_cpu(logr->target_vcn) << clusterbits) + ((u32)le16_to_cpu(logr->cluster_index) << NTFS_BLOCK_SIZE_BITS); @@ -431,7 +431,7 @@ static char *read_raw(ntfs_volume *vol, const LOG_RECORD *logr) fail = FALSE; for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); target = buffer + clustersz*i; if (optn) { store = getclusterentry(lcn, FALSE); @@ -494,7 +494,7 @@ static int write_raw(ntfs_volume *vol, const LOG_RECORD *logr, printf("** Error : no lcn to write to\n"); if (optn) { for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); source = buffer + clustersz*i; store = getclusterentry(lcn, TRUE); if (store) { @@ -513,7 +513,7 @@ static int write_raw(ntfs_volume *vol, const LOG_RECORD *logr, } } else { for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); if (optv) printf("== lcn 0x%llx to device\n", (long long)lcn); @@ -549,7 +549,7 @@ static int write_mirr(ntfs_volume *vol, const LOG_RECORD *logr, if (!optn) { for (i=0; (imftmirr_na, - le64_to_cpu(logr->target_vcn) + i); + sle64_to_cpu(logr->target_vcn) + i); source = buffer + clustersz*i; if ((lcn < 0) || (ntfs_pwrite(vol->dev, lcn << clusterbits, @@ -594,7 +594,7 @@ static char *read_protected(ntfs_volume *vol, const LOG_RECORD *logr, if (buffer && (ntfs_mst_post_read_fixup_warn( (NTFS_RECORD*)buffer, size, FALSE) < 0)) { if (warn) { - lcn = le64_to_cpu(logr->lcn_list[0]); + lcn = sle64_to_cpu(logr->lcn_list[0]); printf("** Invalid protected record at 0x%llx" " index %d\n", (long long)lcn, @@ -642,14 +642,14 @@ static int write_protected(ntfs_volume *vol, const LOG_RECORD *logr, (long long)sle64_to_cpu(logr->this_lsn)); if (optv > 1) printf("mft vcn %lld index %d\n", - (long long)le64_to_cpu(logr->target_vcn), + (long long)sle64_to_cpu(logr->target_vcn), (int)le16_to_cpu(logr->cluster_index)); err = sanity_mft(buffer); /* Should set to some previous lsn for undos */ if (opts) record->lsn = logr->this_lsn; /* Duplicate on mftmirr if not overflowing its size */ - mftmirr = (((u64)le64_to_cpu(logr->target_vcn) + mftmirr = (((u64)sle64_to_cpu(logr->target_vcn) + le16_to_cpu(logr->lcns_to_follow)) << clusterbits) <= (((u64)vol->mftmirr_size) << mftrecbits); @@ -859,7 +859,7 @@ static int change_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, if (action->record.undo_length != action->record.redo_length) printf("** Error size change in change_resident\n"); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -913,7 +913,7 @@ static int change_resident_expect(ntfs_volume *vol, const struct ACTION_RECORD * if (action->record.undo_length != action->record.redo_length) printf("** Error size change in change_resident\n"); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -965,7 +965,7 @@ static int change_index_value(ntfs_volume *vol, const struct ACTION_RECORD *acti err = 1; count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1010,7 +1010,7 @@ static int add_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1092,7 +1092,7 @@ static int expand_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1175,7 +1175,7 @@ static int insert_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1257,7 +1257,7 @@ static int remove_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1343,7 +1343,7 @@ static int delete_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, printf("-> %s()\n",__func__); err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1403,7 +1403,7 @@ static int shrink_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, printf("-> %s()\n",__func__); err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1479,7 +1479,7 @@ static int update_index(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1787,7 +1787,7 @@ static int create_indx(ntfs_volume *vol, const struct ACTION_RECORD *action, indx->usa_ofs = const_cpu_to_le16(0x28); indx->usa_count = const_cpu_to_le16(9); indx->lsn = action->record.this_lsn; - vcn = le64_to_cpu(action->record.target_vcn); + vcn = sle64_to_cpu(action->record.target_vcn); /* beware of size change on big-endian cpus */ indx->index_block_vcn = cpu_to_sle64(vcn); /* INDEX_HEADER */ @@ -1866,7 +1866,7 @@ static int redo_add_index(ntfs_volume *vol, const struct ACTION_RECORD *action, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1929,7 +1929,7 @@ static int redo_add_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2007,7 +2007,7 @@ static int redo_create_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2105,7 +2105,7 @@ static int redo_delete_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2161,7 +2161,7 @@ static int redo_delete_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2220,7 +2220,7 @@ static int redo_delete_root_index(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2289,7 +2289,7 @@ static int redo_force_bits(ntfs_volume *vol, // TODO consistency undo_offset == redo_offset, etc. // firstbit + count < 8*clustersz (multiple clusters possible ?) if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx firstbit %d count %d wanted %d\n", (long long)lcn,(int)firstbit,(int)count,(int)wanted); } @@ -2476,7 +2476,7 @@ static int redo_update_mapping(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2567,7 +2567,7 @@ static int redo_update_resident(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -2688,7 +2688,7 @@ static int redo_update_value(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2775,7 +2775,7 @@ static int redo_write_end(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -2835,7 +2835,7 @@ static int redo_write_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2924,7 +2924,7 @@ static int undo_add_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2986,7 +2986,7 @@ static int undo_add_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3094,7 +3094,7 @@ static int undo_delete_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3160,7 +3160,7 @@ static int undo_delete_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3232,7 +3232,7 @@ static int undo_create_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3283,7 +3283,7 @@ static int undo_delete_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3359,7 +3359,7 @@ static int undo_force_bits(ntfs_volume *vol, // TODO consistency undo_offset == redo_offset, etc. // firstbit + count < 8*clustersz (multiple clusters possible ?) if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx firstbit %d count %d wanted %d\n", (long long)lcn,(int)firstbit,(int)count,(int)wanted); } @@ -3526,7 +3526,7 @@ static int undo_update_index_value(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3602,7 +3602,7 @@ static int undo_update_mapping(ntfs_volume *vol, const struct ACTION_RECORD *act target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x new length %d resize %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length, (int)resize); @@ -3694,7 +3694,7 @@ static int undo_update_resident(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3805,7 +3805,7 @@ static int undo_update_value(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3873,7 +3873,7 @@ static int undo_write_end(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -3940,7 +3940,7 @@ static int undo_write_index(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record),