Changes by: szaka
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9577/ntfsprogs
Modified Files:
ntfscmp.c
Log Message:
Compare attribute headers as well. This nicely shows now that compression
and allocation sizes aren't set correctly for sparse files in libntfs.
Index: ntfscmp.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfscmp.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- ntfscmp.c 26 Nov 2005 17:58:17 -0000 1.13
+++ ntfscmp.c 19 Feb 2006 12:50:54 -0000 1.14
@@ -1,8 +1,8 @@
/**
* ntfscmp - compare two NTFS volumes.
*
+ * Copyright (c) 2005-2006 Szabolcs Szakacsits
* Copyright (c) 2005 Anton Altaparmakov
- * Copyright (c) 2005 Szabolcs Szakacsits
*
* This utility is part of the Linux-NTFS project.
*/
@@ -520,6 +520,26 @@ static void cmp_attribute_data(ntfs_attr
exit(1);
}
+static int cmp_attribute_header(ATTR_RECORD *a1, ATTR_RECORD *a2)
+{
+ int header_size = offsetof(ATTR_RECORD, resident_end);
+
+ if (a1->non_resident != a2->non_resident)
+ return 1;
+
+ if (a1->non_resident) {
+
+ if (a1->compression_unit != a2->compression_unit)
+ return 1;
+
+ header_size = offsetof(ATTR_RECORD, non_resident_end);
+ if (a1->compression_unit)
+ header_size = offsetof(ATTR_RECORD, compressed_end);
+ }
+
+ return memcmp(a1, a2, header_size);
+}
+
static void cmp_attribute(ntfs_attr_search_ctx *ctx1,
ntfs_attr_search_ctx *ctx2)
{
@@ -527,6 +547,11 @@ static void cmp_attribute(ntfs_attr_sear
ATTR_RECORD *a2 = ctx2->attr;
ntfs_attr *na1, *na2;
+ if (cmp_attribute_header(a1, a2)) {
+ print_ctx(ctx1);
+ printf("header: DIFFER\n");
+ }
+
na1 = ntfs_attr_open(base_inode(ctx1), a1->type, GET_ATTR_NAME(a1));
na2 = ntfs_attr_open(base_inode(ctx2), a2->type, GET_ATTR_NAME(a2));
|