-/* Compares two mounted NTFS filesystems. */
+/*
+ * A program to compare two mounted NTFS filesystems.
+ */
#include <stdarg.h>
#include <stdio.h>
exit(2);
}
+/* This is just a binary tree that maps inode numbers in one NTFS tree to inode
+ * numbers in the other NTFS tree. This is so we can tell if the hard link
+ * groups are the same between the two NTFS trees. */
struct node {
u64 ino_from;
u64 ino_to;
}
+/* Compares the "normal" contents of two files of size @size. */
static void cmp(const char *file1, const char *file2, size_t size)
{
int fd1, fd2;
close(fd2);
}
+/* Compares an extended attribute of the files. */
static void cmp_xattr(const char *file1, const char *file2,
const char *xattr_name, ssize_t max_size,
bool missingok)
if (errno == ENOATTR)
return;
else
- error("xattr `%s' exists on file `%s' "
+ difference("xattr `%s' exists on file `%s' "
"but not on file `%s'",
xattr_name, file1, file2);
} else {
free(buf2);
}
+/* Compares all alternate data streams of the files */
static void cmp_ads(const char *file1, const char *file2)
{
char _list1[256], _list2[sizeof(_list1)];
pe = list1 + len1 - 1;
while (p < pe) {
cmp_xattr(file1, file2, p, 0, false);
- p += strlen(p);
+ p += strlen(p) + 1;
}
if (list1 != _list1) {
free(list1);
}
}
+/* Compares special NTFS data of the files, as accessed through extended
+ * attributes. */
static void special_cmp(const char *file1, const char *file2)
{
cmp_xattr(file1, file2, "system.ntfs_acl", 0, false);
}
+/* Compares file1 on one NTFS volume to file2 on another NTFS volume. */
static void ntfs_cmp(char file1[], int file1_len, char file2[], int file2_len)
{
struct stat st1, st2;