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->allocated_size);
+ ni->_IDM(bmp_size) = sle64_to_cpu(
+ ctx->attr->_ANR(data_size));
+ ni->_IDM(bmp_initialized_size) = sle64_to_cpu(
+ ctx->attr->_ANR(initialized_size));
+ ni->_IDM(bmp_allocated_size) = sle64_to_cpu(
+ ctx->attr->_ANR(allocated_size));
/*
* Setup the run list. No need for locking as we have
* exclusive access to the inode at this time.
*/
- ni->bmp_rl.rl = decompress_mapping_pairs(vol, ctx->attr,
+ ni->_IDM(bmp_rl).rl = decompress_mapping_pairs(vol, ctx->attr,
NULL);
- if (IS_ERR(ni->bmp_rl.rl)) {
- err = PTR_ERR(ni->bmp_rl.rl);
- ni->bmp_rl.rl = NULL;
+ if (IS_ERR(ni->_IDM(bmp_rl).rl)) {
+ err = PTR_ERR(ni->_IDM(bmp_rl).rl);
+ ni->_IDM(bmp_rl).rl = NULL;
ntfs_error(vi->i_sb, "Mapping pairs "
"decompression failed with "
@@ -600,13 +600,13 @@
}
} else
- ni->bmp_size = ni->bmp_initialized_size =
- ni->bmp_allocated_size =
- le32_to_cpu(ctx->attr->value_length);
+ ni->_IDM(bmp_size) = ni->_IDM(bmp_initialized_size) =
+ ni->_IDM(bmp_allocated_size) =
+ le32_to_cpu(ctx->attr->_ARA(value_length));
/* Consistency check bitmap size vs. index allocation size. */
- if (ni->bmp_size << 3 < vi->i_size >>
- ni->index_block_size_bits) {
+ if (ni->_IDM(bmp_size) << 3 < vi->i_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,
vi->i_size);
goto put_unm_err_out;
@@ -676,7 +676,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 "
@@ -685,13 +685,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) {
@@ -723,12 +723,12 @@
}
/* Setup all the sizes. */
- 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));
ni->allocated_size = sle64_to_cpu(
- ctx->attr->allocated_size);
+ ctx->attr->_ANR(allocated_size));
if (NInoCompressed(ni))
- ni->compressed_size = sle64_to_cpu(
- ctx->attr->compressed_size);
+ ni->_ICF(compressed_size) = sle64_to_cpu(
+ ctx->attr->_ANR(compressed_size));
} else { /* Resident attribute. */
/*
@@ -739,5 +739,5 @@
*/
vi->i_size = ni->initialized_size = ni->allocated_size =
- le32_to_cpu(ctx->attr->value_length);
+ le32_to_cpu(ctx->attr->_ARA(value_length));
}
no_data_attr_special_case:
@@ -770,5 +770,5 @@
vi->i_blocks = ni->allocated_size >> 9;
else
- vi->i_blocks = ni->compressed_size >> 9;
+ vi->i_blocks = ni->_ICF(compressed_size) >> 9;
/* Done. */
put_attr_search_ctx(ctx);
@@ -847,6 +847,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*(). */
@@ -950,6 +950,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 "
@@ -959,6 +959,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. */
@@ -1066,14 +1066,14 @@
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));
ni->allocated_size =
- sle64_to_cpu(attr->allocated_size);
+ sle64_to_cpu(attr->_ANR(allocated_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;
/*
@@ -1131,5 +1131,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;
@@ -1139,5 +1139,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.");
@@ -1250,6 +1250,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. */
@@ -1292,7 +1292,7 @@
if (S_ISDIR(vi->i_mode)) {
- write_lock(&ni->bmp_rl.lock);
- ntfs_free(ni->bmp_rl.rl);
- write_unlock(&ni->bmp_rl.lock);
+ write_lock(&ni->_IDM(bmp_rl).lock);
+ ntfs_free(ni->_IDM(bmp_rl).rl);
+ write_unlock(&ni->_IDM(bmp_rl).lock);
}
return;
Index: layout.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/layout.h,v
retrieving revision 1.10
retrieving revision 1.10.6.1
diff -U2 -r1.10 -r1.10.6.1
--- layout.h 3 Feb 2002 19:31:17 -0000 1.10
+++ layout.h 4 Mar 2002 22:42:49 -0000 1.10.6.1
@@ -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
@@ -286,5 +287,5 @@
typedef struct {
/*Ofs*/
-/* 0*/ NTFS_RECORD; /* Usually the magic is "FILE". */
+/* 0*/ NTFS_RECORD SN(mnr); /* Usually the magic is "FILE". */
/* 8*/ u64 lsn; /* $LogFile sequence number for this record.
Changed every time the record is modified. */
@@ -350,4 +351,6 @@
} __attribute__ ((__packed__)) MFT_RECORD;
+#define _MNR(X) SC(mnr,X)
+
/*
* System defined attributes (32-bit). Each attribute type has a corresponding
@@ -603,5 +606,5 @@
/* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte
boundary. */
- } __attribute__ ((__packed__));
+ } SN(ara) __attribute__ ((__packed__));
/* Non-resident attributes. */
struct {
@@ -653,8 +656,11 @@
disk space being used on the disk. */
/* sizeof(compressed attr) = 72*/
- } __attribute__ ((__packed__));
- } __attribute__ ((__packed__));
+ } SN(anr) __attribute__ ((__packed__));
+ } SN(aua) __attribute__ ((__packed__));
} __attribute__ ((__packed__)) ATTR_RECORD;
+#define _ARA(X) SC(aua.ara,X)
+#define _ANR(X) SC(aua.anr,X)
+
typedef ATTR_RECORD ATTR_REC;
@@ -803,9 +809,11 @@
journal is a very fast process, so the user
won't even notice it. */
- };
- };
+ } SN(svs);
+ } SN(sei);
/* sizeof() = 72 bytes (NTFS 3.0) */
} __attribute__ ((__packed__)) STANDARD_INFORMATION;
+#define _SVS(X) SC(sei.svs,X)
+
/*
* Attribute: Attribute list (0x20).
@@ -940,10 +948,10 @@
(EAs), if such are present.*/
/* 3e*/ u16 reserved; /* Reserved for alignment. */
- } __attribute__ ((__packed__));
+ } SN(fea) __attribute__ ((__packed__));
/* 3c*/ u32 reparse_point_tag; /* Type of reparse point,
present only in reparse
points and only if there are
no EAs. */
- } __attribute__ ((__packed__));
+ } SN(fer) __attribute__ ((__packed__));
/* 40*/ u8 file_name_length; /* Length of file name in
(Unicode) characters. */
@@ -952,4 +960,7 @@
} __attribute__ ((__packed__)) FILE_NAME_ATTR;
+#define _FEA(X) SC(fer.fea,X)
+#define _FER(X) SC(fer,X)
+
/*
* GUID structures store globally unique identifiers (GUID). A GUID is a
@@ -989,7 +1000,7 @@
GUID birth_object_id;
GUID domain_id;
- } __attribute__ ((__packed__));
+ } SN(obv) __attribute__ ((__packed__));
u8 extended_info[48];
- } __attribute__ ((__packed__));
+ } SN(oei) __attribute__ ((__packed__));
} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA;
@@ -1013,9 +1024,11 @@
first created. */
GUID domain_id; /* Reserved, zero. */
- } __attribute__ ((__packed__));
+ } SN(obv) __attribute__ ((__packed__));
u8 extended_info[48];
- } __attribute__ ((__packed__));
+ } SN(oei) __attribute__ ((__packed__));
} __attribute__ ((__packed__)) OBJECT_ID_ATTR;
+#define _OBV(X) SC(oei.obv,X)
+
/*
* The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in
@@ -1155,8 +1168,10 @@
u32 low_part; /* Low 32-bits. */
u16 high_part; /* High 16-bits. */
- } __attribute__ ((__packed__));
+ } SN(sia) __attribute__ ((__packed__));
u8 value[6]; /* Value as individual bytes. */
} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY;
+#define _SIA(X) SC(sia,X)
+
/*
* The SID structure is a variable-length structure used to uniquely identify
@@ -1423,9 +1438,10 @@
*/
typedef struct {
- ACE_HEADER; /* The ACE header. */
+ ACE_HEADER SN(aah); /* The ACE header. */
ACCESS_MASK mask; /* Access mask associated with the ACE. */
SID sid; /* The SID associated with the ACE. */
} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE,
SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE;
+#define _AAH(X) SC(aah,X)
/*
@@ -1438,5 +1454,5 @@
typedef struct {
- ACE_HEADER; /* The ACE_HEADER. */
+ ACE_HEADER SN(aah); /* The ACE_HEADER. */
ACCESS_MASK mask; /* Access mask associated with the ACE. */
OBJECT_ACE_FLAGS flags; /* Flags describing the object ACE. */
@@ -1687,9 +1703,11 @@
*/
typedef struct {
- SECURITY_DESCRIPTOR_HEADER; /* The security descriptor header. */
+ SECURITY_DESCRIPTOR_HEADER SN(sdh); /* The security descriptor header. */
SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security
descriptor. */
} __attribute__ ((__packed__)) SDS_ENTRY;
+#define _SDH(X) SC(sdh,X)
+
/*
* The index entry key used in the $SII index. The collation type is
@@ -1862,5 +1880,5 @@
*/
typedef struct {
-/* 0*/ NTFS_RECORD; /* Magic is "INDX". */
+/* 0*/ NTFS_RECORD SN(inr); /* Magic is "INDX". */
/* 8*/ s64 lsn; /* $LogFile sequence number of the last
modification of this index block. */
@@ -1883,4 +1901,6 @@
} __attribute__ ((__packed__)) INDEX_BLOCK;
+#define _INR(X) SC(inr,X)
+
typedef INDEX_BLOCK INDEX_ALLOCATION;
@@ -1997,6 +2017,6 @@
u16 data_length; /* Data length in bytes. */
u32 reservedV; /* Reserved (zero). */
- } __attribute__ ((__packed__));
- } __attribute__ ((__packed__));
+ } SN(iev) __attribute__ ((__packed__));
+ } SN(iif) __attribute__ ((__packed__));
/* 8*/ u16 length; /* Byte size of this index entry, multiple of
8-bytes. */
@@ -2009,4 +2029,7 @@
} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER;
+#define _IIF(X) SC(ieh.iif,X)
+#define _IEV(X) SC(iif.iev,X)
+
/*
* This is an index entry. A sequence of such entries follows each INDEX_HEADER
@@ -2017,5 +2040,5 @@
*/
typedef struct {
-/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */
+/* 0*/ INDEX_ENTRY_HEADER SN(ieh); /* The index entry header (see above). */
/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present
if INDEX_ENTRY_END bit in flags is not set. NOTE: On
@@ -2029,5 +2052,5 @@
object_id of the mft record found in
the data part of the index. */
- REPARSE_INDEX_KEY; /* $R index in FILE_Extend/$Reparse. */
+ REPARSE_INDEX_KEY SN(iri); /* $R index in FILE_Extend/$Reparse. */
SID sid; /* $O index in FILE_Extend/$Quota:
SID of the owner of the user_id. */
@@ -2051,4 +2074,7 @@
// where sizeof(VCN) can be hardcoded as 8 if wanted. */
} __attribute__ ((__packed__)) INDEX_ENTRY;
+
+#define _IEH(X) SC(ieh,X)
+#define _IRI(X) SC(key.iri,X)
/*
Index: mft.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/mft.c,v
retrieving revision 1.49.4.1
retrieving revision 1.49.4.2
diff -U2 -r1.49.4.1 -r1.49.4.2
--- mft.c 4 Mar 2002 19:04:02 -0000 1.49.4.1
+++ mft.c 4 Mar 2002 22:42:49 -0000 1.49.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
@@ -42,8 +43,8 @@
memset(m, 0, size);
- m->magic = magic_FILE;
+ m->_MNR(magic) = magic_FILE;
/* Aligned to 2-byte boundary. */
- m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1);
- m->usa_count = cpu_to_le16(size / NTFS_BLOCK_SIZE + 1);
+ m->_MNR(usa_ofs) = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1);
+ m->_MNR(usa_count) = cpu_to_le16(size / NTFS_BLOCK_SIZE + 1);
/* Set the update sequence number to 1. */
*(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1);
@@ -52,6 +53,6 @@
m->link_count = cpu_to_le16(0);
/* Aligned to 8-byte boundary. */
- m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) +
- (le16_to_cpu(m->usa_count) << 1) + 7) & ~7);
+ m->attrs_offset = cpu_to_le16((le16_to_cpu(m->_MNR(usa_ofs)) +
+ (le16_to_cpu(m->_MNR(usa_count)) << 1) + 7) & ~7);
m->flags = cpu_to_le16(0);
/*
@@ -616,5 +617,5 @@
down(&base_ni->extent_lock);
if (base_ni->nr_extents > 0) {
- extent_nis = base_ni->extent_ntfs_inos;
+ extent_nis = base_ni->_INE(extent_ntfs_inos);
for (i = 0; i < base_ni->nr_extents; i++) {
if (mft_no != extent_nis[i]->mft_no)
@@ -662,5 +663,5 @@
ni->seq_no = seq_no;
ni->nr_extents = -1;
- ni->base_ntfs_ino = base_ni;
+ ni->_INE(base_ntfs_ino) = base_ni;
/* Now map the record. */
m = map_mft_record(READ, ni);
@@ -692,12 +693,12 @@
goto unm_err_out;
}
- if (base_ni->extent_ntfs_inos) {
- memcpy(tmp, base_ni->extent_ntfs_inos, new_size -
+ if (base_ni->_INE(extent_ntfs_inos)) {
+ memcpy(tmp, base_ni->_INE(extent_ntfs_inos), new_size -
4 * sizeof(ntfs_inode *));
- kfree(base_ni->extent_ntfs_inos);
+ kfree(base_ni->_INE(extent_ntfs_inos));
}
- base_ni->extent_ntfs_inos = tmp;
+ base_ni->_INE(extent_ntfs_inos) = tmp;
}
- base_ni->extent_ntfs_inos[base_ni->nr_extents++] = ni;
+ base_ni->_INE(extent_ntfs_inos)[base_ni->nr_extents++] = ni;
up(&base_ni->extent_lock);
atomic_dec(&base_ni->count);
Index: ntfs.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/ntfs.h,v
retrieving revision 1.29.6.1
retrieving revision 1.29.6.2
diff -U2 -r1.29.6.1 -r1.29.6.2
--- ntfs.h 4 Mar 2002 19:04:02 -0000 1.29.6.1
+++ ntfs.h 4 Mar 2002 22:42:49 -0000 1.29.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
@@ -23,9 +24,4 @@
#ifndef _LINUX_NTFS_H
#define _LINUX_NTFS_H
-
-/* Make sure gcc-2.96 or higher is being used. */
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
-# error The NTFS driver can only be compiled with gcc-2.96 or later.
-#endif
#include <linux/version.h>
Index: super.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/super.c,v
retrieving revision 1.77.4.1
retrieving revision 1.77.4.2
diff -U2 -r1.77.4.1 -r1.77.4.2
--- super.c 4 Mar 2002 19:04:02 -0000 1.77.4.1
+++ super.c 4 Mar 2002 22:42:49 -0000 1.77.4.2
@@ -3,5 +3,5 @@
*
* Copyright (c) 2001,2002 Anton Altaparmakov.
- * Copyright (C) 2001 Richard Russon.
+ * Copyright (C) 2001,2002 Richard Russon.
*
* This program/include file is free software; you can redistribute it and/or
@@ -630,8 +630,8 @@
return FALSE;
}
- vol->nr_clusters = ll;
- ntfs_debug("vol->nr_clusters = 0x%Lx", (long long)vol->nr_clusters);
+ vol->_VCL(nr_clusters) = ll;
+ ntfs_debug("vol->nr_clusters = 0x%Lx", (long long)vol->_VCL(nr_clusters));
ll = sle64_to_cpu(b->mft_lcn);
- if (ll >= vol->nr_clusters) {
+ if (ll >= vol->_VCL(nr_clusters)) {
ntfs_error(vol->sb, "MFT LCN is beyond end of volume. Weird.");
return FALSE;
@@ -640,5 +640,5 @@
ntfs_debug("vol->mft_lcn = 0x%Lx", (long long)vol->mft_lcn);
ll = sle64_to_cpu(b->mftmirr_lcn);
- if (ll >= vol->nr_clusters) {
+ if (ll >= vol->_VCL(nr_clusters)) {
ntfs_error(vol->sb, "MFTMirr LCN is beyond end of volume. "
"Weird.");
@@ -654,5 +654,5 @@
* this, but I am too lazy to create a function especially for it...
*/
- vol->mft_zone_end = vol->nr_clusters;
+ vol->mft_zone_end = vol->_VCL(nr_clusters);
switch (vol->mft_zone_multiplier) { /* % of volume size in clusters */
case 4:
@@ -865,13 +865,13 @@
if (!next_vcn) {
/* Get the last vcn in the $BITMAP attribute. */
- last_vcn = sle64_to_cpu(attr->allocated_size) >>
+ last_vcn = sle64_to_cpu(attr->_ANR(allocated_size)) >>
vol->cluster_size_bits;
- vol->mftbmp_size = sle64_to_cpu(attr->data_size);
+ vol->mftbmp_size = sle64_to_cpu(attr->_ANR(data_size));
vol->mftbmp_initialized_size =
- sle64_to_cpu(attr->initialized_size);
+ sle64_to_cpu(attr->_ANR(initialized_size));
vol->mftbmp_allocated_size =
- sle64_to_cpu(attr->allocated_size);
+ sle64_to_cpu(attr->_ANR(allocated_size));
/* Consistency check. */
- if (vol->mftbmp_size < (vol->nr_mft_records + 7) >> 3) {
+ if (vol->mftbmp_size < (vol->_VMM(nr_mft_records) + 7) >> 3) {
ntfs_error(sb, "$MFT/$BITMAP is too short to "
"contain a complete mft "
@@ -883,5 +883,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;
@@ -891,5 +891,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/$BITMAP has corrupt attribute "
"list attribute. Run chkdsk.");
@@ -959,5 +959,5 @@
goto bitmap_failed;
}
- if ((vol->nr_lcn_bits + 7) >> 3 > vol->lcnbmp_ino->i_size) {
+ if ((vol->_VCL(nr_lcn_bits) + 7) >> 3 > vol->lcnbmp_ino->i_size) {
iput(vol->lcnbmp_ino);
bitmap_failed:
@@ -996,8 +996,8 @@
}
vi = (VOLUME_INFORMATION*)((char*)ctx->attr +
- le16_to_cpu(ctx->attr->value_offset));
+ le16_to_cpu(ctx->attr->_ARA(value_offset)));
/* Some bounds checks. */
if ((u8*)vi < (u8*)ctx->attr || (u8*)vi +
- le32_to_cpu(ctx->attr->value_length) > (u8*)ctx->attr +
+ le32_to_cpu(ctx->attr->_ARA(value_length)) > (u8*)ctx->attr +
le32_to_cpu(ctx->attr->length))
goto err_put_vol;
@@ -1194,5 +1194,5 @@
* multiples of PAGE_CACHE_SIZE.
*/
- max_index = (vol->nr_clusters + 7) >> (3 + PAGE_CACHE_SHIFT);
+ max_index = (vol->_VCL(nr_clusters) + 7) >> (3 + PAGE_CACHE_SHIFT);
/* Use multiples of 4 bytes. */
max_size = PAGE_CACHE_SIZE >> 2;
@@ -1233,5 +1233,5 @@
* page.
*/
- max_size = ((((vol->nr_clusters + 7) >> 3) & ~PAGE_CACHE_MASK)
+ max_size = ((((vol->_VCL(nr_clusters) + 7) >> 3) & ~PAGE_CACHE_MASK)
+ 3) >> 2;
/* If there is a partial page go back and do it. */
@@ -1277,5 +1277,5 @@
* multiples of PAGE_CACHE_SIZE.
*/
- max_index = (vol->nr_mft_records + 7) >> (3 + PAGE_CACHE_SHIFT);
+ max_index = (vol->_VMM(nr_mft_records) + 7) >> (3 + PAGE_CACHE_SHIFT);
/* Use multiples of 4 bytes. */
max_size = PAGE_CACHE_SIZE >> 2;
@@ -1316,10 +1316,10 @@
* page.
*/
- max_size = ((((vol->nr_mft_records + 7) >> 3) &
+ max_size = ((((vol->_VMM(nr_mft_records) + 7) >> 3) &
~PAGE_CACHE_MASK) + 3) >> 2;
/* If there is a partial page go back and do it. */
if (max_size) {
/* Compensate for out of bounds zero bits. */
- if ((i = vol->nr_mft_records & 31))
+ if ((i = vol->_VMM(nr_mft_records) & 31))
nr_free -= (s64)(32 - i);
ntfs_debug("Handling partial page, max_size = 0x%x",
@@ -1368,5 +1368,5 @@
* the total clusters.
*/
- sfs->f_blocks = vol->nr_clusters << vol->cluster_size_bits >>
+ sfs->f_blocks = vol->_VCL(nr_clusters) << vol->cluster_size_bits >>
PAGE_CACHE_SHIFT;
/* Free data blocks in file system in units of f_bsize. */
Index: volume.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/volume.h,v
retrieving revision 1.6.4.1
retrieving revision 1.6.4.2
diff -U2 -r1.6.4.1 -r1.6.4.2
--- volume.h 4 Mar 2002 19:04:02 -0000 1.6.4.1
+++ volume.h 4 Mar 2002 22:42:49 -0000 1.6.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
@@ -80,5 +81,5 @@
LCN nr_clusters; /* Volume size in clusters. */
LCN nr_lcn_bits; /* Number of bits in lcn bitmap. */
- };
+ } SN(vcl);
LCN mft_lcn; /* Cluster location of mft data. */
LCN mftmirr_lcn; /* Cluster location of copy of mft. */
@@ -95,5 +96,5 @@
s64 nr_mft_records; /* Number of records in the mft. */
s64 nr_mft_bits; /* Number of bits in mft bitmap. */
- };
+ } SN(vmm);
struct address_space mftbmp_mapping; /* Page cache for $MFT/$BITMAP. */
run_list mftbmp_rl; /* Run list for $MFT/$BITMAP. */
@@ -115,4 +116,7 @@
struct nls_table *nls_map;
} ntfs_volume;
+
+#define _VCL(X) SC(vcl,X)
+#define _VMM(X) SC(vmm,X)
#endif /* _LINUX_NTFS_VOLUME_H */
|