diff options
-rw-r--r-- | lib/sqfs/block_processor/fileapi.c | 25 | ||||
-rw-r--r-- | lib/sqfs/block_processor/serial.c | 19 | ||||
-rw-r--r-- | lib/sqfs/block_processor/winpthread.c | 25 |
3 files changed, 44 insertions, 25 deletions
diff --git a/lib/sqfs/block_processor/fileapi.c b/lib/sqfs/block_processor/fileapi.c index ede94d7..dbe3cf2 100644 --- a/lib/sqfs/block_processor/fileapi.c +++ b/lib/sqfs/block_processor/fileapi.c @@ -165,28 +165,3 @@ int sqfs_block_processor_end_file(sqfs_block_processor_t *proc) proc->blk_index = 0; return 0; } - -int sqfs_block_processor_finish(sqfs_block_processor_t *proc) -{ - int status = 0; - - append_to_work_queue(proc, NULL); - - while (proc->backlog > 0) { - status = wait_completed(proc); - if (status) - return status; - } - - if (proc->frag_block != NULL) { - status = append_to_work_queue(proc, proc->frag_block); - proc->frag_block = NULL; - - if (status) - return status; - - status = wait_completed(proc); - } - - return status; -} diff --git a/lib/sqfs/block_processor/serial.c b/lib/sqfs/block_processor/serial.c index dce7490..b1e1823 100644 --- a/lib/sqfs/block_processor/serial.c +++ b/lib/sqfs/block_processor/serial.c @@ -77,3 +77,22 @@ int wait_completed(sqfs_block_processor_t *proc) { return proc->status; } + +int sqfs_block_processor_finish(sqfs_block_processor_t *proc) +{ + if (proc->frag_block != NULL && proc->status == 0) { + proc->status = block_processor_do_block(proc->frag_block, + proc->cmp, + proc->scratch, + proc->max_block_size); + + if (proc->status == 0) { + proc->status = process_completed_block(proc, + proc->frag_block); + } + } + + free(proc->frag_block); + proc->frag_block = NULL; + return proc->status; +} diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c index ca07718..708a2d1 100644 --- a/lib/sqfs/block_processor/winpthread.c +++ b/lib/sqfs/block_processor/winpthread.c @@ -446,3 +446,28 @@ int wait_completed(sqfs_block_processor_t *proc) } return status; } + +int sqfs_block_processor_finish(sqfs_block_processor_t *proc) +{ + int status = 0; + + append_to_work_queue(proc, NULL); + + while (proc->backlog > 0) { + status = wait_completed(proc); + if (status) + return status; + } + + if (proc->frag_block != NULL) { + status = append_to_work_queue(proc, proc->frag_block); + proc->frag_block = NULL; + + if (status) + return status; + + status = wait_completed(proc); + } + + return status; +} |