summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 10:51:03 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 11:24:37 +0200
commit28a99ec109637a92f78a24f0eed64cb8a078f356 (patch)
treef13ef1b54177c4cd779b5f5bee65bd27b7ef82db
parent740b161bfaddbd236c9d052546f27dd4af30582c (diff)
Add flag to sqfsdiff to compare inode numbers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--difftool/difftool.h1
-rw-r--r--difftool/node_compare.c8
-rw-r--r--difftool/sqfsdiff.c7
3 files changed, 15 insertions, 1 deletions
diff --git a/difftool/difftool.h b/difftool/difftool.h
index 072af02..4b6173a 100644
--- a/difftool/difftool.h
+++ b/difftool/difftool.h
@@ -34,6 +34,7 @@ enum {
COMPARE_NO_OWNER = 0x02,
COMPARE_NO_CONTENTS = 0x04,
COMPARE_TIMESTAMP = 0x08,
+ COMPARE_INODE_NUM = 0x10,
};
int compare_dir_entries(tree_node_t *a, tree_node_t *b);
diff --git a/difftool/node_compare.c b/difftool/node_compare.c
index e1b72c6..2e1cec6 100644
--- a/difftool/node_compare.c
+++ b/difftool/node_compare.c
@@ -43,6 +43,14 @@ int node_compare(tree_node_t *a, tree_node_t *b)
}
}
+ if (compare_flags & COMPARE_INODE_NUM) {
+ if (a->inode_num != b->inode_num) {
+ fprintf(stdout, "%s has a different inode number\n",
+ path);
+ status = 1;
+ }
+ }
+
switch (a->mode & S_IFMT) {
case S_IFSOCK:
case S_IFIFO:
diff --git a/difftool/sqfsdiff.c b/difftool/sqfsdiff.c
index d23a724..96a8f31 100644
--- a/difftool/sqfsdiff.c
+++ b/difftool/sqfsdiff.c
@@ -11,11 +11,12 @@ static struct option long_opts[] = {
{ "no-permissions", no_argument, NULL, 'P' },
{ "no-contents", no_argument, NULL, 'C' },
{ "timestamps", no_argument, NULL, 'T' },
+ { "inode-num", no_argument, NULL, 'I' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "OPCThV";
+static const char *short_opts = "OPCTIhV";
static const char *usagestr =
"Usage: sqfsdiff [OPTIONS...] <first> <second>\n"
@@ -40,6 +41,7 @@ static const char *usagestr =
" --no-permissions, -P Do not compare permission bits.\n"
"\n"
" --timestamps, -T Compare file timestamps.\n"
+" --inode-num, -I Compare inode numbers of all files.\n"
"\n"
" --help, -h Print help text and exit.\n"
" --version, -V Print version information and exit.\n"
@@ -73,6 +75,9 @@ static void process_options(int argc, char **argv)
case 'T':
compare_flags |= COMPARE_TIMESTAMP;
break;
+ case 'I':
+ compare_flags |= COMPARE_INODE_NUM;
+ break;
case 'h':
fputs(usagestr, stdout);
exit(EXIT_SUCCESS);