From 576e195ba5476ebf428bac51365d829d713e6907 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 10 Jun 2019 23:16:34 +0200 Subject: cleanup: move tree deserialization to libsqfs.a Signed-off-by: David Oberhollenzer --- include/highlevel.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/highlevel.h b/include/highlevel.h index e69e337..f61ad0b 100644 --- a/include/highlevel.h +++ b/include/highlevel.h @@ -10,6 +10,14 @@ #include #include +enum RDTREE_FLAGS { + RDTREE_NO_DEVICES = 0x01, + RDTREE_NO_SOCKETS = 0x02, + RDTREE_NO_FIFO = 0x04, + RDTREE_NO_SLINKS = 0x08, + RDTREE_NO_EMPTY = 0x10, +}; + /* Convenience function for writing meta data to a SquashFS image @@ -40,4 +48,23 @@ int sqfs_write_table(int outfd, sqfs_super_t *super, const void *data, int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs, compressor_t *cmp, id_table_t *idtbl); +/* + Convert a generic squashfs tree node to an fstree_t node. + + Prints error messages to stderr on failure. + */ +tree_node_t *tree_node_from_inode(sqfs_inode_generic_t *inode, + const id_table_t *idtbl, + const char *name, + size_t block_size); + +/* + Restore a file system tree from a squashfs image. The given flags are a + combination of RDTREE_FLAGS. + + Returns 0 on success. Prints error messages to stderr on failure. + */ +int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp, + int fd, int flags); + #endif /* HIGHLEVEL_H */ -- cgit v1.2.3