From 3c18216e23eb74af23672d0687692d785647223d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 11 Feb 2020 15:02:24 +0100 Subject: Clenaup: remove useage of sqfs_block_t from block writer The sqfs_block_t structure has been written for the block processor and exposes way too many internals. This commit removes its usage from the block writer, cutting it down to the bare essentials, so the structure can be removed from the public API later on. Signed-off-by: David Oberhollenzer --- include/sqfs/block_writer.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'include/sqfs') diff --git a/include/sqfs/block_writer.h b/include/sqfs/block_writer.h index 4ac0762..e921141 100644 --- a/include/sqfs/block_writer.h +++ b/include/sqfs/block_writer.h @@ -69,15 +69,19 @@ struct sqfs_block_hooks_t { * disk. If the block has the @ref SQFS_BLK_ALIGN flag set, the * function is called before padding the file. * - * The function may modify the block itself or write data to the file. - * which is taken into account when padding the file. + * The function may write additional data to the file, which is taken + * into account when padding the file. * * @param user A user pointer. - * @param block The block that is about to be written. + * @param flags A pointer to a combination of @ref E_SQFS_BLK_FLAGS + * describing the block. The callback can modify the + * user settable flags. + * @param size The size of the block in bytes. + * @param data A pointer to the raw block data. * @param file The file that the block will be written to. */ - void (*pre_block_write)(void *user, sqfs_block_t *block, - sqfs_file_t *file); + void (*pre_block_write)(void *user, sqfs_u32 *flags, sqfs_u32 size, + const sqfs_u8 *data, sqfs_file_t *file); /** * @brief Gets called after writing a block to disk. @@ -91,11 +95,14 @@ struct sqfs_block_hooks_t { * the file. * * @param user A user pointer. - * @param block The block that is about to be written. + * @param flags A combination of @ref E_SQFS_BLK_FLAGS describing + * the block. + * @param size The size of the block in bytes. + * @param data A pointer to the raw block data. * @param file The file that the block was written to. */ - void (*post_block_write)(void *user, const sqfs_block_t *block, - sqfs_file_t *file); + void (*post_block_write)(void *user, sqfs_u32 flags, sqfs_u32 size, + const sqfs_u8 *data, sqfs_file_t *file); /** * @brief Gets called before writing a block of padding bytes to disk. @@ -216,7 +223,8 @@ SQFS_API void sqfs_block_writer_destroy(sqfs_block_writer_t *wr); * @return Zero on success, an @ref E_SQFS_ERROR error on failure. */ SQFS_API int sqfs_block_writer_write(sqfs_block_writer_t *wr, - sqfs_block_t *block, + sqfs_u32 size, sqfs_u32 checksum, + sqfs_u32 flags, const sqfs_u8 *data, sqfs_u64 *location); /** -- cgit v1.2.3