Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs
In directory usw-pr-cvs1:/tmp/cvs-serv20799/linux/fs/ntfs
Modified Files:
Tag: pre-95
aops.c attrib.c attrib.h compress.c dir.c inode.c layout.h
mft.c ntfs.h super.c volume.h
Log Message:
merged gcc-2.95 and Anton's holiday changes
Index: aops.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/aops.c,v
retrieving revision 1.53.4.1
retrieving revision 1.53.4.2
diff -U2 -r1.53.4.1 -r1.53.4.2
--- aops.c 4 Mar 2002 19:04:02 -0000 1.53.4.1
+++ aops.c 4 Mar 2002 22:42:49 -0000 1.53.4.2
@@ -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
@@ -234,5 +235,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. */
@@ -254,5 +255,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);
@@ -343,5 +344,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,
@@ -473,5 +474,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++) {
@@ -485,5 +486,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.4.1
retrieving revision 1.65.4.2
diff -U2 -r1.65.4.1 -r1.65.4.2
--- attrib.c 4 Mar 2002 19:04:02 -0000 1.65.4.1
+++ attrib.c 4 Mar 2002 22:42:49 -0000 1.65.4.2
@@ -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
@@ -127,5 +127,5 @@
*
* Append a run_list after element @loc in @orig. Merge the right end of
- * the new run_list, if necesary. Adjust the size of the hole before the
+ * the new run_list, if necessary. Adjust the size of the hole before the
* appended run_list.
*
@@ -145,19 +145,22 @@
BUG_ON (!orig || !new);
+ /* First, merge the right hand end, if necessary. */
right = ntfs_rl_merge (new + nsize - 1, orig + loc + 1);
+ /* Space required: Orig size + New size, less one if we merged. */
res = ntfs_rl_realloc (orig, osize, osize + nsize - right);
if (IS_ERR (res))
return res;
+ /* Move the tail of Orig out of the way, then copy in New. */
rl_mm (res, loc + 1 + nsize, loc + 1 + right, osize - loc - 1 - right);
rl_mc (res, loc + 1, new, 0, nsize);
+ /* Adjust the size of the preceding hole. */
res[loc].length = res[loc+1].vcn - res[loc].vcn;
- if (!right) {
- if (res[loc+nsize+1].lcn == LCN_ENOENT)
- res[loc+nsize+1].vcn = res[loc+nsize].vcn + res[loc+nsize].length;
- }
+ /* We may have changed the length of the file, so fix the end marker */
+ if (res[loc+nsize+1].lcn == LCN_ENOENT)
+ res[loc+nsize+1].vcn = res[loc+nsize].vcn + res[loc+nsize].length;
return res;
@@ -173,5 +176,5 @@
*
* Insert a run_list before element @loc in @orig. Merge the left end of
- * the new run_list, if necesary. Adjust the size of the hole after the
+ * the new run_list, if necessary. Adjust the size of the hole after the
* inserted run_list.
*
@@ -193,5 +196,11 @@
BUG_ON (!orig || !new);
- if (loc > 0) {
+ /* disc => Discontinuity between the end of Orig and the start of New.
+ * This means we might need to insert a hole.
+ * hole => Orig ends with a hole or an unmapped region which we can
+ * extend to match the discontinuity. */
+ if (loc == 0) {
+ disc = (new[0].vcn > 0);
+ } else {
left = ntfs_rl_merge (orig + loc - 1, new);
@@ -199,21 +208,17 @@
if (disc)
hole = (orig[loc-1].lcn == LCN_HOLE);
- } else {
- disc = (new[0].vcn > 0);
}
+ /* Space required: Orig size + New size, less one if we merged,
+ * plus one if there was a discontinuity, less one for a trailing hole */
res = ntfs_rl_realloc (orig, osize, osize + nsize - left + disc - hole);
if (IS_ERR (res))
return res;
+ /* Move the tail of Orig out of the way, then copy in New. */
rl_mm (res, loc + nsize - left + disc - hole, loc, osize - loc);
rl_mc (res, loc + disc - hole, new, left, nsize - left);
- if ((res[loc+nsize-left+disc-hole].lcn == LCN_HOLE) ||
- (res[loc+nsize-left+disc-hole].lcn == LCN_RL_NOT_MAPPED)) {
- res[loc+nsize-left+disc-hole].length -= (new[nsize-1].vcn +
- new[nsize-1].length - new[0].vcn);
- }
-
+ /* Adjust the VCN of the last run ... */
if (res[loc+nsize-left+disc-hole].lcn <= LCN_HOLE) {
res[loc+nsize-left+disc-hole].vcn =
@@ -221,5 +226,13 @@
res[loc+nsize-left+disc-hole-1].length;
}
+ /* ... and the length. */
+ if ((res[loc+nsize-left+disc-hole].lcn == LCN_HOLE) ||
+ (res[loc+nsize-left+disc-hole].lcn == LCN_RL_NOT_MAPPED)) {
+ res[loc+nsize-left+disc-hole].length =
+ res[loc+nsize-left+disc-hole+1].vcn -
+ res[loc+nsize-left+disc-hole].vcn;
+ }
+ /* Writing beyond the end of the file and there's a discontinuity. */
if (disc) {
if (hole) {
@@ -236,7 +249,5 @@
res[loc].lcn = LCN_RL_NOT_MAPPED;
}
- }
- if (disc) {
if (res[loc+nsize-left+disc].lcn == LCN_ENOENT)
res[loc+nsize-left+disc].vcn = res[loc+nsize-left+disc-1].vcn +
@@ -256,5 +267,5 @@
*
* Replace the run_list at @loc with @new. Merge the left and right ends of
- * the inserted run_list, if necesary.
+ * the inserted run_list, if necessary.
*
* It is up to the caller to serialize access to the run lists @orig and @new.
@@ -274,24 +285,24 @@
BUG_ON (!orig || !new);
+ /* First, merge the left and right ends, if necessary. */
right = ntfs_rl_merge (new + nsize - 1, orig + loc + 1);
if (loc > 0)
left = ntfs_rl_merge (orig + loc - 1, new);
+ /* Allocate some space. We'll need less if the left, right
+ * or both ends were merged. */
res = ntfs_rl_realloc (orig, osize, osize + nsize - left - right);
if (IS_ERR (res))
return res;
- rl_mm (res, loc + nsize - left,
- loc + right + 1,
- osize - loc - right - 1);
-
+ /* Move the tail of Orig out of the way, then copy in New. */
+ rl_mm (res, loc + nsize - left, loc + right + 1,
+ osize - loc - right - 1);
rl_mc (res, loc, new, left, nsize - left);
- if (!right) {
- if (res[loc+nsize-left].lcn == LCN_ENOENT)
- res[loc+nsize-left].vcn = res[loc+nsize-left-1].vcn +
- res[loc+nsize-left-1].length;
- }
-
+ /* We may have changed the length of the file, so fix the end marker */
+ if (res[loc+nsize-left].lcn == LCN_ENOENT)
+ res[loc+nsize-left].vcn = res[loc+nsize-left-1].vcn +
+ res[loc+nsize-left-1].length;
return res;
}
@@ -303,5 +314,5 @@
* @new: The run_list to be inserted.
* @nsize: The number of elements in @new (excluding end marker).
- * @loc: Index of run_list @orig to insert @new before.
+ * @loc: Index of run_list in @orig to split with @new.
*
* Split the run_list at @loc into two and insert @new. No merging of
@@ -322,14 +333,17 @@
BUG_ON (!orig || !new);
+ /* Space required: Orig size + New size + One new hole. */
res = ntfs_rl_realloc (orig, osize, osize + nsize + 1);
if (IS_ERR (res))
return res;
+ /* Move the tail of Orig out of the way, then copy in New. */
rl_mm (res, loc + 1 + nsize, loc, osize - loc);
rl_mc (res, loc + 1, new, 0, nsize);
- res[loc].length = res[loc+1].vcn - res[loc].vcn;
- res[loc+nsize+1].vcn = res[loc+nsize].vcn + res[loc+nsize].length;
- res[loc+nsize+1].length -= (new[nsize-1].vcn + new[nsize-1].length - new[0].vcn) + res[loc].length;
+ /* Adjust the size of the holes either size of New. */
+ res[loc].length = res[loc+1].vcn - res[loc].vcn;
+ res[loc+nsize+1].vcn = res[loc+nsize].vcn + res[loc+nsize].length;
+ res[loc+nsize+1].length = res[loc+nsize+2].vcn - res[loc+nsize+1].vcn;
return res;
@@ -572,5 +586,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);
@@ -578,8 +592,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)) {
@@ -707,5 +721,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:
@@ -715,8 +729,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;
@@ -910,4 +924,5 @@
}
+
/**
* find_attr - find (next) attribute in mft record
@@ -1046,6 +1061,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
@@ -1054,5 +1069,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;
@@ -1388,7 +1403,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.6.1
retrieving revision 1.15.6.2
diff -U2 -r1.15.6.1 -r1.15.6.2
--- attrib.h 4 Mar 2002 19:04:02 -0000 1.15.6.1
+++ attrib.h 4 Mar 2002 22:42:49 -0000 1.15.6.2
@@ -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.4.1
retrieving revision 1.32.4.2
diff -U2 -r1.32.4.1 -r1.32.4.2
--- compress.c 4 Mar 2002 19:04:02 -0000 1.32.4.1
+++ compress.c 4 Mar 2002 22:42:49 -0000 1.32.4.2
@@ -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
@@ -453,5 +454,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;
@@ -468,5 +469,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
@@ -553,5 +554,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.4.1
retrieving revision 1.46.4.2
diff -U2 -r1.46.4.1 -r1.46.4.2
--- dir.c 4 Mar 2002 19:04:02 -0000 1.46.4.1
+++ dir.c 4 Mar 2002 22:42:49 -0000 1.46.4.2
@@ -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. */
@@ -235,5 +236,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 0x%Lx) of directory inode "
"0x%Lx has a size (%u) differing from the "
@@ -243,9 +244,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 0x%Lx) of directory inode "
@@ -258,5 +259,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 0x%Lx) of directory "
"inode 0x%Lx exceeds maximum size.",
@@ -274,9 +275,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 "
@@ -290,5 +291,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;
/*
@@ -315,5 +316,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);
@@ -363,5 +364,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 "
@@ -373,5 +374,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
@@ -449,5 +450,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) */
@@ -466,9 +467,9 @@
}
}
- 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;
}
- if (MREF_LE(ie->indexed_file) < FILE_first_user &&
+ if (MREF_LE(ie->_IIF(indexed_file)) < FILE_first_user &&
RHideSystemFiles(readdir_opts)) {
ntfs_debug("Skipping system file.");
@@ -489,8 +490,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);
}
@@ -585,5 +586,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. */
@@ -595,14 +596,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. */
@@ -643,5 +644,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. */
@@ -649,9 +650,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.");
@@ -662,7 +663,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);
@@ -683,5 +684,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) {
@@ -693,6 +694,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 (0x%Lx) of index buffer is "
"different from expected VCN (0x%Lx). "
@@ -700,5 +701,5 @@
"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;
@@ -706,17 +707,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 0x%Lx) 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 >> ndir->index_vcn_size_bits,
+ (long long)ia_pos >> 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 0x%Lx) of directory inode "
@@ -724,15 +725,15 @@
"Cannot 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 0x%Lx) of directory "
"inode 0x%Lx 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;
@@ -747,5 +748,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));
@@ -753,9 +754,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.4.1
retrieving revision 1.68.4.2
diff -U2 -r1.68.4.1 -r1.68.4.2
--- inode.c 4 Mar 2002 19:04:02 -0000 1.68.4.1
+++ inode.c 4 Mar 2002 22:42:49 -0000 1.68.4.2
@@ -84,7 +84,7 @@
ni->attr_list = NULL;
INIT_RUN_LIST(&ni->attr_list_rl);
- INIT_RUN_LIST(&ni->bmp_rl);
+ INIT_RUN_LIST(&ni->_IDM(bmp_rl));
init_MUTEX(&ni->extent_lock);
- ni->base_ntfs_ino = NULL;
+ ni->_INE(base_ntfs_ino) = NULL;
ni->vol = NTFS_SB(sb);
return;
@@ -164,5 +164,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 +170,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 +321,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. */
@@ -404,6 +404,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 "
@@ -413,6 +413,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)));
}
}
@@ -460,6 +460,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 "
@@ -484,35 +484,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)) {
@@ -546,8 +546,8 @@
goto put_unm_err_out;
}
- 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);
- ni->allocated_size = sle64_to_cpu(ctx->attr->allocated_size);
+ ctx->attr->_ANR(initialized_size));
+ ni->allocated_size = sle64_to_cpu(ctx->attr->_ANR(allocated_size));
/*
* Setup the run list. No need for locking as we have exclusive
@@ -579,19 +579,19 @@
if (ctx->attr->non_resident) {
ni->state |= 1 << NI_BmpNonResident;
- ni->bmp_size = sle64_to_cpu(
- ctx->attr->data_size);
- ni->bmp_initialized_size = sle64_to_cpu(
- ctx->attr->initialized_size);
- ni->bmp_allocated_size = sle64_to_cpu(
- ctx->attr...
[truncated message content] |