Merge version 2016.2.22 into the strict endians branch.

Conflicts:
	libntfs-3g/volume.c
edge.strict_endians
Erik Larsson 2016-02-22 09:40:35 +01:00
commit c9b795489e
18 changed files with 82 additions and 72 deletions

View File

@ -24,8 +24,8 @@
# Autoconf
AC_PREREQ(2.59)
AC_INIT([ntfs-3g],[2015.3.14],[ntfs-3g-devel@lists.sf.net])
LIBNTFS_3G_VERSION="86"
AC_INIT([ntfs-3g],[2016.2.22],[ntfs-3g-devel@lists.sf.net])
LIBNTFS_3G_VERSION="87"
AC_CONFIG_SRCDIR([src/ntfs-3g.c])
# Environment

View File

@ -63,10 +63,16 @@
# define __BYTE_ORDER BYTE_ORDER
# define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __BIG_ENDIAN BIG_ENDIAN
# elif defined(__BYTE_ORDER__)
# elif defined(__BYTE_ORDER__) && defined(__LITTLE_ENDIAN__) && \
defined(__BIG_ENDIAN__)
# define __BYTE_ORDER __BYTE_ORDER__
# define __LITTLE_ENDIAN __LITTLE_ENDIAN__
# define __BIG_ENDIAN __BIG_ENDIAN__
# elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
defined(__ORDER_BIG_ENDIAN__)
# define __BYTE_ORDER __BYTE_ORDER__
# define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
# define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
# elif (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \
defined(WORDS_LITTLEENDIAN)
# define __BYTE_ORDER 1
@ -268,37 +274,37 @@
/* Constant endianness conversion defines. */
#define const_le16_to_cpu(x) __constant_le16_to_cpu(x)
#define const_le32_to_cpu(x) __constant_le32_to_cpu(x)
#define const_le64_to_cpu(x) __constant_le64_to_cpu(x)
#define const_le16_to_cpu(x) ((u16) __constant_le16_to_cpu(x))
#define const_le32_to_cpu(x) ((u32) __constant_le32_to_cpu(x))
#define const_le64_to_cpu(x) ((u64) __constant_le64_to_cpu(x))
#define const_cpu_to_le16(x) __constant_cpu_to_le16(x)
#define const_cpu_to_le32(x) __constant_cpu_to_le32(x)
#define const_cpu_to_le64(x) __constant_cpu_to_le64(x)
#define const_cpu_to_le16(x) ((le16) __constant_cpu_to_le16(x))
#define const_cpu_to_le32(x) ((le32) __constant_cpu_to_le32(x))
#define const_cpu_to_le64(x) ((le64) __constant_cpu_to_le64(x))
#define const_sle16_to_cpu(x) __constant_le16_to_cpu((le16) x)
#define const_sle32_to_cpu(x) __constant_le32_to_cpu((le32) x)
#define const_sle64_to_cpu(x) __constant_le64_to_cpu((le64) x)
#define const_sle16_to_cpu(x) ((s16) __constant_le16_to_cpu((le16) x))
#define const_sle32_to_cpu(x) ((s32) __constant_le32_to_cpu((le32) x))
#define const_sle64_to_cpu(x) ((s64) __constant_le64_to_cpu((le64) x))
#define const_cpu_to_sle16(x) __constant_cpu_to_le16((u16) x)
#define const_cpu_to_sle32(x) __constant_cpu_to_le32((u32) x)
#define const_cpu_to_sle64(x) __constant_cpu_to_le64((u64) x)
#define const_cpu_to_sle16(x) ((sle16) __constant_cpu_to_le16((u16) x))
#define const_cpu_to_sle32(x) ((sle32) __constant_cpu_to_le32((u32) x))
#define const_cpu_to_sle64(x) ((sle64) __constant_cpu_to_le64((u64) x))
#define const_be16_to_cpu(x) __constant_be16_to_cpu(x)
#define const_be32_to_cpu(x) __constant_be32_to_cpu(x)
#define const_be64_to_cpu(x) __constant_be64_to_cpu(x)
#define const_be16_to_cpu(x) ((u16) __constant_be16_to_cpu(x)))
#define const_be32_to_cpu(x) ((u32) __constant_be32_to_cpu(x)))
#define const_be64_to_cpu(x) ((u64) __constant_be64_to_cpu(x)))
#define const_cpu_to_be16(x) __constant_cpu_to_be16(x)
#define const_cpu_to_be32(x) __constant_cpu_to_be32(x)
#define const_cpu_to_be64(x) __constant_cpu_to_be64(x)
#define const_cpu_to_be16(x) ((be16) __constant_cpu_to_be16(x))
#define const_cpu_to_be32(x) ((be32) __constant_cpu_to_be32(x))
#define const_cpu_to_be64(x) ((be64) __constant_cpu_to_be64(x))
#define const_sbe16_to_cpu(x) __constant_be16_to_cpu((be16) x)
#define const_sbe32_to_cpu(x) __constant_be32_to_cpu((be32) x)
#define const_sbe64_to_cpu(x) __constant_be64_to_cpu((be64) x)
#define const_sbe16_to_cpu(x) ((s16) __constant_be16_to_cpu((be16) x))
#define const_sbe32_to_cpu(x) ((s32) __constant_be32_to_cpu((be32) x))
#define const_sbe64_to_cpu(x) ((s64) __constant_be64_to_cpu((be64) x))
#define const_cpu_to_sbe16(x) __constant_cpu_to_be16((u16) x)
#define const_cpu_to_sbe32(x) __constant_cpu_to_be32((u32) x)
#define const_cpu_to_sbe64(x) __constant_cpu_to_be64((u64) x)
#define const_cpu_to_sbe16(x) ((sbe16) __constant_cpu_to_be16((u16) x))
#define const_cpu_to_sbe32(x) ((sbe32) __constant_cpu_to_be32((u32) x))
#define const_cpu_to_sbe64(x) ((sbe64) __constant_cpu_to_be64((u64) x))
#define le16_eq(a, b) ((a) == (b))
@ -508,33 +514,33 @@ static inline sbe64 cpu_to_sbe64p(const s64 *x) {
/* Constant endianness conversion defines. */
#define const_le16_to_cpu(x) __constant_le16_to_cpu((u16)(x.value))
#define const_le32_to_cpu(x) __constant_le32_to_cpu((u32)(x.value))
#define const_le64_to_cpu(x) __constant_le64_to_cpu((u64)(x.value))
#define const_le16_to_cpu(x) ((u16) __constant_le16_to_cpu((u16)(x.value)))
#define const_le32_to_cpu(x) ((u32) __constant_le32_to_cpu((u32)(x.value)))
#define const_le64_to_cpu(x) ((u64) __constant_le64_to_cpu((u64)(x.value)))
#define const_cpu_to_le16(x) ((le16)(u16) __constant_cpu_to_le16((u16)(x)))
#define const_cpu_to_le32(x) ((le32) __constant_cpu_to_le32((u32)(x)))
#define const_cpu_to_le64(x) ((le64) __constant_cpu_to_le64((u64)(x)))
#define const_sle16_to_cpu(x) __constant_le16_to_cpu((u16)(x.value))
#define const_sle32_to_cpu(x) __constant_le32_to_cpu((u32)(x.value))
#define const_sle64_to_cpu(x) __constant_le64_to_cpu((u64)(x.value))
#define const_sle16_to_cpu(x) ((s16) __constant_le16_to_cpu((u16)(x.value)))
#define const_sle32_to_cpu(x) ((s32) __constant_le32_to_cpu((u32)(x.value)))
#define const_sle64_to_cpu(x) ((s64) __constant_le64_to_cpu((u64)(x.value)))
#define const_cpu_to_sle16(x) ((sle16)(u16) __constant_cpu_to_le16((u16)(x)))
#define const_cpu_to_sle32(x) ((sle32) __constant_cpu_to_le32((u32)(x)))
#define const_cpu_to_sle64(x) ((sle64) __constant_cpu_to_le64((u64)(x)))
#define const_be16_to_cpu(x) __constant_be16_to_cpu((u16)(x.value))
#define const_be32_to_cpu(x) __constant_be32_to_cpu((u32)(x.value))
#define const_be64_to_cpu(x) __constant_be64_to_cpu((u64)(x.value))
#define const_be16_to_cpu(x) ((u16) __constant_be16_to_cpu((u16)(x.value)))
#define const_be32_to_cpu(x) ((u32) __constant_be32_to_cpu((u32)(x.value)))
#define const_be64_to_cpu(x) ((s64) __constant_be64_to_cpu((u64)(x.value)))
#define const_cpu_to_be16(x) ((be16)(u16) __constant_cpu_to_be16((u16)(x)))
#define const_cpu_to_be32(x) ((be32) __constant_cpu_to_be32((u32)(x)))
#define const_cpu_to_be64(x) ((be64) __constant_cpu_to_be64((u64)(x)))
#define const_sbe16_to_cpu(x) __constant_be16_to_cpu((u16)(x.value))
#define const_sbe32_to_cpu(x) __constant_be32_to_cpu((u32)(x.value))
#define const_sbe64_to_cpu(x) __constant_be64_to_cpu((u64)(x.value))
#define const_sbe16_to_cpu(x) ((s16) __constant_be16_to_cpu((u16)(x.value)))
#define const_sbe32_to_cpu(x) ((s32) __constant_be32_to_cpu((u32)(x.value)))
#define const_sbe64_to_cpu(x) ((s64) __constant_be64_to_cpu((u64)(x.value)))
#define const_cpu_to_sbe16(x) ((sbe16)(u16) __constant_cpu_to_be16((u16)(x)))
#define const_cpu_to_sbe32(x) ((sbe32) __constant_cpu_to_be32((u32)(x)))

View File

@ -2373,7 +2373,8 @@ int ntfs_attr_pclose(ntfs_attr *na)
BOOL compressed;
ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x.\n",
na->ni->mft_no, le32_to_cpu(na->type));
(unsigned long long)na->ni->mft_no,
le32_to_cpu(na->type));
if (!na || !na->ni || !na->ni->vol) {
errno = EINVAL;

View File

@ -321,8 +321,8 @@ int ntfs_set_efs_info(ntfs_inode *ni, const char *value, size_t size,
int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
{
u64 newsize;
u64 oldsize;
s64 newsize;
s64 oldsize;
le16 appended_bytes;
u16 padding_length;
ntfs_inode *ni;

View File

@ -554,7 +554,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni)
"data_pos 0x%llx, bit 0x%llx, "
"*byte 0x%hhx, b %u.\n", size,
(long long)data_pos, (long long)bit,
byte ? *byte : -1, b);
(u8) (byte ? *byte : -1), b);
for (; bit < size && data_pos + bit < pass_end;
bit &= ~7ull, bit += 8) {
/*
@ -581,7 +581,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni)
"data_pos 0x%llx, bit 0x%llx, "
"*byte 0x%hhx, b %u.\n", size,
(long long)data_pos, (long long)bit,
byte ? *byte : -1, b);
(u8) (byte ? *byte : -1), b);
data_pos += size;
/*
* If the end of the pass has not been reached yet,

View File

@ -964,13 +964,13 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
mrec = (MFT_RECORD*)(m + i * vol->mft_record_size);
if (!le16_andz(mrec->flags, MFT_RECORD_IN_USE)) {
if (ntfs_is_baad_recordp(&mrec->magic)) {
if (ntfs_is_baad_record(mrec->magic)) {
ntfs_log_error("$MFT error: Incomplete multi "
"sector transfer detected in "
"'%s'.\n", s);
goto io_error_exit;
}
if (!ntfs_is_mft_recordp(&mrec->magic)) {
if (!ntfs_is_mft_record(mrec->magic)) {
ntfs_log_error("$MFT error: Invalid mft "
"record for '%s'.\n", s);
goto io_error_exit;
@ -978,13 +978,13 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
}
mrec2 = (MFT_RECORD*)(m2 + i * vol->mft_record_size);
if (!le16_andz(mrec2->flags, MFT_RECORD_IN_USE)) {
if (ntfs_is_baad_recordp(&mrec2->magic)) {
if (ntfs_is_baad_record(mrec2->magic)) {
ntfs_log_error("$MFTMirr error: Incomplete "
"multi sector transfer "
"detected in '%s'.\n", s);
goto io_error_exit;
}
if (!ntfs_is_mft_recordp(&mrec2->magic)) {
if (!ntfs_is_mft_record(mrec2->magic)) {
ntfs_log_error("$MFTMirr error: Invalid mft "
"record for '%s'.\n", s);
goto io_error_exit;

View File

@ -3704,7 +3704,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
(long long)(volume_size / 1024));
return FALSE;
}
ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024);
ntfs_log_debug("volume size = %llikiB\n",
(long long)(volume_size / 1024));
/* If user didn't specify the cluster size, determine it now. */
if (!vol->cluster_size) {
/*
@ -3789,7 +3790,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
return FALSE;
}
ntfs_log_debug("number of clusters = %llu (0x%llx)\n",
vol->nr_clusters, vol->nr_clusters);
(unsigned long long)vol->nr_clusters,
(unsigned long long)vol->nr_clusters);
/* Number of clusters must fit within 32 bits (Win2k limitation). */
if (vol->nr_clusters >> 32) {
if (vol->cluster_size >= 65536) {
@ -3868,7 +3870,7 @@ static BOOL mkntfs_initialize_bitmaps(void)
i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) &
~(g_vol->cluster_size - 1);
ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n",
g_lcn_bitmap_byte_size, i);
g_lcn_bitmap_byte_size, (unsigned long long)i);
g_dynamic_buf_size = mkntfs_get_page_size();
g_dynamic_buf = (u8*)ntfs_calloc(g_dynamic_buf_size);
if (!g_dynamic_buf)

View File

@ -1011,7 +1011,7 @@ static void restore_image(void)
Printf("Restoring NTFS from image ...\n");
progress_init(&progress, p_counter, opt.std_out ?
sle64_to_cpu(image_hdr.nr_clusters) + 1 :
(u64)sle64_to_cpu(image_hdr.nr_clusters) + 1 :
le64_to_cpu(image_hdr.inuse) + 1,
100);

View File

@ -389,7 +389,7 @@ static int change_label(ntfs_volume *vol, char *label)
(unsigned)(label_len -
(0x100 / sizeof(ntfschar))));
label_len = 0x100 / sizeof(ntfschar);
label[label_len] = 0;
new_label[label_len] = const_cpu_to_le16(0);
}
if(!opts.noaction)

View File

@ -36,6 +36,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include "types.h"
#include "attrib.h"

View File

@ -1090,6 +1090,7 @@ static const struct BUFFER *findprevious(CONTEXT *ctx, const struct BUFFER *buf)
error = FALSE;
prevblk = buf->num;
savebuf = (struct BUFFER*)NULL;
skipped = 0;
do {
prevmiddle = FALSE;

View File

@ -5,7 +5,7 @@
* Copyright (c) 2002-2005 Anton Altaparmakov
* Copyright (c) 2002-2003 Richard Russon
* Copyright (c) 2007 Yura Pakhuchiy
* Copyright (c) 2011-2015 Jean-Pierre Andre
* Copyright (c) 2011-2016 Jean-Pierre Andre
*
* This utility will resize an NTFS volume without data loss.
*
@ -404,7 +404,7 @@ static void version(void)
printf("Copyright (c) 2002-2005 Anton Altaparmakov\n");
printf("Copyright (c) 2002-2003 Richard Russon\n");
printf("Copyright (c) 2007 Yura Pakhuchiy\n");
printf("Copyright (c) 2011-2015 Jean-Pierre Andre\n");
printf("Copyright (c) 2011-2016 Jean-Pierre Andre\n");
printf("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home);
}
@ -2537,8 +2537,6 @@ static void lookup_data_attr(ntfs_volume *vol,
ntfs_ucsfree(ustr);
}
#if CLEAN_EXIT
static void close_inode_and_context(ntfs_attr_search_ctx *ctx)
{
ntfs_inode *ni;
@ -2551,8 +2549,6 @@ static void close_inode_and_context(ntfs_attr_search_ctx *ctx)
ntfs_inode_close(ni);
}
#endif /* CLEAN_EXIT */
static int check_bad_sectors(ntfs_volume *vol)
{
ntfs_attr_search_ctx *ctx;
@ -2619,11 +2615,7 @@ static void truncate_badclust_file(ntfs_resize_t *resize)
resize->mref = FILE_BadClus;
truncate_badclust_bad_attr(resize);
#if CLEAN_EXIT
close_inode_and_context(resize->ctx);
#else
ntfs_attr_put_search_ctx(resize->ctx);
#endif
}
/**
@ -4617,11 +4609,9 @@ int main(int argc, char **argv)
printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name);
if (resize.shrink)
printf("%s", resize_important_msg);
#if CLEAN_EXIT
if (resize.lcn_bitmap.bm)
free(resize.lcn_bitmap.bm);
if (vol)
ntfs_umount(vol,0);
#endif
return 0;
}

View File

@ -2358,7 +2358,7 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end)
mft_end = min(mft_end, nr_mft_records - 1);
ntfs_log_debug("MFT records:\n");
ntfs_log_debug("\tTotal: %8lld\n", nr_mft_records);
ntfs_log_debug("\tTotal: %8lld\n", (long long)nr_mft_records);
ntfs_log_debug("\tBegin: %8lld\n", mft_begin);
ntfs_log_debug("\tEnd: %8lld\n", mft_end);

View File

@ -53,6 +53,9 @@
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include "ntfswipe.h"
#include "types.h"

View File

@ -420,7 +420,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale)
if (middle) {
if (middle[1] == 0) {
b = LONG_MAX; // XXX ULLONG_MAX
ntfs_log_debug("Range has no end, defaulting to %lld.\n", b);
ntfs_log_debug("Range has no end, defaulting to "
"%lld.\n", (long long)b);
} else {
if (!utils_parse_size(middle+1, &b, scale))
return 0;
@ -429,7 +430,8 @@ int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale)
b = a;
}
ntfs_log_debug("Range '%s' = %lld - %lld\n", string, a, b);
ntfs_log_debug("Range '%s' = %lld - %lld\n", string, (long long)a,
(long long)b);
*start = a;
*finish = b;
@ -813,7 +815,9 @@ int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref)
bit = 1 << (mref & 7);
byte = (mref >> 3) & (sizeof(buffer) - 1);
ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit);
ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, "
"in use %d\n", (long long) mref, (long long) bmpmref,
byte, bit, buffer[byte] & bit);
return (buffer[byte] & bit);
}

View File

@ -227,7 +227,7 @@ static const char *usage_msg =
"\n"
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
"Copyright (C) 2007-2015 Jean-Pierre Andre\n"
"Copyright (C) 2007-2016 Jean-Pierre Andre\n"
"Copyright (C) 2009 Erik Larsson\n"
"\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"

View File

@ -171,7 +171,7 @@ static const char *usage_msg =
"\n"
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
"Copyright (C) 2007-2015 Jean-Pierre Andre\n"
"Copyright (C) 2007-2016 Jean-Pierre Andre\n"
"Copyright (C) 2009 Erik Larsson\n"
"\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"

View File

@ -118,7 +118,7 @@ typedef struct {
unsigned int dmask;
ntfs_fuse_streams_interface streams;
ntfs_atime_t atime;
u64 dmtime;
s64 dmtime;
BOOL ro;
BOOL show_sys_files;
BOOL hide_hid_files;