From 9ac42164bc43bcdd47c0a8e5e59c662b2a136659 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 14 Feb 2020 17:56:40 +0100 Subject: Cleanup: block processor: move init/cleanup functions into implemenations Again, the generic init/cleanup functions do way too many things that are specific to the thread pool implementation. Thanks to the splitting up of the block processor, they also have become quite trivial. This commit moves those functions into their respective implementations, allowing even further simplificiation. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/common.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'lib/sqfs/block_processor/common.c') diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c index e2d92c5..c8dbbc2 100644 --- a/lib/sqfs/block_processor/common.c +++ b/lib/sqfs/block_processor/common.c @@ -7,43 +7,6 @@ #define SQFS_BUILDING_DLL #include "internal.h" -void free_blk_list(sqfs_block_t *list) -{ - sqfs_block_t *it; - - while (list != NULL) { - it = list; - list = list->next; - free(it); - } -} - -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, sqfs_block_writer_t *wr, - sqfs_frag_table_t *tbl) -{ - proc->max_block_size = max_block_size; - proc->num_workers = num_workers; - proc->max_backlog = max_backlog; - proc->cmp = cmp; - proc->frag_tbl = tbl; - proc->wr = wr; - - memset(&proc->stats, 0, sizeof(proc->stats)); - proc->stats.size = sizeof(proc->stats); - return 0; -} - -void block_processor_cleanup(sqfs_block_processor_t *proc) -{ - free_blk_list(proc->queue); - free_blk_list(proc->done); - free(proc->blk_current); - free(proc->frag_block); - free(proc); -} - int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk) { sqfs_u64 location; -- cgit v1.2.3