summaryrefslogtreecommitdiff
path: root/lib/sqfs/blk_proc/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/blk_proc/serial.c')
-rw-r--r--lib/sqfs/blk_proc/serial.c36
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)