diff --git a/libntfs-3g/bootsect.c b/libntfs-3g/bootsect.c index 378d7027..f4d406c4 100644 --- a/libntfs-3g/bootsect.c +++ b/libntfs-3g/bootsect.c @@ -215,7 +215,8 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) if (vol->dev->d_ops->seek(vol->dev, (sectors - 1) << vol->sector_size_bits, SEEK_SET) == -1) { - ntfs_log_perror("Failed to read last sector (%lld)", sectors); + ntfs_log_perror("Failed to read last sector (%lld)", + (long long)sectors); ntfs_log_error("Perhaps the volume is a RAID/LDM but it wasn't " "setup yet, or the\nwrong device was used, " "or the partition table is incorrect.\n" ); @@ -232,7 +233,8 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mftmirr_lcn > vol->nr_clusters) { ntfs_log_error("$MFT LCN (%lld) or $MFTMirr LCN (%lld) is " "greater than the number of clusters (%lld).\n", - vol->mft_lcn, vol->mftmirr_lcn, vol->nr_clusters); + (long long)vol->mft_lcn, (long long)vol->mftmirr_lcn, + (long long)vol->nr_clusters); return -1; } diff --git a/libntfs-3g/device.c b/libntfs-3g/device.c index e1170825..cf4969c3 100644 --- a/libntfs-3g/device.c +++ b/libntfs-3g/device.c @@ -409,7 +409,8 @@ s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, if (vol->nr_clusters < lcn + count) { errno = ESPIPE; ntfs_log_perror("Trying to read outside of volume " - "(%lld < %lld)", vol->nr_clusters, lcn + count); + "(%lld < %lld)", (long long)vol->nr_clusters, + (long long)lcn + count); return -1; } br = ntfs_pread(vol->dev, lcn << vol->cluster_size_bits, @@ -444,7 +445,8 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, if (vol->nr_clusters < lcn + count) { errno = ESPIPE; ntfs_log_perror("Trying to write outside of volume " - "(%lld < %lld)", vol->nr_clusters, lcn + count); + "(%lld < %lld)", (long long)vol->nr_clusters, + (long long)lcn + count); return -1; } if (!NVolReadOnly(vol)) diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c index 8a41b601..cbc5ecb0 100644 --- a/libntfs-3g/dir.c +++ b/libntfs-3g/dir.c @@ -259,7 +259,8 @@ descend_into_child_node: if (br != 1) { if (br != -1) errno = EIO; - ntfs_log_perror("Failed to read vcn 0x%llx", vcn); + ntfs_log_perror("Failed to read vcn 0x%llx", + (unsigned long long)vcn); goto close_err_out; } @@ -1047,10 +1048,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, /* Allocate MFT record for new file. */ ni = ntfs_mft_record_alloc(dir_ni->vol, NULL); if (!ni) { - err = errno; - ntfs_log_error("Could not allocate new MFT record: %s.\n", - strerror(err)); - errno = err; + ntfs_log_perror("Could not allocate new MFT record"); return NULL; } /* diff --git a/libntfs-3g/index.c b/libntfs-3g/index.c index 093ae0f3..0c3fc58a 100644 --- a/libntfs-3g/index.c +++ b/libntfs-3g/index.c @@ -88,7 +88,8 @@ static int ntfs_ib_write(ntfs_index_context *icx, VCN vcn, void *buf) 1, icx->block_size, buf); if (ret != 1) { ntfs_log_perror("Failed to write index block %lld of inode " - "%llu", vcn, icx->ni->mft_no); + "%llu", (long long)vcn, + (unsigned long long)icx->ni->mft_no); return STATUS_ERROR; } @@ -397,7 +398,8 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn) if (!ntfs_is_indx_record(ib->magic)) { ntfs_log_error("Corrupt index block signature: vcn %lld inode " - "%llu\n", (long long)vcn, icx->ni->mft_no); + "%llu\n", (long long)vcn, + (unsigned long long)icx->ni->mft_no); return -1; } @@ -405,8 +407,9 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn) ntfs_log_error("Corrupt index block: VCN (%lld) is different " "from expected VCN (%lld) in inode %llu\n", - (long long) sle64_to_cpu(ib->index_block_vcn), - (long long)vcn, icx->ni->mft_no); + (long long)sle64_to_cpu(ib->index_block_vcn), + (long long)vcn, + (unsigned long long)icx->ni->mft_no); return -1; } @@ -415,7 +418,8 @@ static int ntfs_ia_check(ntfs_index_context *icx, INDEX_BLOCK *ib, VCN vcn) ntfs_log_error("Corrupt index block : VCN (%lld) of inode %llu " "has a size (%u) differing from the index " "specified size (%u)\n", (long long)vcn, - icx->ni->mft_no, ib_size, icx->block_size); + (unsigned long long)icx->ni->mft_no, ib_size, + icx->block_size); return -1; } return 0; @@ -489,7 +493,8 @@ static int ntfs_ie_lookup(const void *key, const int key_len, (u8 *)ie + le16_to_cpu(ie->length) > index_end) { errno = ERANGE; ntfs_log_error("Index entry out of bounds in inode " - "%llu.\n", icx->ni->mft_no); + "%llu.\n", + (unsigned long long)icx->ni->mft_no); return STATUS_ERROR; } /* @@ -543,7 +548,8 @@ static int ntfs_ie_lookup(const void *key, const int key_len, *vcn = ntfs_ie_get_vcn(ie); if (*vcn < 0) { errno = EINVAL; - ntfs_log_perror("Negative vcn in inode %llu\n", icx->ni->mft_no); + ntfs_log_perror("Negative vcn in inode %llu\n", + (unsigned long long)icx->ni->mft_no); return STATUS_ERROR; } @@ -560,7 +566,7 @@ static ntfs_attr *ntfs_ia_open(ntfs_index_context *icx, ntfs_inode *ni) na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, icx->name, icx->name_len); if (!na) { ntfs_log_perror("Failed to open index allocation of inode " - "%llu", ni->mft_no); + "%llu", (unsigned long long)ni->mft_no); return NULL; } @@ -581,7 +587,7 @@ static int ntfs_ib_read(ntfs_index_context *icx, VCN vcn, INDEX_BLOCK *dst) ntfs_log_perror("Failed to read index block"); else ntfs_log_error("Failed to read full index block at " - "%lld\n", pos); + "%lld\n", (long long)pos); return -1; } @@ -755,7 +761,8 @@ descend_into_child_node: if ((ib->index.ih_flags & NODE_MASK) == LEAF_NODE) { ntfs_log_error("Index entry with child node found in a leaf " - "node in inode 0x%llx.\n", ni->mft_no); + "node in inode 0x%llx.\n", + (unsigned long long)ni->mft_no); goto err_out; } diff --git a/libntfs-3g/mft.c b/libntfs-3g/mft.c index 2ef1b4ea..028a6824 100644 --- a/libntfs-3g/mft.c +++ b/libntfs-3g/mft.c @@ -92,8 +92,8 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, vol->mft_record_size_bits) { errno = ESPIPE; ntfs_log_perror("Trying to read non-allocated mft records " - "(%lld > %lld)", m + count, - vol->mft_na->initialized_size >> + "(%lld > %lld)", (long long)m + count, + (long long)vol->mft_na->initialized_size >> vol->mft_record_size_bits); return -1; } @@ -155,8 +155,8 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, vol->mft_record_size_bits) { errno = ESPIPE; ntfs_log_perror("Trying to write non-allocated mft records " - "(%lld > %lld)", m + count, - vol->mft_na->initialized_size >> + "(%lld > %lld)", (long long)m + count, + (long long)vol->mft_na->initialized_size >> vol->mft_record_size_bits); return -1; } diff --git a/libntfs-3g/runlist.c b/libntfs-3g/runlist.c index 51723542..714bd0e6 100644 --- a/libntfs-3g/runlist.c +++ b/libntfs-3g/runlist.c @@ -1040,7 +1040,8 @@ s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, if (!vol || !rl || pos < 0 || count < 0) { errno = EINVAL; ntfs_log_perror("Failed to read runlist [vol: %p rl: %p " - "pos: %lld count: %lld]", vol, rl, pos, count); + "pos: %lld count: %lld]", vol, rl, + (long long)pos, (long long)count); return -1; } if (!count) @@ -1127,7 +1128,8 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, if (!vol || !rl || pos < 0 || count < 0) { errno = EINVAL; ntfs_log_perror("Failed to write runlist [vol: %p rl: %p " - "pos: %lld count: %lld]", vol, rl, pos, count); + "pos: %lld count: %lld]", vol, rl, + (long long)pos, (long long)count); goto errno_set; } if (!count) diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 6d59437d..84db665f 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -203,7 +203,8 @@ static int ntfs_mft_load(ntfs_volume *vol) NInoSetAttrList(vol->mft_ni); l = ntfs_get_attribute_value_length(ctx->attr); if (l <= 0 || l > 0x40000) { - ntfs_log_error("$MFT/$ATTR_LIST invalid length (%lld).\n", l); + ntfs_log_error("$MFT/$ATTR_LIST invalid length (%lld).\n", + (long long)l); goto io_error_exit; } vol->mft_ni->attr_list_size = l; @@ -218,7 +219,8 @@ static int ntfs_mft_load(ntfs_volume *vol) } if (l != vol->mft_ni->attr_list_size) { ntfs_log_error("Partial read of $MFT/$ATTR_LIST (%lld != " - "%u).\n", l, vol->mft_ni->attr_list_size); + "%u).\n", (long long)l, + vol->mft_ni->attr_list_size); goto io_error_exit; } @@ -774,7 +776,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) ntfs_log_perror("Failed to read $MFT"); else { ntfs_log_error("Failed to read $MFT, unexpected length " - "(%lld != %d).\n", l, vol->mftmirr_size); + "(%lld != %d).\n", (long long)l, + vol->mftmirr_size); errno = EIO; } goto error_exit; @@ -790,7 +793,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) else { ntfs_log_error("Failed to read $MFTMirr " "unexpected length (%d != %lld)." - "\n", vol->mftmirr_size, l); + "\n", vol->mftmirr_size, + (long long)l); errno = EIO; } goto error_exit; @@ -917,7 +921,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) if (l != na->data_size) { ntfs_log_debug(FAILED); ntfs_log_error("Failed to read $UpCase, unexpected length " - "(%lld != %lld).\n", l, na->data_size); + "(%lld != %lld).\n", (long long)l, + (long long)na->data_size); errno = EIO; goto error_exit; } @@ -1076,7 +1081,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) if (l != na->data_size) { ntfs_log_debug(FAILED); ntfs_log_error("Failed to read $AttrDef, unexpected length " - "(%lld != %lld).\n", l, na->data_size); + "(%lld != %lld).\n", (long long)l, + (long long)na->data_size); errno = EIO; goto error_exit; } diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index b4085e5b..bcb68f13 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -554,14 +554,14 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, if (name_type == FILE_NAME_DOS) return 0; if (ntfs_ucstombs(name, name_len, &filename, 0) < 0) { - ntfs_log_error("Skipping unrepresentable filename (inode %lld):" - " %s\n", MREF(mref), strerror(errno)); + ntfs_log_perror("Skipping unrepresentable filename (inode %llu)", + (unsigned long long)MREF(mref)); return 0; } if (ntfs_fuse_is_named_data_stream(filename)) { - ntfs_log_error("Unable to access '%s' (inode %lld) with " + ntfs_log_error("Unable to access '%s' (inode %llu) with " "current named streams access interface.\n", - filename, MREF(mref)); + filename, (unsigned long long)MREF(mref)); free(filename); return 0; }