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
+++ inode.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
@@ -80,5 +81,5 @@
run_list *bmp_rl; /* Run list for the $I30 bitmap
if it is non-resident. */
- };
+ } SN(idm);
struct { /* It is a compressed file. */
u32 compression_block_size; /* Size of a compression
@@ -89,6 +90,6 @@
per compression
block. */
- };
- };
+ } SN(icf);
+ } SN(idc);
struct semaphore extent_lock; /* Lock for accessing/modifying the
below . */
@@ -104,6 +105,10 @@
vfs inode of the base mft
record. */
- };
+ } SN(ine);
};
+
+#define _IDM(X) SC(idc.idm,X)
+#define _ICF(X) SC(idc.icf,X)
+#define _INE(X) SC(ine,X)
typedef struct {
Index: layout.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/layout.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -U2 -r1.10 -r1.11
--- layout.h 3 Feb 2002 19:31:17 -0000 1.10
+++ layout.h 25 Feb 2002 04:00:58 -0000 1.11
@@ -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
retrieving revision 1.50
diff -U2 -r1.49 -r1.50
--- mft.c 14 Feb 2002 06:07:14 -0000 1.49
+++ mft.c 25 Feb 2002 04:00:58 -0000 1.50
@@ -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);
/*
@@ -614,5 +615,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)
@@ -660,5 +661,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);
@@ -690,12 +691,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
retrieving revision 1.30
diff -U2 -r1.29 -r1.30
--- ntfs.h 8 Feb 2002 05:17:11 -0000 1.29
+++ ntfs.h 25 Feb 2002 04:00:58 -0000 1.30
@@ -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
@@ -25,7 +26,9 @@
/* 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
retrieving revision 1.78
diff -U2 -r1.77 -r1.78
--- super.c 25 Feb 2002 02:49:33 -0000 1.77
+++ super.c 25 Feb 2002 04:00:58 -0000 1.78
@@ -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
@@ -561,8 +561,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->_VCL(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;
@@ -571,5 +571,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.");
@@ -585,5 +585,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:
@@ -806,11 +806,11 @@
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_initialized_size =
- sle64_to_cpu(attr->initialized_size);
+ sle64_to_cpu(attr->_ANR(initialized_size));
/* Consistency check. */
if (vol->mftbmp_initialized_size <
- (vol->nr_mft_records + 7) >> 3) {
+ (vol->_VMM(nr_mft_records) + 7) >> 3) {
ntfs_error(sb, "$MFT/$BITMAP is too short to "
"contain a complete mft "
@@ -822,5 +822,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;
@@ -830,5 +830,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.");
@@ -900,5 +900,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:
@@ -937,8 +937,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;
@@ -1132,5 +1132,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;
@@ -1171,5 +1171,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. */
@@ -1215,5 +1215,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;
@@ -1254,10 +1254,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",
@@ -1306,5 +1306,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. */
@@ -1746,4 +1746,5 @@
};
#endif /* VERSION >= 2.5.4 */
+
static int __init init_ntfs_fs(void)
{
Index: volume.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/linux/fs/ntfs/volume.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -U2 -r1.6 -r1.7
--- volume.h 14 Feb 2002 06:12:27 -0000 1.6
+++ volume.h 25 Feb 2002 04:00:58 -0000 1.7
@@ -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
@@ -66,5 +67,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. */
@@ -81,5 +82,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. */
@@ -99,4 +100,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 */
|