summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/block_processor/common.c')
-rw-r--r--lib/sqfs/block_processor/common.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index c6375dd..806a595 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -25,19 +25,16 @@ int block_processor_init(sqfs_block_processor_t *proc, size_t max_block_size,
proc->max_block_size = max_block_size;
proc->num_workers = num_workers;
proc->max_backlog = max_backlog;
- proc->devblksz = devblksz;
proc->cmp = cmp;
proc->file = file;
- proc->max_blocks = INIT_BLOCK_COUNT;
proc->frag_tbl = sqfs_frag_table_create(0);
if (proc->frag_tbl == NULL)
return -1;
- proc->blocks = alloc_array(sizeof(proc->blocks[0]), proc->max_blocks);
- if (proc->blocks == NULL)
+ proc->wr = sqfs_block_writer_create(file, devblksz, 0);
+ if (proc->wr == NULL)
return -1;
-
return 0;
}
@@ -45,11 +42,12 @@ void block_processor_cleanup(sqfs_block_processor_t *proc)
{
if (proc->frag_tbl != NULL)
sqfs_frag_table_destroy(proc->frag_tbl);
+ if (proc->wr != NULL)
+ sqfs_block_writer_destroy(proc->wr);
free_blk_list(proc->queue);
free_blk_list(proc->done);
free(proc->blk_current);
free(proc->frag_block);
- free(proc->blocks);
free(proc);
}
@@ -63,10 +61,8 @@ int sqfs_block_processor_write_fragment_table(sqfs_block_processor_t *proc,
int sqfs_block_processor_set_hooks(sqfs_block_processor_t *proc, void *user_ptr,
const sqfs_block_hooks_t *hooks)
{
- if (hooks->size != sizeof(*hooks))
- return SQFS_ERROR_UNSUPPORTED;
-
proc->hooks = hooks;
proc->user_ptr = user_ptr;
- return 0;
+
+ return sqfs_block_writer_set_hooks(proc->wr, user_ptr, hooks);
}