diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-07-04 20:01:59 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-07-08 19:17:35 +0200 |
commit | 3946cf086183f8dd4d5d115f52ba1b87560b7ce4 (patch) | |
tree | 2659b940b757d1bd177d00562bf8e41a333ef12e /include | |
parent | 8c0aa2504199036eaaa09673ea93dcdcd79606ef (diff) |
Move sqfs_tree_node_get_path to libsquashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/sqfs/dir_reader.h | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/include/common.h b/include/common.h index 5ef4e05..84ec3ca 100644 --- a/include/common.h +++ b/include/common.h @@ -34,8 +34,6 @@ typedef struct sqfs_hard_link_t { char *target; } sqfs_hard_link_t; -char *sqfs_tree_node_get_path(const sqfs_tree_node_t *node); - int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data, const sqfs_inode_generic_t *inode, ostream_t *fp, size_t block_size); diff --git a/include/sqfs/dir_reader.h b/include/sqfs/dir_reader.h index c528e33..3ae4ca4 100644 --- a/include/sqfs/dir_reader.h +++ b/include/sqfs/dir_reader.h @@ -384,6 +384,27 @@ SQFS_API int sqfs_dir_reader_get_full_hierarchy(sqfs_dir_reader_t *rd, */ SQFS_API void sqfs_dir_tree_destroy(sqfs_tree_node_t *root); +/** + * @brief Recursively destroy a tree of @ref sqfs_tree_node_t nodes + * + * @memberof sqfs_tree_node_t + * + * This function can be used to assemble an absolute path from a tree + * node returned by @ref sqfs_dir_reader_get_full_hierarchy. + * + * The function recursively walks up the tree to assemble a path string. It + * returns "/" for the root node and assembles paths beginning with "/" for + * non-root nodes. The resulting path is slash separated, but (except for + * the root) never ends with a slash. + * + * The returned string needs to be free'd with @ref sqfs_free. + * + * @param node A pointer to a tree node. + * + * @return A pointer to a string on success, NULL on allocation failure. + */ +SQFS_API char *sqfs_tree_node_get_path(const sqfs_tree_node_t *node); + #ifdef __cplusplus } #endif |