diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-21 00:04:12 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-21 00:13:24 +0200 |
commit | 544575bd09378dcf573e33a315628ecc193925e7 (patch) | |
tree | d5deb8b2e8a21ea9169f18b88dabfdc34363a789 /lib/sqfs/blk_proc/serial.c | |
parent | 79498fa15227d4659489763ed2a9a1e806c11428 (diff) |
Merge some of serial & pthread block processor code paths/declarations
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/blk_proc/serial.c')
-rw-r--r-- | lib/sqfs/blk_proc/serial.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/lib/sqfs/blk_proc/serial.c b/lib/sqfs/blk_proc/serial.c index 85f39fe..ee172de 100644 --- a/lib/sqfs/blk_proc/serial.c +++ b/lib/sqfs/blk_proc/serial.c @@ -7,19 +7,6 @@ #define SQFS_BUILDING_DLL #include "internal.h" -#include <string.h> -#include <stdlib.h> - -struct sqfs_block_processor_t { - size_t max_block_size; - sqfs_compressor_t *cmp; - sqfs_block_cb cb; - void *user; - int status; - - uint8_t scratch[]; -}; - sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size, sqfs_compressor_t *cmp, unsigned int num_workers, @@ -51,23 +38,16 @@ void sqfs_block_processor_destroy(sqfs_block_processor_t *proc) int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc, sqfs_block_t *block) { - int ret; - - ret = sqfs_block_process(block, proc->cmp, - proc->scratch, proc->max_block_size); - if (ret) - goto fail; + if (proc->status != 0) { + free(block); + return proc->status; + } - ret = proc->cb(proc->user, block); - if (ret) - goto fail; + proc->status = sqfs_block_process(block, proc->cmp, + proc->scratch, proc->max_block_size); - free(block); - return 0; -fail: - free(block); - proc->status = ret; - return ret; + block->next = NULL; + return process_completed_blocks(proc, block); } int sqfs_block_processor_finish(sqfs_block_processor_t *proc) |