From 74b739ac61fb49f93a8ce814a37026bf1d405466 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 4 Mar 2020 01:09:18 +0100 Subject: Cleanup: match xattr reader API closer to id table API Instead of creating everything in the "create" function, cleanup and create/initialize stuff in a "load" function. This allows the xattr reader to be reset/re-used and adds the benefit of not having to lug around references to the super block, compressor and file (altough the later two are hidden inside the meta reader). Signed-off-by: David Oberhollenzer --- include/sqfs/xattr_reader.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'include/sqfs') diff --git a/include/sqfs/xattr_reader.h b/include/sqfs/xattr_reader.h index 7912de4..54ffc12 100644 --- a/include/sqfs/xattr_reader.h +++ b/include/sqfs/xattr_reader.h @@ -83,18 +83,12 @@ extern "C" { * Do not destroy any of the pointed to objects before destroying the xattr * reader. * - * @param file A pointer to a file object that contains the SquashFS filesystem - * @param super A pointer to the SquashFS super block required to find the - * location tables. - * @param cmp A pointer to a compressor used to uncompress the loaded meta data - * blocks. + * @param flags Currently must be set to 0, or creation will fail. * * @return A pointer to a new xattr reader instance on success, NULL on * allocation failure. */ -SQFS_API sqfs_xattr_reader_t *sqfs_xattr_reader_create(sqfs_file_t *file, - sqfs_super_t *super, - sqfs_compressor_t *cmp); +SQFS_API sqfs_xattr_reader_t *sqfs_xattr_reader_create(sqfs_u32 flags); /** * @brief Load the locations of the xattr meta data blocks into memory @@ -104,9 +98,18 @@ SQFS_API sqfs_xattr_reader_t *sqfs_xattr_reader_create(sqfs_file_t *file, * This function must be called explicitly after an xattr reader has been * created to load the actual location table from disk. * + * @param xr A pointer to an xattr reader instance. + * @param super A pointer to the SquashFS super block required to find the + * location tables. + * @param file A pointer to a file object that contains the SquashFS filesystem. + * @param cmp A pointer to a compressor used to uncompress the loaded meta data + * blocks. + * * @return Zero on success, a negative @ref E_SQFS_ERROR value on failure. */ -SQFS_API int sqfs_xattr_reader_load_locations(sqfs_xattr_reader_t *xr); +SQFS_API int sqfs_xattr_reader_load(sqfs_xattr_reader_t *xr, + const sqfs_super_t *super, + sqfs_file_t *file, sqfs_compressor_t *cmp); /** * @brief Resolve an xattr index from an inode to an xattr description -- cgit v1.2.3