aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--difftool/compare_files_sqfs.c3
-rw-r--r--difftool/difftool.h1
-rw-r--r--difftool/sqfsdiff.c24
3 files changed, 18 insertions, 10 deletions
diff --git a/difftool/compare_files_sqfs.c b/difftool/compare_files_sqfs.c
index d8bef83..76fae7a 100644
--- a/difftool/compare_files_sqfs.c
+++ b/difftool/compare_files_sqfs.c
@@ -17,6 +17,9 @@ int compare_files(file_info_t *a, file_info_t *b, const char *path)
if (a->size != b->size)
return 1;
+ if (compare_flags & COMPARE_NO_CONTENTS)
+ return 0;
+
for (offset = 0; offset < a->size; offset += diff) {
diff = a->size - offset;
diff --git a/difftool/difftool.h b/difftool/difftool.h
index f7739c4..3d2b6e6 100644
--- a/difftool/difftool.h
+++ b/difftool/difftool.h
@@ -32,6 +32,7 @@ extern sqfs_reader_t sqfs_b;
enum {
COMPARE_NO_PERM = 0x01,
COMPARE_NO_OWNER = 0x02,
+ COMPARE_NO_CONTENTS = 0x04,
};
int compare_dir_entries(tree_node_t *a, tree_node_t *b);
diff --git a/difftool/sqfsdiff.c b/difftool/sqfsdiff.c
index 2fc10a1..02de33a 100644
--- a/difftool/sqfsdiff.c
+++ b/difftool/sqfsdiff.c
@@ -9,31 +9,32 @@
static struct option long_opts[] = {
{ "no-owner", no_argument, NULL, 'O' },
{ "no-permissions", no_argument, NULL, 'P' },
+ { "no-contents", no_argument, NULL, 'C' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "OPhV";
+static const char *short_opts = "OPChV";
static const char *usagestr =
"Usage: sqfsdiff [OPTIONS...] <first> <second>\n"
"\n"
-"Compare the contents of two squashfs images. In contrast to doing a direct\n"
-"diff of the images, this actually recovers the file system trees and\n"
-"recursively compares them against each other.\n"
+"Compare two squashfs images. In contrast to doing a direct diff of the\n"
+"images, this actually parses the filesystems and generates a more\n"
+"meaningful difference report.\n"
"\n"
-"Any differences in packed file layout, ordering, compression, inode\n"
-"allocation and so on is ignored, only the contents are compared.\n"
-"\n"
-"The two images are considered equal if each directory contains the same\n"
-"entries, symlink with the same paths have the same targets, device nodes\n"
-"the same device number and files the same size and contents.\n"
+"If only contents are compared, any differences in packed file layout,\n"
+"ordering, compression, inode allocation and so on is ignored and the two\n"
+"images are considered equal if each directory contains the same entries,\n"
+"symlink with the same paths have the same targets, device nodes the same\n"
+"device number and files the same size and contents.\n"
"\n"
"A report of any difference is printed to stdout. The exit status is similar\n"
"that of diff(1): 0 means equal, 1 means different, 2 means problem.\n"
"\n"
"Possible options:\n"
"\n"
+" --no-contents, -C Do not compare file contents.\n"
" --no-owner, -O Do not compare file owners.\n"
" --no-permissions, -P Do not compare permission bits.\n"
"\n"
@@ -63,6 +64,9 @@ static void process_options(int argc, char **argv)
case 'P':
compare_flags |= COMPARE_NO_PERM;
break;
+ case 'C':
+ compare_flags |= COMPARE_NO_CONTENTS;
+ break;
case 'h':
fputs(usagestr, stdout);
exit(EXIT_SUCCESS);