Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfs-driver-tng/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv28137/scripts
Modified Files:
compat.c rl.c
Log Message:
resync attrib.c, rl.c and check test cases
Index: compat.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/compat.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -U2 -r1.9 -r1.10
--- compat.c 18 Feb 2002 01:53:00 -0000 1.9
+++ compat.c 25 Feb 2002 04:30:08 -0000 1.10
@@ -21,4 +21,8 @@
#include "linux/fs/ntfs/types.h"
+#define SN(X) X /* Struct Name */
+#define SC(P,N) P.N /* ShortCut: Prefix, Name */
+#define _ANR(X) SC(aua.anr,X)
+
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
@@ -151,5 +155,5 @@
/* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte
boundary. */
- } __attribute__ ((__packed__));
+ } SN(ara) __attribute__ ((__packed__));
/* Non-resident attributes. */
struct {
@@ -201,7 +205,8 @@
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;
+
typedef enum {
LCN_HOLE = -1, /* Keep this as highest value or die! */
Index: rl.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfs-driver-tng/scripts/rl.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -U2 -r1.25 -r1.26
--- rl.c 24 Feb 2002 20:05:18 -0000 1.25
+++ rl.c 25 Feb 2002 04:30:08 -0000 1.26
@@ -544,5 +544,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);
@@ -550,8 +550,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)) {
@@ -679,5 +679,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:
@@ -687,8 +687,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;
@@ -738,60 +738,4 @@
ntfs_free(rl);
return ERR_PTR(-EIO);
-}
-
-/**
- * vcn_to_lcn - convert a vcn into a lcn given a run list
- * @rl: run list to use for conversion
- * @vcn: vcn to convert
- *
- * Convert the virtual cluster number @vcn of an attribute into a logical
- * cluster number (lcn) of a device using the run list @rl to map vcns to their
- * corresponding lcns.
- *
- * Since lcns must be >= 0, we use negative return values with special meaning:
- *
- * Return value Meaning / Description
- * ==================================================
- * -1 = LCN_HOLE Hole / not allocated on disk.
- * -2 = LCN_RL_NOT_MAPPED This is part of the run list which has not been
- * inserted into the run list yet.
- * -3 = LCN_ENOENT There is no such vcn in the data attribute.
- * -4 = LCN_EINVAL Input parameter error (if debug enabled).
- */
-LCN vcn_to_lcn(const run_list *rl, const VCN vcn)
-{
- int i;
-
-#ifdef DEBUG
- if (vcn < (VCN)0)
- return (LCN)LCN_EINVAL;
-#endif
- /*
- * If rl is NULL, assume that we have found an unmapped run list. The
- * caller can then attempt to map it and fail appropriately if
- * necessary.
- */
- if (unlikely(!rl))
- return (LCN)LCN_RL_NOT_MAPPED;
-
- /* Catch out of lower bounds vcn. */
- if (unlikely(vcn < rl[0].vcn))
- return (LCN)LCN_ENOENT;
-
- for (i = 0; likely(rl[i].length); i++) {
- if (unlikely(vcn < rl[i+1].vcn)) {
- if (likely(rl[i].lcn >= (LCN)0))
- return rl[i].lcn + (vcn - rl[i].vcn);
- return rl[i].lcn;
- }
- }
- /*
- * The terminator element is setup to the correct value, i.e. one of
- * LCN_HOLE, LCN_RL_NOT_MAPPED, or LCN_ENOENT.
- */
- if (likely(rl[i].lcn < (LCN)0))
- return rl[i].lcn;
- /* Just in case... We could replace this with BUG() some day. */
- return (LCN)LCN_ENOENT;
}
|