From 3da78a56df43360520f8007bdb4e11fa25f712cc Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 25 Sep 2019 06:03:36 +0200 Subject: Refactor out common code of the block processors Code that already is shared between the pthread and the serial processor as well as code that can be re-used by other threading API implementations. Signed-off-by: David Oberhollenzer --- lib/sqfs/blk_proc/internal.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'lib/sqfs/blk_proc/internal.h') diff --git a/lib/sqfs/blk_proc/internal.h b/lib/sqfs/blk_proc/internal.h index 2e9980b..5fdbc3e 100644 --- a/lib/sqfs/blk_proc/internal.h +++ b/lib/sqfs/blk_proc/internal.h @@ -64,7 +64,6 @@ struct sqfs_block_processor_t { sqfs_block_t *queue_last; sqfs_block_t *done; - bool terminate; size_t backlog; int status; @@ -105,10 +104,6 @@ struct sqfs_block_processor_t { #endif }; -SQFS_INTERNAL -int sqfs_block_process(sqfs_block_t *block, sqfs_compressor_t *cmp, - uint8_t *scratch, size_t scratch_size); - SQFS_INTERNAL int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *block); @@ -123,4 +118,25 @@ SQFS_INTERNAL int store_block_location(sqfs_block_processor_t *proc, uint64_t offset, uint32_t size, uint32_t chksum); +SQFS_INTERNAL void free_blk_list(sqfs_block_t *list); + +SQFS_INTERNAL +int block_processor_init(sqfs_block_processor_t *proc, size_t max_block_size, + sqfs_compressor_t *cmp, unsigned int num_workers, + size_t max_backlog, size_t devblksz, + sqfs_file_t *file); + +SQFS_INTERNAL void block_processor_cleanup(sqfs_block_processor_t *proc); + +SQFS_INTERNAL +void block_processor_store_done(sqfs_block_processor_t *proc, + sqfs_block_t *blk, int status); + +SQFS_INTERNAL +sqfs_block_t *block_processor_next_work_item(sqfs_block_processor_t *proc); + +SQFS_INTERNAL +int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp, + uint8_t *scratch, size_t scratch_size); + #endif /* INTERNAL_H */ -- cgit v1.2.3