summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/serial.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 20:08:33 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 20:10:16 +0200
commitefb6ab552c5cdc9d12585c7c24b98667e212cb4c (patch)
treeab3ea9e3a22d8e4111cbc7b99ee99c6b6dae32f9 /lib/sqfs/block_processor/serial.c
parentbe6c0820313401f92f272db96f66053bdaa15320 (diff)
Block processor: merge finish & sync functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/serial.c')
-rw-r--r--lib/sqfs/block_processor/serial.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/sqfs/block_processor/serial.c b/lib/sqfs/block_processor/serial.c
index 9768a7f..7b3825d 100644
--- a/lib/sqfs/block_processor/serial.c
+++ b/lib/sqfs/block_processor/serial.c
@@ -75,6 +75,11 @@ fail:
return sproc->status;
}
+static int block_processor_sync(sqfs_block_processor_t *proc)
+{
+ return ((serial_block_processor_t *)proc)->status;
+}
+
sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
sqfs_compressor_t *cmp,
unsigned int num_workers,
@@ -94,37 +99,8 @@ sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
return NULL;
}
+ proc->base.sync = block_processor_sync;
proc->base.append_to_work_queue = append_to_work_queue;
((sqfs_object_t *)proc)->destroy = block_processor_destroy;
return (sqfs_block_processor_t *)proc;
}
-
-int sqfs_block_processor_sync(sqfs_block_processor_t *proc)
-{
- return ((serial_block_processor_t *)proc)->status;
-}
-
-int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
-{
- serial_block_processor_t *sproc = (serial_block_processor_t *)proc;
-
- if (proc->frag_block == NULL || sproc->status != 0)
- goto fail;
-
- sproc->status = proc->process_block(proc->frag_block, proc->cmp,
- sproc->scratch,
- proc->max_block_size);
- if (sproc->status != 0)
- goto fail;
-
- sproc->status = proc->process_completed_block(proc, proc->frag_block);
- proc->frag_block = NULL;
- return sproc->status;
-fail:
- if (proc->frag_block != NULL) {
- free_block_list(proc->frag_block->frag_list);
- free(proc->frag_block);
- proc->frag_block = NULL;
- }
- return sproc->status;
-}