Commit 4a952349 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: - Fix compiler warnings related to type casting.

      - Move %L to %ll as %L is floating point and %ll is integer which
        is what we want.
      - Add logfile inode to ntfs_volume structure and the code to clean
        it up in super.c.
parent aea571fc
......@@ -39,6 +39,10 @@ ToDo:
and store it in ntfs_volume->mftmirr_size (fs/ntfs/super.c).
- Load the mft mirror at mount time and compare the mft records stored
in it to the ones in the mft (fs/ntfs/super.c).
- Fix type casting related warnings on 64-bit architectures. Thanks
to Meelis Roos for reporting them.
- Move %L to %ll as %L is floating point and %ll is integer which is
what we want.
2.1.7 - Enable NFS exporting of mounted NTFS volumes.
......
......@@ -77,7 +77,7 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
}
} else {
clear_buffer_uptodate(bh);
ntfs_error(ni->vol->sb, "Buffer I/O error, logical block %Lu.",
ntfs_error(ni->vol->sb, "Buffer I/O error, logical block %llu.",
(unsigned long long)bh->b_blocknr);
SetPageError(page);
}
......@@ -120,10 +120,10 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
continue;
nr_err++;
ntfs_error(ni->vol->sb, "post_read_mst_fixup() failed, "
"corrupt %s record 0x%Lx. Run chkdsk.",
"corrupt %s record 0x%llx. Run chkdsk.",
ni->mft_no ? "index" : "mft",
(long long)(((s64)page->index <<
PAGE_CACHE_SHIFT >>
(unsigned long long)(((s64)page->index
<< PAGE_CACHE_SHIFT >>
ni->itype.index.block_size_bits) + i));
}
flush_dcache_page(page);
......@@ -263,9 +263,10 @@ static int ntfs_read_block(struct page *page)
}
/* Hard error, zero out region. */
SetPageError(page);
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%Lx) failed "
"with error code 0x%Lx%s.",
(long long)vcn, (long long)-lcn,
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%llx) failed "
"with error code 0x%llx%s.",
(unsigned long long)vcn,
(unsigned long long)-lcn,
is_retry ? " even after retrying" : "");
// FIXME: Depending on vol->on_errors, do something.
}
......@@ -667,9 +668,10 @@ static int ntfs_write_block(struct writeback_control *wbc, struct page *page)
}
/* Failed to map the buffer, even after retrying. */
bh->b_blocknr = -1UL;
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%Lx) failed "
"with error code 0x%Lx%s.",
(long long)vcn, (long long)-lcn,
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%llx) failed "
"with error code 0x%llx%s.",
(unsigned long long)vcn,
(unsigned long long)-lcn,
is_retry ? " even after retrying" : "");
// FIXME: Depending on vol->on_errors, do something.
if (!err)
......@@ -914,15 +916,16 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
attr_len = le32_to_cpu(ctx->attr->data.resident.value_length);
if (unlikely(vi->i_size != attr_len)) {
ntfs_error(vi->i_sb, "BUG()! i_size (0x%Lx) doesn't match "
ntfs_error(vi->i_sb, "BUG()! i_size (0x%llx) doesn't match "
"attr_len (0x%x). Aborting write.", vi->i_size,
attr_len);
err = -EIO;
goto err_out;
}
if (unlikely(attr_pos >= attr_len)) {
ntfs_error(vi->i_sb, "BUG()! attr_pos (0x%Lx) > attr_len (0x%x)"
". Aborting write.", attr_pos, attr_len);
ntfs_error(vi->i_sb, "BUG()! attr_pos (0x%llx) > attr_len "
"(0x%x). Aborting write.",
(unsigned long long)attr_pos, attr_len);
err = -EIO;
goto err_out;
}
......@@ -1221,11 +1224,13 @@ static int ntfs_prepare_nonresident_write(struct page *page,
* retrying.
*/
bh->b_blocknr = -1UL;
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%Lx) "
ntfs_error(vol->sb, "vcn_to_lcn(vcn = 0x%llx) "
"failed with error code "
"0x%Lx%s.", (long long)vcn,
(long long)-lcn, is_retry ?
" even after retrying" : "");
"0x%llx%s.",
(unsigned long long)vcn,
(unsigned long long)-lcn,
is_retry ? " even after "
"retrying" : "");
// FIXME: Depending on vol->on_errors, do
// something.
if (!err)
......@@ -1675,15 +1680,16 @@ static int ntfs_commit_write(struct file *file, struct page *page,
attr_len = le32_to_cpu(ctx->attr->data.resident.value_length);
if (unlikely(vi->i_size != attr_len)) {
ntfs_error(vi->i_sb, "BUG()! i_size (0x%Lx) doesn't match "
ntfs_error(vi->i_sb, "BUG()! i_size (0x%llx) doesn't match "
"attr_len (0x%x). Aborting write.", vi->i_size,
attr_len);
err = -EIO;
goto err_out;
}
if (unlikely(attr_pos >= attr_len)) {
ntfs_error(vi->i_sb, "BUG()! attr_pos (0x%Lx) > attr_len (0x%x)"
". Aborting write.", attr_pos, attr_len);
ntfs_error(vi->i_sb, "BUG()! attr_pos (0x%llx) > attr_len "
"(0x%x). Aborting write.",
(unsigned long long)attr_pos, attr_len);
err = -EIO;
goto err_out;
}
......
/**
* attrib.c - NTFS attribute operations. Part of the Linux-NTFS project.
*
* Copyright (c) 2001-2003 Anton Altaparmakov
* Copyright (c) 2001-2004 Anton Altaparmakov
* Copyright (c) 2002 Richard Russon
*
* This program/include file is free software; you can redistribute it and/or
......@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS
* along with this program (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
......@@ -623,8 +623,8 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl,
int slots = 0;
if (drl[ds].vcn == marker_vcn) {
ntfs_debug("Old marker = 0x%Lx, replacing with "
"LCN_ENOENT.\n",
ntfs_debug("Old marker = 0x%llx, replacing "
"with LCN_ENOENT.\n",
(unsigned long long)
drl[ds].lcn);
drl[ds].lcn = (LCN)LCN_ENOENT;
......@@ -889,19 +889,19 @@ run_list_element *decompress_mapping_pairs(const ntfs_volume *vol,
* likely, there are more extents following this one.
*/
if (deltaxcn < --max_cluster) {
ntfs_debug("More extents to follow; deltaxcn = 0x%Lx, "
"max_cluster = 0x%Lx",
(long long)deltaxcn,
(long long)max_cluster);
ntfs_debug("More extents to follow; deltaxcn = 0x%llx, "
"max_cluster = 0x%llx",
(unsigned long long)deltaxcn,
(unsigned long long)max_cluster);
rl[rlpos].vcn = vcn;
vcn += rl[rlpos].length = max_cluster - deltaxcn;
rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED;
rlpos++;
} else if (unlikely(deltaxcn > max_cluster)) {
ntfs_error(vol->sb, "Corrupt attribute. deltaxcn = "
"0x%Lx, max_cluster = 0x%Lx",
(long long)deltaxcn,
(long long)max_cluster);
"0x%llx, max_cluster = 0x%llx",
(unsigned long long)deltaxcn,
(unsigned long long)max_cluster);
goto mpa_err;
}
rl[rlpos].lcn = (LCN)LCN_ENOENT;
......@@ -933,7 +933,7 @@ run_list_element *decompress_mapping_pairs(const ntfs_volume *vol,
/**
* map_run_list - map (a part of) a run list of an ntfs inode
* @ni: ntfs inode for which to map (part of) a run list
* @ni: ntfs inode for which to map (part of) a run list
* @vcn: map run list part containing this vcn
*
* Map the part of a run list containing the @vcn of an the ntfs inode @ni.
......@@ -947,8 +947,8 @@ int map_run_list(ntfs_inode *ni, VCN vcn)
MFT_RECORD *mrec;
int err = 0;
ntfs_debug("Mapping run list part containing vcn 0x%Lx.",
(long long)vcn);
ntfs_debug("Mapping run list part containing vcn 0x%llx.",
(unsigned long long)vcn);
if (!NInoAttr(ni))
base_ni = ni;
......@@ -1136,7 +1136,7 @@ BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
break;
if (a->type != type)
continue;
/*
/*
* If @name is present, compare the two names. If @name is
* missing, assume we want an unnamed attribute.
*/
......@@ -1257,8 +1257,9 @@ int load_attribute_list(ntfs_volume *vol, run_list *run_list, u8 *al_start,
/* Read all clusters specified by the run list one run at a time. */
while (rl->length) {
lcn = vcn_to_lcn(rl, rl->vcn);
ntfs_debug("Reading vcn = 0x%Lx, lcn = 0x%Lx.",
(long long)rl->vcn, (long long)lcn);
ntfs_debug("Reading vcn = 0x%llx, lcn = 0x%llx.",
(unsigned long long)rl->vcn,
(unsigned long long)lcn);
/* The attribute list cannot be sparse. */
if (lcn < 0) {
ntfs_error(sb, "vcn_to_lcn() failed. Cannot read "
......
......@@ -597,8 +597,9 @@ int ntfs_read_compressed_block(struct page *page)
lcn = vcn_to_lcn(rl, vcn);
} else
lcn = (LCN)LCN_RL_NOT_MAPPED;
ntfs_debug("Reading vcn = 0x%Lx, lcn = 0x%Lx.",
(long long)vcn, (long long)lcn);
ntfs_debug("Reading vcn = 0x%llx, lcn = 0x%llx.",
(unsigned long long)vcn,
(unsigned long long)lcn);
if (lcn < 0) {
/*
* When we reach the first sparse cluster we have
......
......@@ -9,13 +9,13 @@
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS
* along with this program (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
......@@ -322,22 +322,22 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
goto unm_err_out;
}
if (sle64_to_cpu(ia->index_block_vcn) != vcn) {
ntfs_error(sb, "Actual VCN (0x%Lx) of index buffer is "
"different from expected VCN (0x%Lx). "
ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is "
"different from expected VCN (0x%llx). "
"Directory inode 0x%lx is corrupt or driver "
"bug.",
(long long)sle64_to_cpu(ia->index_block_vcn),
(long long)vcn, dir_ni->mft_no);
"bug.", (unsigned long long)
sle64_to_cpu(ia->index_block_vcn),
(unsigned long long)vcn, dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
dir_ni->itype.index.block_size) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx has a size (%u) differing from the "
"directory specified size (%u). Directory "
"inode is corrupt or driver bug.",
(long long)vcn, dir_ni->mft_no,
(unsigned long long)vcn, dir_ni->mft_no,
le32_to_cpu(ia->index.allocated_size) + 0x18,
dir_ni->itype.index.block_size);
err = -EIO;
......@@ -345,18 +345,19 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
}
index_end = (u8*)ia + dir_ni->itype.index.block_size;
if (index_end > kaddr + PAGE_CACHE_SIZE) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx crosses page boundary. Impossible! "
"Cannot access! This is probably a bug in the "
"driver.", (long long)vcn, dir_ni->mft_no);
"driver.", (unsigned long long)vcn,
dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
if (index_end > (u8*)ia + dir_ni->itype.index.block_size) {
ntfs_error(sb, "Size of index buffer (VCN 0x%Lx) of directory "
ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of directory "
"inode 0x%lx exceeds maximum size.",
(long long)vcn, dir_ni->mft_no);
(unsigned long long)vcn, dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
......@@ -790,22 +791,22 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
goto unm_err_out;
}
if (sle64_to_cpu(ia->index_block_vcn) != vcn) {
ntfs_error(sb, "Actual VCN (0x%Lx) of index buffer is "
"different from expected VCN (0x%Lx). "
ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is "
"different from expected VCN (0x%llx). "
"Directory inode 0x%lx is corrupt or driver "
"bug.",
(long long)sle64_to_cpu(ia->index_block_vcn),
(long long)vcn, dir_ni->mft_no);
"bug.", (unsigned long long)
sle64_to_cpu(ia->index_block_vcn),
(unsigned long long)vcn, dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
dir_ni->itype.index.block_size) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx has a size (%u) differing from the "
"directory specified size (%u). Directory "
"inode is corrupt or driver bug.",
(long long)vcn, dir_ni->mft_no,
(unsigned long long)vcn, dir_ni->mft_no,
le32_to_cpu(ia->index.allocated_size) + 0x18,
dir_ni->itype.index.block_size);
err = -EIO;
......@@ -813,18 +814,19 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
}
index_end = (u8*)ia + dir_ni->itype.index.block_size;
if (index_end > kaddr + PAGE_CACHE_SIZE) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx crosses page boundary. Impossible! "
"Cannot access! This is probably a bug in the "
"driver.", (long long)vcn, dir_ni->mft_no);
"driver.", (unsigned long long)vcn,
dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
if (index_end > (u8*)ia + dir_ni->itype.index.block_size) {
ntfs_error(sb, "Size of index buffer (VCN 0x%Lx) of directory "
ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of directory "
"inode 0x%lx exceeds maximum size.",
(long long)vcn, dir_ni->mft_no);
(unsigned long long)vcn, dir_ni->mft_no);
err = -EIO;
goto unm_err_out;
}
......@@ -1037,7 +1039,7 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos,
dt_type = DT_DIR;
else
dt_type = DT_REG;
ntfs_debug("Calling filldir for %s with len %i, fpos 0x%Lx, inode "
ntfs_debug("Calling filldir for %s with len %i, fpos 0x%llx, inode "
"0x%lx, DT_%s.", name, name_len, *fpos,
MREF_LE(ie->data.dir.indexed_file),
dt_type == DT_DIR ? "DIR" : "REG");
......@@ -1076,7 +1078,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
attr_search_context *ctx;
fpos = filp->f_pos;
ntfs_debug("Entering for inode 0x%lx, fpos 0x%Lx.",
ntfs_debug("Entering for inode 0x%lx, fpos 0x%llx.",
vdir->i_ino, fpos);
rc = err = 0;
/* Are we at end of dir yet? */
......@@ -1215,9 +1217,10 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
cur_bmp_pos = bmp_pos & ((PAGE_CACHE_SIZE * 8) - 1);
bmp_pos &= ~(u64)((PAGE_CACHE_SIZE * 8) - 1);
get_next_bmp_page:
ntfs_debug("Reading bitmap with page index 0x%Lx, bit ofs 0x%Lx",
(long long)bmp_pos >> (3 + PAGE_CACHE_SHIFT),
(long long)bmp_pos & ((PAGE_CACHE_SIZE * 8) - 1));
ntfs_debug("Reading bitmap with page index 0x%llx, bit ofs 0x%llx",
(unsigned long long)bmp_pos >> (3 + PAGE_CACHE_SHIFT),
(unsigned long long)bmp_pos &
((PAGE_CACHE_SIZE * 8) - 1));
bmp_page = ntfs_map_page(bmp_mapping,
bmp_pos >> (3 + PAGE_CACHE_SHIFT));
if (unlikely(IS_ERR(bmp_page))) {
......@@ -1247,8 +1250,8 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
ia_pos = (bmp_pos + cur_bmp_pos) <<
ndir->itype.index.block_size_bits;
}
ntfs_debug("Handling index buffer 0x%Lx.",
(long long)bmp_pos + cur_bmp_pos);
ntfs_debug("Handling index buffer 0x%llx.",
(unsigned long long)bmp_pos + cur_bmp_pos);
/* If the current index buffer is in the same page we reuse the page. */
if ((prev_ia_pos & PAGE_CACHE_MASK) != (ia_pos & PAGE_CACHE_MASK)) {
prev_ia_pos = ia_pos;
......@@ -1279,22 +1282,22 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (unlikely(sle64_to_cpu(ia->index_block_vcn) != (ia_pos &
~(s64)(ndir->itype.index.block_size - 1)) >>
ndir->itype.index.vcn_size_bits)) {
ntfs_error(sb, "Actual VCN (0x%Lx) of index buffer is "
"different from expected VCN (0x%Lx). "
ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is "
"different from expected VCN (0x%llx). "
"Directory inode 0x%lx is corrupt or driver "
"bug. ",
(long long)sle64_to_cpu(ia->index_block_vcn),
(long long)ia_pos >>
"bug. ", (unsigned long long)
sle64_to_cpu(ia->index_block_vcn),
(unsigned long long)ia_pos >>
ndir->itype.index.vcn_size_bits, vdir->i_ino);
goto err_out;
}
if (unlikely(le32_to_cpu(ia->index.allocated_size) + 0x18 !=
ndir->itype.index.block_size)) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx has a size (%u) differing from the "
"directory specified size (%u). Directory "
"inode is corrupt or driver bug.",
(long long)ia_pos >>
(unsigned long long)ia_pos >>
ndir->itype.index.vcn_size_bits, vdir->i_ino,
le32_to_cpu(ia->index.allocated_size) + 0x18,
ndir->itype.index.block_size);
......@@ -1302,19 +1305,19 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
}
index_end = (u8*)ia + ndir->itype.index.block_size;
if (unlikely(index_end > kaddr + PAGE_CACHE_SIZE)) {
ntfs_error(sb, "Index buffer (VCN 0x%Lx) of directory inode "
ntfs_error(sb, "Index buffer (VCN 0x%llx) of directory inode "
"0x%lx crosses page boundary. Impossible! "
"Cannot access! This is probably a bug in the "
"driver.", (long long)ia_pos >>
"driver.", (unsigned long long)ia_pos >>
ndir->itype.index.vcn_size_bits, vdir->i_ino);
goto err_out;
}
ia_start = ia_pos & ~(s64)(ndir->itype.index.block_size - 1);
index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
if (unlikely(index_end > (u8*)ia + ndir->itype.index.block_size)) {
ntfs_error(sb, "Size of index buffer (VCN 0x%Lx) of directory "
ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of directory "
"inode 0x%lx exceeds maximum size.",
(long long)ia_pos >>
(unsigned long long)ia_pos >>
ndir->itype.index.vcn_size_bits, vdir->i_ino);
goto err_out;
}
......@@ -1327,8 +1330,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* or signals an error (both covered by the rc test).
*/
for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
ntfs_debug("In index allocation, offset 0x%Lx.",
(long long)ia_start + ((u8*)ie - (u8*)ia));
ntfs_debug("In index allocation, offset 0x%llx.",
(unsigned long long)ia_start + ((u8*)ie -
(u8*)ia));
/* Bounds checks. */
if (unlikely((u8*)ie < (u8*)ia || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
......@@ -1363,9 +1367,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
done:
#ifdef DEBUG
if (!rc)
ntfs_debug("EOD, fpos 0x%Lx, returning 0.", fpos);
ntfs_debug("EOD, fpos 0x%llx, returning 0.", fpos);
else
ntfs_debug("filldir returned %i, fpos 0x%Lx, returning 0.",
ntfs_debug("filldir returned %i, fpos 0x%llx, returning 0.",
rc, fpos);
#endif
filp->f_pos = fpos;
......
......@@ -853,8 +853,8 @@ static int ntfs_read_locked_inode(struct inode *vi)
/* Consistency check bitmap size vs. index allocation size. */
if ((bvi->i_size << 3) < (vi->i_size >>
ni->itype.index.block_size_bits)) {
ntfs_error(vi->i_sb, "Index bitmap too small (0x%Lx) "
"for index allocation (0x%Lx).",
ntfs_error(vi->i_sb, "Index bitmap too small (0x%llx) "
"for index allocation (0x%llx).",
bvi->i_size << 3, vi->i_size);
goto unm_err_out;
}
......@@ -1692,9 +1692,9 @@ void ntfs_read_inode_mount(struct inode *vi)
ntfs_error(sb, "Failed to load the complete run list "
"for $MFT/$DATA. Driver bug or "
"corrupt $MFT. Run chkdsk.");
ntfs_debug("highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx",
(long long)highest_vcn,
(long long)last_vcn - 1);
ntfs_debug("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx",
(unsigned long long)highest_vcn,
(unsigned long long)last_vcn - 1);
goto put_err_out;
}
put_attr_search_ctx(ctx);
......
......@@ -75,10 +75,13 @@ extern struct inode_operations ntfs_dir_inode_ops;
extern struct file_operations ntfs_empty_file_ops;
extern struct inode_operations ntfs_empty_inode_ops;
/* Generic macro to convert pointers to values for comparison purposes. */
/* Generic macros to convert pointers to values and vice versa. */
#ifndef p2n
#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p)))
#endif
#ifndef n2p
#define n2p(p) ((ptrdiff_t*)((ptrdiff_t)(p)))
#endif
/**
* NTFS_SB - return the ntfs volume given a vfs super block
......
......@@ -627,7 +627,7 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
return FALSE;
}
vol->nr_clusters = ll;
ntfs_debug("vol->nr_clusters = 0x%Lx", (long long)vol->nr_clusters);
ntfs_debug("vol->nr_clusters = 0x%llx", (long long)vol->nr_clusters);
/*
* On an architecture where unsigned long is 32-bits, we restrict the
* volume size to 2TiB (2^41). On a 64-bit architecture, the compiler
......@@ -635,10 +635,11 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
*/
if (sizeof(unsigned long) < 8) {
if ((ll << vol->cluster_size_bits) >= (1ULL << 41)) {
ntfs_error(vol->sb, "Volume size (%LuTiB) is too large "
"for this architecture. Maximim "
ntfs_error(vol->sb, "Volume size (%lluTiB) is too "
"large for this architecture. Maximum "
"supported is 2TiB. Sorry.",
ll >> (40 - vol->cluster_size_bits));
(unsigned long long)ll >> (40 -
vol->cluster_size_bits));
return FALSE;
}
}
......@@ -648,7 +649,7 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
return FALSE;
}
vol->mft_lcn = ll;
ntfs_debug("vol->mft_lcn = 0x%Lx", (long long)vol->mft_lcn);
ntfs_debug("vol->mft_lcn = 0x%llx", (long long)vol->mft_lcn);
ll = sle64_to_cpu(b->mftmirr_lcn);
if (ll >= vol->nr_clusters) {
ntfs_error(vol->sb, "MFTMirr LCN is beyond end of volume. "
......@@ -656,7 +657,7 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
return FALSE;
}
vol->mftmirr_lcn = ll;
ntfs_debug("vol->mftmirr_lcn = 0x%Lx", (long long)vol->mftmirr_lcn);
ntfs_debug("vol->mftmirr_lcn = 0x%llx", (long long)vol->mftmirr_lcn);
#ifdef NTFS_RW
/*
* Work out the size of the mft mirror in number of mft records. If the
......@@ -674,7 +675,7 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
ntfs_debug("vol->mftmirr_size = %i", vol->mftmirr_size);
#endif /* NTFS_RW */
vol->serial_no = le64_to_cpu(b->volume_serial_number);
ntfs_debug("vol->serial_no = 0x%Lx",
ntfs_debug("vol->serial_no = 0x%llx",
(unsigned long long)vol->serial_no);
/*
* Determine MFT zone size. This is not strictly the right place to do
......@@ -703,9 +704,9 @@ static BOOL parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b)
vol->mft_zone_multiplier);
vol->mft_zone_start = vol->mft_lcn;
vol->mft_zone_end += vol->mft_lcn;
ntfs_debug("vol->mft_zone_start = 0x%Lx",
ntfs_debug("vol->mft_zone_start = 0x%llx",
(long long)vol->mft_zone_start);
ntfs_debug("vol->mft_zone_end = 0x%Lx", (long long)vol->mft_zone_end);
ntfs_debug("vol->mft_zone_end = 0x%llx", (long long)vol->mft_zone_end);
return TRUE;
}
......@@ -925,7 +926,7 @@ static BOOL load_and_init_upcase(ntfs_volume *vol)
goto read_partial_upcase_page;
}
vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS;
ntfs_debug("Read %Lu bytes from $UpCase (expected %u bytes).",
ntfs_debug("Read %lu bytes from $UpCase (expected %u bytes).",
ino->i_size, 64 * 1024 * sizeof(uchar_t));
iput(ino);
down(&ntfs_lock);
......@@ -1097,6 +1098,8 @@ static BOOL load_system_files(ntfs_volume *vol)
* Get the inode for the logfile and empty it if this is a read-write
* mount.
*/
// TODO: vol->logfile_ino = ;
// TODO: Cleanup for error case at end of function.
tmp_ino = ntfs_iget(sb, FILE_LogFile);
if (IS_ERR(tmp_ino) || is_bad_inode(tmp_ino)) {
if (!IS_ERR(tmp_ino))
......@@ -1211,18 +1214,23 @@ static void ntfs_put_super(struct super_block *vfs_sb)
vol->lcnbmp_ino = NULL;
up_write(&vol->lcnbmp_lock);
down_write(&vol->mftbmp_lock);
iput(vol->mftbmp_ino);
vol->mftbmp_ino = NULL;
up_write(&vol->mftbmp_lock);
#ifdef NTFS_RW
if (vol->logfile_ino) {
iput(vol->logfile_ino);
vol->logfile_ino = NULL;
}
if (vol->mftmirr_ino) {
iput(vol->mftmirr_ino);
vol->mftmirr_ino = NULL;
}
#endif /* NTFS_RW */
down_write(&vol->mftbmp_lock);
iput(vol->mftbmp_ino);
vol->mftbmp_ino = NULL;
up_write(&vol->mftbmp_lock);
iput(vol->mft_ino);
vol->mft_ino = NULL;
......@@ -1540,6 +1548,7 @@ struct super_operations ntfs_sops = {
// 0 and i_nlink is also 0. */
//.write_super = NULL, /* Flush dirty super block to
// disk. */
//.sync_fs = NULL, /* ? */
//.write_super_lockfs = NULL, /* ? */
//.unlockfs = NULL, /* ? */
#endif /* NTFS_RW */
......@@ -1638,6 +1647,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
init_rwsem(&vol->mftbmp_lock);
#ifdef NTFS_RW
vol->mftmirr_ino = NULL;
vol->mftmirr_size = 0;
vol->logfile_ino = NULL;
#endif /* NTFS_RW */
vol->lcnbmp_ino = NULL;
init_rwsem(&vol->lcnbmp_lock);
......@@ -1733,7 +1744,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent)
* Poison vol->mft_ino so we know whether iget() called into our
* ntfs_read_inode_mount() method.
*/
#define OGIN ((struct inode*)le32_to_cpu(0x4e49474f)) /* OGIN */
#define OGIN ((struct inode*)n2p(le32_to_cpu(0x4e49474f))) /* OGIN */
vol->mft_ino = OGIN;
sb->s_op = &ntfs_mount_sops;
tmp_ino = iget(vol->sb, FILE_MFT);
......
......@@ -86,6 +86,8 @@ typedef struct {
#ifdef NTFS_RW
struct inode *mftmirr_ino; /* The VFS inode of $MFTMirr. */
int mftmirr_size; /* Size of mft mirror in mft records. */
struct inode *logfile_ino; /* The VFS inode of $LogFile. */
#endif /* NTFS_RW */
struct inode *lcnbmp_ino; /* The VFS inode of $Bitmap. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment