aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-29 10:57:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-29 10:58:42 +0200
commit864302059679c15bc223d37ed8cef87c5b4a97aa (patch)
tree419cdc8670878602c8b615e98937db5da723ca7a /include
parentdad72be359d2670dd4993101591e1b14638dedec (diff)
Cleanup: move deduplication code from data writer to fstree
Since it is actually completely independend of libsqfs and only works on file_info_t lists, it can be safely moved over to libfstree and the data writer becomes less cluttered as a result. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/fstree.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/fstree.h b/include/fstree.h
index 687b693..c327fc6 100644
--- a/include/fstree.h
+++ b/include/fstree.h
@@ -297,4 +297,25 @@ void tree_node_sort_recursive(tree_node_t *root);
/* resolve a path to a tree node. Returns NULL on failure and sets errno */
tree_node_t *fstree_node_from_path(fstree_t *fs, const char *path);
+/*
+ Walk through 'list' to find a file with a fragment that has
+ the same size ('frag_size') and checksum ('chksum') as 'fi'.
+ Processing stopps if 'fi' itself is found in the list.
+
+ Returns NULL if no such fragment could be found.
+*/
+file_info_t *fragment_by_chksum(file_info_t *fi, uint32_t chksum,
+ size_t frag_size, file_info_t *list,
+ size_t block_size);
+
+/*
+ Walk through 'list' to find a file that contains the same sequence of blocks
+ as 'file', comparing size and checksum. Processing stops if 'file' is found
+ in the list.
+
+ Returns NULL if no such fragment could be found.
+ */
+uint64_t find_equal_blocks(file_info_t *file, file_info_t *list,
+ size_t block_size);
+
#endif /* FSTREE_H */