summaryrefslogtreecommitdiff
path: root/difftool/difftool.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-05 15:00:08 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-07 10:41:49 +0200
commit73b4ec8392541a27815bccbaeccbdf1cdd5e19dd (patch)
tree670e0b3f6e64ba7e957e29454e1f17261faf2ffe /difftool/difftool.h
parent1fff8f3a1326bd82f8140a61d969994e635834fe (diff)
Add a helper utility to compare filesystem trees
The intended use case is to compare two mounted or unpacke squashfs images, so a repacked test image can be compared against its original or an image unpacked with unsquashfs can be compared with an image unpacked by rdsquashfs or sqfs2tar. Since the tool is only intended to aid development (specifically automated testing), it is not installed by `make install`. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'difftool/difftool.h')
-rw-r--r--difftool/difftool.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/difftool/difftool.h b/difftool/difftool.h
new file mode 100644
index 0000000..0dea6d5
--- /dev/null
+++ b/difftool/difftool.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * difftool.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef DIFFTOOL_H
+#define DIFFTOOL_H
+
+#include "config.h"
+#include "fstree.h"
+#include "util.h"
+
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#define MAX_WINDOW_SIZE (1024 * 1024 * 4)
+
+extern const char *first_path;
+extern const char *second_path;
+extern int compare_flags;
+
+enum {
+ COMPARE_NO_PERM = 0x01,
+ COMPARE_NO_OWNER = 0x02,
+};
+
+int compare_dir_entries(tree_node_t *a, tree_node_t *b);
+
+char *node_path(tree_node_t *n);
+
+int compare_files(file_info_t *a, file_info_t *b, const char *path);
+
+int node_compare(tree_node_t *a, tree_node_t *b);
+
+#endif /* DIFFTOOL_H */