Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs
In directory usw-pr-cvs1:/tmp/cvs-serv20133/linux/fs/ntfs
Modified Files:
aops.c attrib.c attrib.h compress.c dir.c inode.c inode.h
layout.h mft.c ntfs.h super.c volume.h
Log Message:
backwards compatibility for gcc 2.95
Index: aops.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/aops.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -U2 -r1.53 -r1.54
--- aops.c 14 Feb 2002 06:07:14 -0000 1.53
+++ aops.c 25 Feb 2002 04:00:58 -0000 1.54
@@ -4,4 +4,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -232,5 +233,5 @@
/* The total length of the attribute value. */
- attr_len = le32_to_cpu(ctx->attr->value_length);
+ attr_len = le32_to_cpu(ctx->attr->_ARA(value_length));
/* Map the page so we can access it. */
@@ -252,5 +253,5 @@
/* Copy the data to the page. */
memcpy(page_addr, attr_pos + (char*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset), bytes);
+ le16_to_cpu(ctx->attr->_ARA(value_offset)), bytes);
} else
memset(page_addr, 0, PAGE_CACHE_SIZE);
@@ -339,5 +340,5 @@
blocks = PAGE_CACHE_SIZE >> blocksize_bits;
iblock = page->index << (PAGE_CACHE_SHIFT - blocksize_bits);
- lblock = (((vol->nr_mft_records + 7) >> 3) + blocksize - 1) >>
+ lblock = (((vol->_VMM(nr_mft_records) + 7) >> 3) + blocksize - 1) >>
blocksize_bits;
ntfs_debug("blocks = 0x%x, iblock = 0x%lx, lblock = 0x%lx.", blocks,
@@ -469,5 +470,5 @@
addr = kmap_atomic(page, KM_BIO_IRQ);
- rec_size = ni->index_block_size;
+ rec_size = ni->_IDM(index_block_size);
recs = PAGE_CACHE_SIZE / rec_size;
for (i = 0; i < recs; i++) {
@@ -481,5 +482,5 @@
(long long)((page->index <<
PAGE_CACHE_SHIFT >>
- ni->index_block_size_bits) + i));
+ ni->_IDM(index_block_size_bits)) + i));
}
kunmap_atomic(addr, KM_BIO_IRQ);
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/attrib.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -U2 -r1.65 -r1.66
--- attrib.c 18 Feb 2002 01:53:00 -0000 1.65
+++ attrib.c 25 Feb 2002 04:00:58 -0000 1.66
@@ -3,5 +3,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
- * Copyright (C) 2002 Richard Russon <nt...@fl...>
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -550,5 +550,5 @@
/* Make sure attr exists and is non-resident. */
if (!attr || !attr->non_resident ||
- sle64_to_cpu(attr->lowest_vcn) < (VCN)0) {
+ sle64_to_cpu(attr->_ANR(lowest_vcn)) < (VCN)0) {
ntfs_error(vol->sb, "Invalid arguments.");
return ERR_PTR(-EINVAL);
@@ -556,8 +556,8 @@
#endif
/* Start at vcn = lowest_vcn and lcn 0. */
- vcn = sle64_to_cpu(attr->lowest_vcn);
+ vcn = sle64_to_cpu(attr->_ANR(lowest_vcn));
lcn = 0;
/* Get start of the mapping pairs array. */
- buf = (u8*)attr + le16_to_cpu(attr->mapping_pairs_offset);
+ buf = (u8*)attr + le16_to_cpu(attr->_ANR(mapping_pairs_offset));
attr_end = (u8*)attr + le32_to_cpu(attr->length);
if (unlikely(buf < (u8*)attr || buf > attr_end)) {
@@ -685,5 +685,5 @@
* vcn in the run list - 1, or something has gone badly wrong.
*/
- deltaxcn = sle64_to_cpu(attr->highest_vcn);
+ deltaxcn = sle64_to_cpu(attr->_ANR(highest_vcn));
if (unlikely(deltaxcn && vcn - 1 != deltaxcn)) {
mpa_err:
@@ -693,8 +693,8 @@
}
/* Setup not mapped run_list element if this is the base extent. */
- if (!attr->lowest_vcn) {
+ if (!attr->_ANR(lowest_vcn)) {
VCN max_cluster;
- max_cluster = (sle64_to_cpu(attr->allocated_size) +
+ max_cluster = (sle64_to_cpu(attr->_ANR(allocated_size)) +
vol->cluster_size - 1) >>
vol->cluster_size_bits;
@@ -1012,6 +1012,6 @@
register int rc;
- rc = memcmp(val, (u8*)a +le16_to_cpu(a->value_offset),
- min(val_len, le32_to_cpu(a->value_length)));
+ rc = memcmp(val, (u8*)a +le16_to_cpu(a->_ARA(value_offset)),
+ min(val_len, le32_to_cpu(a->_ARA(value_length))));
/*
* If @val collates before the current attribute's
@@ -1020,5 +1020,5 @@
if (!rc) {
register u32 avl;
- avl = le32_to_cpu(a->value_length);
+ avl = le32_to_cpu(a->_ARA(value_length));
if (val_len == avl)
return TRUE;
@@ -1351,7 +1351,7 @@
* have found it!
*/
- if (!val || (!a->non_resident && le32_to_cpu(a->value_length)
+ if (!val || (!a->non_resident && le32_to_cpu(a->_ARA(value_length))
== val_len && !memcmp((u8*)a +
- le16_to_cpu(a->value_offset), val, val_len))) {
+ le16_to_cpu(a->_ARA(value_offset)), val, val_len))) {
ntfs_debug("Done, found.");
return TRUE;
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/attrib.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -U2 -r1.15 -r1.16
--- attrib.h 10 Feb 2002 02:22:58 -0000 1.15
+++ attrib.h 25 Feb 2002 04:00:58 -0000 1.16
@@ -4,4 +4,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -87,6 +88,6 @@
{
if (!a->non_resident)
- return (s64)le32_to_cpu(a->value_length);
- return sle64_to_cpu(a->data_size);
+ return (s64)le32_to_cpu(a->_ARA(value_length));
+ return sle64_to_cpu(a->_ANR(data_size));
}
Index: compress.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/compress.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -U2 -r1.32 -r1.33
--- compress.c 14 Feb 2002 06:07:14 -0000 1.32
+++ compress.c 25 Feb 2002 04:00:58 -0000 1.33
@@ -4,4 +4,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -448,5 +449,5 @@
struct buffer_head **bhs;
unsigned long offset, index = page->index;
- u32 cb_size = ni->compression_block_size;
+ u32 cb_size = ni->_ICF(compression_block_size);
u64 cb_size_mask = cb_size - 1UL;
VCN vcn;
@@ -463,5 +464,5 @@
/* Number of compression blocks (cbs) in the wanted vcn range. */
unsigned int nr_cbs = (end_vcn - start_vcn) << vol->cluster_size_bits
- >> ni->compression_block_size_bits;
+ >> ni->_ICF(compression_block_size_bits);
/*
* Number of pages required to store the uncompressed data from all
@@ -548,5 +549,5 @@
cur_page = 0;
cur_ofs = 0;
- cb_clusters = ni->compression_block_clusters;
+ cb_clusters = ni->_ICF(compression_block_clusters);
do_next_cb:
nr_cbs--;
Index: dir.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/dir.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -U2 -r1.46 -r1.47
--- dir.c 14 Feb 2002 01:08:46 -0000 1.46
+++ dir.c 25 Feb 2002 04:00:58 -0000 1.47
@@ -3,4 +3,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -88,5 +89,5 @@
/* Get to the index root value (it's been verified in read_inode). */
ir = (INDEX_ROOT*)((u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)));
index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length);
/* The first index entry. */
@@ -97,9 +98,9 @@
* reach the last entry.
*/
- for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
+ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->_IEH(length)))) {
/* Bounds checks. */
if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
- (u8*)ie + le16_to_cpu(ie->key_length) >
+ (u8*)ie + le16_to_cpu(ie->_IEH(key_length)) >
index_end)
goto dir_err_out;
@@ -108,5 +109,5 @@
* a pointer to a child node in the B+tree so we just break out.
*/
- if (ie->flags & INDEX_ENTRY_END)
+ if (ie->_IEH(flags) & INDEX_ENTRY_END)
break;
/*
@@ -133,5 +134,5 @@
vol->upcase, vol->upcase_len)) {
found_it:
- mref = le64_to_cpu(ie->indexed_file);
+ mref = le64_to_cpu(ie->_IIF(indexed_file));
put_attr_search_ctx(ctx);
unmap_mft_record(READ, dir_ni);
@@ -180,5 +181,5 @@
* presence of a child node.
*/
- if (!(ie->flags & INDEX_ENTRY_NODE)) {
+ if (!(ie->_IEH(flags) & INDEX_ENTRY_NODE)) {
/* No child node, return -ENOENT. */
err = -ENOENT;
@@ -195,5 +196,5 @@
}
/* Get the starting vcn of the index_block holding the child node. */
- vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8);
+ vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->_IEH(length)) - 8);
ia_mapping = VFS_I(dir_ni)->i_mapping;
descend_into_child_node:
@@ -203,5 +204,5 @@
* disk if necessary.
*/
- page = ntfs_map_page(ia_mapping, vcn << dir_ni->index_vcn_size_bits
+ page = ntfs_map_page(ia_mapping, vcn << dir_ni->_IDM(index_vcn_size_bits)
>> PAGE_CACHE_SHIFT);
if (IS_ERR(page)) {
@@ -213,5 +214,5 @@
fast_descend_into_child_node:
/* Get to the index allocation block. */
- ia = (INDEX_ALLOCATION*)(kaddr + ((vcn << dir_ni->index_vcn_size_bits) &
+ ia = (INDEX_ALLOCATION*)(kaddr + ((vcn << dir_ni->_IDM(index_vcn_size_bits)) &
~PAGE_CACHE_MASK));
/* Bounds checks. */
@@ -234,5 +235,5 @@
}
if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
- dir_ni->index_block_size) {
+ dir_ni->_IDM(index_block_size)) {
ntfs_error(sb, "Index buffer (VCN %Li) of directory inode %Li "
"has a size (%u) differing from the directory "
@@ -242,9 +243,9 @@
(unsigned long long)dir_ni->mft_no,
le32_to_cpu(ia->index.allocated_size) + 0x18,
- dir_ni->index_block_size);
+ dir_ni->_IDM(index_block_size));
err = -EIO;
goto unm_unm_err_out;
}
- index_end = (u8*)ia + dir_ni->index_block_size;
+ index_end = (u8*)ia + dir_ni->_IDM(index_block_size);
if (index_end > kaddr + PAGE_CACHE_SIZE) {
ntfs_error(sb, "Index buffer (VCN %Li) of directory inode %Li "
@@ -257,5 +258,5 @@
}
index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
- if (index_end > (u8*)ia + dir_ni->index_block_size) {
+ if (index_end > (u8*)ia + dir_ni->_IDM(index_block_size)) {
ntfs_error(sb, "Size of index buffer (VCN %Li) of directory "
"inode %Li exceeds maximum size.",
@@ -273,9 +274,9 @@
* reach the last entry.
*/
- for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
+ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->_IEH(length)))) {
/* Bounds check. */
if ((u8*)ie < (u8*)ia || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
- (u8*)ie + le16_to_cpu(ie->key_length) >
+ (u8*)ie + le16_to_cpu(ie->_IEH(key_length)) >
index_end) {
ntfs_error(sb, "Index entry out of bounds in "
@@ -289,5 +290,5 @@
* a pointer to a child node in the B+tree so we just break out.
*/
- if (ie->flags & INDEX_ENTRY_END)
+ if (ie->_IEH(flags) & INDEX_ENTRY_END)
break;
/*
@@ -314,5 +315,5 @@
vol->upcase, vol->upcase_len)) {
found_it2:
- mref = le64_to_cpu(ie->indexed_file);
+ mref = le64_to_cpu(ie->_IIF(indexed_file));
ntfs_unmap_page(page);
put_attr_search_ctx(ctx);
@@ -362,5 +363,5 @@
* the presence of a child node.
*/
- if (ie->flags & INDEX_ENTRY_NODE) {
+ if (ie->_IEH(flags) & INDEX_ENTRY_NODE) {
if ((ia->index.flags & NODE_MASK) == LEAF_NODE) {
ntfs_error(sb, "Index entry with child node found in "
@@ -372,5 +373,5 @@
/* Child node present, descend into it. */
old_vcn = vcn;
- vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8);
+ vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->_IEH(length)) - 8);
if (vcn >= 0) {
/* If vcn is in the same page cache page as old_vcn we
@@ -437,5 +438,5 @@
filp->f_pos = (u8*)ie - (u8*)iu.ia +
(sle64_to_cpu(iu.ia->index_block_vcn) <<
- ndir->index_vcn_size_bits) +
+ ndir->_IDM(index_vcn_size_bits)) +
vol->mft_record_size;
else /* if (index_type == INDEX_TYPE_ROOT) */
@@ -445,5 +446,5 @@
return 0;
}
- if (MREF_LE(ie->indexed_file) == FILE_root) {
+ if (MREF_LE(ie->_IIF(indexed_file)) == FILE_root) {
ntfs_debug("Skipping root directory self reference entry.");
return 0;
@@ -463,8 +464,8 @@
ntfs_debug("Calling filldir for %s with len %i, f_pos 0x%Lx, inode "
"0x%Lx, DT_%s.", name, name_len, filp->f_pos,
- (unsigned long long)MREF_LE(ie->indexed_file),
+ (unsigned long long)MREF_LE(ie->_IIF(indexed_file)),
dt_type == DT_DIR ? "DIR" : "REG");
return filldir(dirent, name, name_len, filp->f_pos,
- (unsigned long)MREF_LE(ie->indexed_file), dt_type);
+ (unsigned long)MREF_LE(ie->_IIF(indexed_file)), dt_type);
}
@@ -559,5 +560,5 @@
/* Get to the index root value (it's been verified in read_inode). */
ir = (INDEX_ROOT*)((u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)));
index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length);
/* The first index entry. */
@@ -569,14 +570,14 @@
* or signals an error (both covered by the rc test).
*/
- for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
+ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->_IEH(length)))) {
ntfs_debug("In index root, offset 0x%x.", (u8*)ie - (u8*)ir);
/* Bounds checks. */
if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
- (u8*)ie + le16_to_cpu(ie->key_length) >
+ (u8*)ie + le16_to_cpu(ie->_IEH(key_length)) >
index_end)
goto dir_err_out;
/* The last entry cannot contain a name. */
- if (ie->flags & INDEX_ENTRY_END)
+ if (ie->_IEH(flags) & INDEX_ENTRY_END)
break;
/* Skip index root entry if continuing previous readdir. */
@@ -617,5 +618,5 @@
goto kf_unm_err_out;
}
- bmp = (u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset);
+ bmp = (u8*)ctx->attr + le16_to_cpu(ctx->attr->_ARA(value_offset));
}
/* Get the offset into the index allocation attribute. */
@@ -623,9 +624,9 @@
ia_mapping = vdir->i_mapping;
/* If the index block is not in use find the next one that is. */
- bmp_pos = ia_pos >> ndir->index_block_size_bits;
+ bmp_pos = ia_pos >> ndir->_IDM(index_block_size_bits);
page = NULL;
kaddr = NULL;
prev_ia_pos = -1LL;
- if (bmp_pos >> 3 >= ndir->bmp_size) {
+ if (bmp_pos >> 3 >= ndir->_IDM(bmp_size)) {
ntfs_error(sb, "Current index allocation position exceeds "
"index bitmap size.");
@@ -636,7 +637,7 @@
bmp_pos++;
/* If we have reached the end of the bitmap, we are done. */
- if (bmp_pos >> 3 >= ndir->bmp_size)
+ if (bmp_pos >> 3 >= ndir->_IDM(bmp_size))
goto EOD;
- ia_pos = (s64)bmp_pos << ndir->index_block_size_bits;
+ ia_pos = (s64)bmp_pos << ndir->_IDM(index_block_size_bits);
}
ntfs_debug("Handling index buffer 0x%x.", bmp_pos);
@@ -657,5 +658,5 @@
/* Get the current index buffer. */
ia = (INDEX_ALLOCATION*)(kaddr + (ia_pos & ~PAGE_CACHE_MASK &
- ~(s64)(ndir->index_block_size - 1)));
+ ~(s64)(ndir->_IDM(index_block_size) - 1)));
/* Bounds checks. */
if ((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_CACHE_SIZE) {
@@ -667,6 +668,6 @@
}
if (sle64_to_cpu(ia->index_block_vcn) != (ia_pos &
- ~(s64)(ndir->index_block_size - 1)) >>
- ndir->index_vcn_size_bits) {
+ ~(s64)(ndir->_IDM(index_block_size) - 1)) >>
+ ndir->_IDM(index_vcn_size_bits)) {
ntfs_error(sb, "Actual VCN (%Li) of index buffer is "
"different from expected VCN (%Li). "
@@ -674,5 +675,5 @@
"driver bug. ",
(long long)sle64_to_cpu(ia->index_block_vcn),
- (long long)ia_pos >> ndir->index_vcn_size_bits,
+ (long long)ia_pos >> ndir->_IDM(index_vcn_size_bits),
(unsigned long long)ndir->mft_no);
err = -EIO;
@@ -680,17 +681,17 @@
}
if (le32_to_cpu(ia->index.allocated_size) + 0x18 !=
- ndir->index_block_size) {
+ ndir->_IDM(index_block_size)) {
ntfs_error(sb, "Index buffer (VCN %Li) of directory inode %Li "
"has a size (%u) differing from the directory "
"specified size (%u). Directory inode is "
"corrupt or driver bug.", (long long)ia_pos >>
- ndir->index_vcn_size_bits,
+ ndir->_IDM(index_vcn_size_bits),
(unsigned long long)ndir->mft_no,
le32_to_cpu(ia->index.allocated_size) + 0x18,
- ndir->index_block_size);
+ ndir->_IDM(index_block_size));
err = -EIO;
goto unm_dir_err_out;
}
- index_end = (u8*)ia + ndir->index_block_size;
+ index_end = (u8*)ia + ndir->_IDM(index_block_size);
if (index_end > kaddr + PAGE_CACHE_SIZE) {
ntfs_error(sb, "Index buffer (VCN %Li) of directory inode %Li "
@@ -698,15 +699,15 @@
"access! This is probably a bug in the "
"driver.", (long long)ia_pos >>
- ndir->index_vcn_size_bits,
+ ndir->_IDM(index_vcn_size_bits),
(unsigned long long)ndir->mft_no);
err = -EIO;
goto unm_dir_err_out;
}
- ia_start = ia_pos & ~(s64)(ndir->index_block_size - 1);
+ ia_start = ia_pos & ~(s64)(ndir->_IDM(index_block_size) - 1);
index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length);
- if (index_end > (u8*)ia + ndir->index_block_size) {
+ if (index_end > (u8*)ia + ndir->_IDM(index_block_size)) {
ntfs_error(sb, "Size of index buffer (VCN %Li) of directory "
"inode %Li exceeds maximum size.",
- (long long)ia_pos >> ndir->index_vcn_size_bits,
+ (long long)ia_pos >> ndir->_IDM(index_vcn_size_bits),
(unsigned long long)ndir->mft_no);
err = -EIO;
@@ -721,5 +722,5 @@
* or signals an error (both covered by the rc test).
*/
- for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
+ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->_IEH(length)))) {
ntfs_debug("In index allocation, offset 0x%Lx.",
(long long)ia_start + ((u8*)ie - (u8*)ia));
@@ -727,9 +728,9 @@
if ((u8*)ie < (u8*)ia || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
- (u8*)ie + le16_to_cpu(ie->key_length) >
+ (u8*)ie + le16_to_cpu(ie->_IEH(key_length)) >
index_end)
goto unm_dir_err_out;
/* The last entry cannot contain a name. */
- if (ie->flags & INDEX_ENTRY_END)
+ if (ie->_IEH(flags) & INDEX_ENTRY_END)
break;
/* Skip index block entry if continuing previous readdir. */
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/inode.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -U2 -r1.68 -r1.69
--- inode.c 14 Feb 2002 06:07:14 -0000 1.68
+++ inode.c 25 Feb 2002 04:00:58 -0000 1.69
@@ -3,4 +3,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (C) 2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -84,7 +85,7 @@
ni->attr_list = NULL;
ni->attr_list_rl = NULL;
- ni->bmp_rl = NULL;
+ ni->_IDM(bmp_rl) = NULL;
init_MUTEX(&ni->extent_lock);
- ni->base_ntfs_ino = NULL;
+ ni->_INE(base_ntfs_ino) = NULL;
ni->vol = NTFS_SB(sb);
return;
@@ -164,5 +165,5 @@
return -EIO;
}
- if (!(attr->resident_flags & RESIDENT_ATTR_IS_INDEXED)) {
+ if (!(attr->_ARA(resident_flags) & RESIDENT_ATTR_IS_INDEXED)) {
ntfs_error(ctx->ntfs_ino->vol->sb, "Unindexed file "
"name. You should run chkdsk.");
@@ -170,6 +171,6 @@
}
file_name_attr = (FILE_NAME_ATTR*)((u8*)attr +
- le16_to_cpu(attr->value_offset));
- p2 = (u8*)attr + le32_to_cpu(attr->value_length);
+ le16_to_cpu(attr->_ARA(value_offset)));
+ p2 = (u8*)attr + le32_to_cpu(attr->_ARA(value_length));
if (p2 < (u8*)attr || p2 > p)
goto err_corrupt_attr;
@@ -321,5 +322,5 @@
/* Get the standard information attribute value. */
si = (STANDARD_INFORMATION*)((char*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)));
/* Transfer information from the standard information into vfs_ino. */
@@ -398,6 +399,6 @@
} else /* if (!ctx.attr->non_resident) */ {
if ((u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset) +
- le32_to_cpu(ctx->attr->value_length) >
+ le16_to_cpu(ctx->attr->_ARA(value_offset)) +
+ le32_to_cpu(ctx->attr->_ARA(value_length)) >
(u8*)ctx->mrec + vol->mft_record_size) {
ntfs_error(vi->i_sb, "Corrupt attribute list "
@@ -407,6 +408,6 @@
/* Now copy the attribute list. */
memcpy(ni->attr_list, (u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset),
- le32_to_cpu(ctx->attr->value_length));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)),
+ le32_to_cpu(ctx->attr->_ARA(value_length)));
}
}
@@ -453,6 +454,6 @@
}
ir = (INDEX_ROOT*)((char*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset));
- ir_end = (char*)ir + le32_to_cpu(ctx->attr->value_length);
+ le16_to_cpu(ctx->attr->_ARA(value_offset)));
+ ir_end = (char*)ir + le32_to_cpu(ctx->attr->_ARA(value_length));
if (ir_end > (char*)ctx->mrec + vol->mft_record_size) {
ntfs_error(vi->i_sb, "$INDEX_ROOT attribute is "
@@ -477,35 +478,35 @@
goto put_unm_err_out;
}
- ni->index_block_size = le32_to_cpu(ir->index_block_size);
- if (ni->index_block_size & (ni->index_block_size - 1)) {
+ ni->_IDM(index_block_size) = le32_to_cpu(ir->index_block_size);
+ if (ni->_IDM(index_block_size) & (ni->_IDM(index_block_size) - 1)) {
ntfs_error(vi->i_sb, "Index block size (%u) is not a "
- "power of two.", ni->index_block_size);
+ "power of two.", ni->_IDM(index_block_size));
goto put_unm_err_out;
}
- if (ni->index_block_size > PAGE_CACHE_SIZE) {
+ if (ni->_IDM(index_block_size) > PAGE_CACHE_SIZE) {
ntfs_error(vi->i_sb, "Index block size (%u) > "
"PAGE_CACHE_SIZE (%ld) is not "
"supported. Sorry.",
- ni->index_block_size,
+ ni->_IDM(index_block_size),
PAGE_CACHE_SIZE);
err = -EOPNOTSUPP;
goto ec_put_unm_err_out;
}
- if (ni->index_block_size < NTFS_BLOCK_SIZE) {
+ if (ni->_IDM(index_block_size) < NTFS_BLOCK_SIZE) {
ntfs_error(vi->i_sb, "Index block size (%u) < "
"NTFS_BLOCK_SIZE (%i) is not "
"supported. Sorry.",
- ni->index_block_size, NTFS_BLOCK_SIZE);
+ ni->_IDM(index_block_size), NTFS_BLOCK_SIZE);
err = -EOPNOTSUPP;
goto ec_put_unm_err_out;
}
- ni->index_block_size_bits = ffs(ni->index_block_size) - 1;
+ ni->_IDM(index_block_size_bits) = ffs(ni->_IDM(index_block_size)) - 1;
/* Determine the size of a vcn in the directory index. */
- if (vol->cluster_size <= ni->index_block_size) {
- ni->index_vcn_size = vol->cluster_size;
- ni->index_vcn_size_bits = vol->cluster_size_bits;
+ if (vol->cluster_size <= ni->_IDM(index_block_size)) {
+ ni->_IDM(index_vcn_size) = vol->cluster_size;
+ ni->_IDM(index_vcn_size_bits) = vol->cluster_size_bits;
} else {
- ni->index_vcn_size = vol->sector_size;
- ni->index_vcn_size_bits = vol->sector_size_bits;
+ ni->_IDM(index_vcn_size) = vol->sector_size;
+ ni->_IDM(index_vcn_size_bits) = vol->sector_size_bits;
}
if (!(ir->index.flags & LARGE_INDEX)) {
@@ -539,8 +540,8 @@
goto put_unm_err_out;
}
- if (!sle64_to_cpu(ctx->attr->lowest_vcn)) {
- vi->i_size = sle64_to_cpu(ctx->attr->data_size);
+ if (!sle64_to_cpu(ctx->attr->_ANR(lowest_vcn))) {
+ vi->i_size = sle64_to_cpu(ctx->attr->_ANR(data_size));
ni->initialized_size = sle64_to_cpu(
- ctx->attr->initialized_size);
+ ctx->attr->_ANR(initialized_size));
} else
/*
@@ -552,5 +553,5 @@
*/
vi->i_size = ni->initialized_size =
- sle64_to_cpu(ctx->attr->highest_vcn)
+ sle64_to_cpu(ctx->attr->_ANR(highest_vcn))
<< vol->cluster_size_bits;
/* Setup the run list. */
@@ -579,7 +580,7 @@
if (ctx->attr->non_resident) {
ni->state |= 1 << NI_BmpNonResident;
- if (!sle64_to_cpu(ctx->attr->lowest_vcn))
- ni->bmp_size = sle64_to_cpu(
- ctx->attr->data_size);
+ if (!sle64_to_cpu(ctx->attr->_ANR(lowest_vcn)))
+ ni->_IDM(bmp_size) = sle64_to_cpu(
+ ctx->attr->_ANR(data_size));
else
/*
@@ -590,13 +591,13 @@
* ridiculously big / very fragmented or sparse.
*/
- ni->bmp_size = sle64_to_cpu(
- ctx->attr->highest_vcn)
+ ni->_IDM(bmp_size) = sle64_to_cpu(
+ ctx->attr->_ANR(highest_vcn))
<< vol->cluster_size_bits;
/* Setup the run list. */
- ni->bmp_rl = decompress_mapping_pairs(vol, ctx->attr,
+ ni->_IDM(bmp_rl) = decompress_mapping_pairs(vol, ctx->attr,
NULL);
- if (IS_ERR(ni->bmp_rl)) {
- err = PTR_ERR(ni->bmp_rl);
- ni->bmp_rl = NULL;
+ if (IS_ERR(ni->_IDM(bmp_rl))) {
+ err = PTR_ERR(ni->_IDM(bmp_rl));
+ ni->_IDM(bmp_rl) = NULL;
ntfs_error(vi->i_sb, "Mapping pairs "
"decompression failed with "
@@ -605,11 +606,11 @@
}
} else
- ni->bmp_size = le32_to_cpu(ctx->attr->value_length);
+ ni->_IDM(bmp_size) = le32_to_cpu(ctx->attr->_ARA(value_length));
/* Consistency check bitmap size vs. index allocation size. */
- if (ni->bmp_size << 3 < ni->initialized_size >>
- ni->index_block_size_bits) {
+ if (ni->_IDM(bmp_size) << 3 < ni->initialized_size >>
+ ni->_IDM(index_block_size_bits)) {
ntfs_error(vi->i_sb, "$I30 bitmap too small (0x%Lx) "
"for index allocation (0x%Lx).",
- (long long)ni->bmp_size << 3,
+ (long long)ni->_IDM(bmp_size) << 3,
(long long)ni->initialized_size);
goto put_unm_err_out;
@@ -678,7 +679,7 @@
goto put_unm_err_out;
}
- ni->compression_block_clusters = 1U <<
- ctx->attr->compression_unit;
- if (ctx->attr->compression_unit != 4) {
+ ni->_ICF(compression_block_clusters) = 1U <<
+ ctx->attr->_ANR(compression_unit);
+ if (ctx->attr->_ANR(compression_unit) != 4) {
ntfs_error(vi->i_sb, "Found "
"nonstandard compression unit "
@@ -687,13 +688,13 @@
"indicate corruption so you "
"should run chkdsk.",
- ctx->attr->compression_unit);
+ ctx->attr->_ANR(compression_unit));
err = -EOPNOTSUPP;
goto ec_put_unm_err_out;
}
- ni->compression_block_size = 1U <<
- (ctx->attr->compression_unit +
+ ni->_ICF(compression_block_size) = 1U <<
+ (ctx->attr->_ANR(compression_unit) +
vol->cluster_size_bits);
- ni->compression_block_size_bits = ffs(
- ni->compression_block_size) - 1;
+ ni->_ICF(compression_block_size_bits) = ffs(
+ ni->_ICF(compression_block_size)) - 1;
}
if (ctx->attr->flags & ATTR_IS_ENCRYPTED) {
@@ -719,5 +720,5 @@
}
}
- if (sle64_to_cpu(ctx->attr->lowest_vcn))
+ if (sle64_to_cpu(ctx->attr->_ANR(lowest_vcn)))
/*
* Just a rough guess as ->*_size are not
@@ -730,13 +731,13 @@
vi->i_size = ni->initialized_size =
sle64_to_cpu(
- ctx->attr->highest_vcn) <<
+ ctx->attr->_ANR(highest_vcn)) <<
vol->cluster_size_bits;
else {
- vi->i_size = sle64_to_cpu(ctx->attr->data_size);
+ vi->i_size = sle64_to_cpu(ctx->attr->_ANR(data_size));
ni->initialized_size = sle64_to_cpu(
- ctx->attr->initialized_size);
+ ctx->attr->_ANR(initialized_size));
}
} else { /* Resident attribute. */
- vi->i_size = le32_to_cpu(ctx->attr->value_length);
+ vi->i_size = le32_to_cpu(ctx->attr->_ARA(value_length));
ni->initialized_size = 0LL;
}
@@ -834,6 +835,6 @@
* completion handler for directories.
*/
- ni->index_block_size = vol->mft_record_size;
- ni->index_block_size_bits = vol->mft_record_size_bits;
+ ni->_IDM(index_block_size) = vol->mft_record_size;
+ ni->_IDM(index_block_size_bits) = vol->mft_record_size_bits;
/* Very important! Needed to be able to call map_mft_record*(). */
@@ -937,6 +938,6 @@
} else /* if (!ctx.attr->non_resident) */ {
if ((u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset) +
- le32_to_cpu(ctx->attr->value_length) >
+ le16_to_cpu(ctx->attr->_ARA(value_offset)) +
+ le32_to_cpu(ctx->attr->_ARA(value_length)) >
(u8*)ctx->mrec + vol->mft_record_size) {
ntfs_error(sb, "Corrupt attribute list "
@@ -946,6 +947,6 @@
/* Now copy the attribute list. */
memcpy(ni->attr_list, (u8*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset),
- le32_to_cpu(ctx->attr->value_length));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)),
+ le32_to_cpu(ctx->attr->_ARA(value_length)));
}
/* The attribute list is now setup in memory. */
@@ -1051,12 +1052,12 @@
if (!next_vcn) {
/* Get the last vcn in the $DATA attribute. */
- last_vcn = sle64_to_cpu(attr->allocated_size) >>
+ last_vcn = sle64_to_cpu(attr->_ANR(allocated_size)) >>
vol->cluster_size_bits;
/* Fill in the inode size. */
- vi->i_size = sle64_to_cpu(attr->data_size);
+ vi->i_size = sle64_to_cpu(attr->_ANR(data_size));
ni->initialized_size =
- sle64_to_cpu(attr->initialized_size);
+ sle64_to_cpu(attr->_ANR(initialized_size));
/* Set the number of mft records. */
- vol->nr_mft_records = vi->i_size >>
+ vol->_VMM(nr_mft_records) = vi->i_size >>
vol->mft_record_size_bits;
/*
@@ -1114,5 +1115,5 @@
/* Get the lowest vcn for the next extent. */
- highest_vcn = sle64_to_cpu(attr->highest_vcn);
+ highest_vcn = sle64_to_cpu(attr->_ANR(highest_vcn));
next_vcn = highest_vcn + 1;
@@ -1122,5 +1123,5 @@
/* Avoid endless loops due to corruption. */
- if (next_vcn < sle64_to_cpu(attr->lowest_vcn)) {
+ if (next_vcn < sle64_to_cpu(attr->_ANR(lowest_vcn))) {
ntfs_error(sb, "$MFT has corrupt attribute list "
"attribute. Run chkdsk.");
@@ -1233,6 +1234,6 @@
// FIXME: Handle dirty case for each extent inode!
for (i = 0; i < ni->nr_extents; i++)
- ntfs_destroy_inode(ni->extent_ntfs_inos[i]);
- kfree(ni->extent_ntfs_inos);
+ ntfs_destroy_inode(ni->_INE(extent_ntfs_inos)[i]);
+ kfree(ni->_INE(extent_ntfs_inos));
}
/* Free all alocated memory. */
@@ -1267,5 +1268,5 @@
if (S_ISDIR(vi->i_mode))
- ntfs_free(ni->bmp_rl);
+ ntfs_free(ni->_IDM(bmp_rl));
return;
}
Index: inode.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/inode.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -U2 -r1.15 -r1.16
--- inode.h 14 Feb 2002 06:07:14 -0000 1.15
+++ in...
[truncated message content] |