aboutsummaryrefslogtreecommitdiff
path: root/include/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-12 08:15:00 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-12 08:15:48 +0100
commitc92faad51817c10570de3680e95a3fd18bb21204 (patch)
treedb42bdf6cc15ed89e2e25e4cc368acf51f785ca7 /include/sqfs
parent525d582aea7d42231c8641b19f38881ee43133ea (diff)
Add an inode deep copy helper function to libsquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs')
-rw-r--r--include/sqfs/inode.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/sqfs/inode.h b/include/sqfs/inode.h
index 336a394..2b4a550 100644
--- a/include/sqfs/inode.h
+++ b/include/sqfs/inode.h
@@ -537,6 +537,24 @@ extern "C" {
#endif
/**
+ * @brief Create a deep copy of a generic inode.
+ *
+ * The @ref sqfs_inode_generic_t structure contains inlined fields that have a
+ * size depending on the inode data and pointers to the inlined fields. This
+ * helper function calculates the actual size of the structure in memory, makes
+ * a copy and propperly sets up the pointers.
+ *
+ * @param src The inode to copy.
+ * @param copy Returns a pointer to the copy on success. Can be released with a
+ * single free call.
+ *
+ * @return Zero on success, an @ref SQFS_ERROR_CORRUPTED if the node has
+ * an unknown type set.
+ */
+SQFS_API int sqfs_inode_copy(const sqfs_inode_generic_t *src,
+ sqfs_inode_generic_t **copy);
+
+/**
* @brief Get the extended attribute index of an inode
*
* For basic inodes, this returns the inode index 0xFFFFFFFF, i.e. the