From a4d371f85ff05c99ce20b7ec49df15cfec11d915 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 19 Sep 2023 18:43:10 +0200 Subject: libsqfs: Add a helper function for turning an inode into a dir entry Signed-off-by: David Oberhollenzer --- include/sqfs/inode.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/sqfs/inode.h b/include/sqfs/inode.h index 7f4e7b5..ba9c227 100644 --- a/include/sqfs/inode.h +++ b/include/sqfs/inode.h @@ -741,6 +741,23 @@ int sqfs_inode_unpack_dir_index_entry(const sqfs_inode_generic_t *inode, sqfs_dir_index_t **out, size_t index); +/** + * @brief Create a directory entry from an inode + * + * @param name The file name or path to store in the directory entry + * @param len The lengh of the file name, or 0 to use strlen internally + * @param inode The inode from which to use the data + * @param idtbl An ID table to use for resolving the inodes uid & gid + * @param out Returns a pointer to a @ref sqfs_dir_entry_t on success + * + * @return Zero on success, a negative @ref SQFS_ERROR value on failure + */ +SQFS_API +int sqfs_dir_entry_from_inode(const char *name, size_t len, + const sqfs_inode_generic_t *inode, + const sqfs_id_table_t *idtbl, + sqfs_dir_entry_t **out); + #ifdef __cplusplus } #endif -- cgit v1.2.3