summaryrefslogtreecommitdiff
path: root/lib/sqfs/comp/block_processor.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 15:44:56 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 15:44:56 +0200
commit6391ed9a18caf89ade24c05083569c66d8daa33b (patch)
tree1e61bee9545d584f79f9040573275ab876febf8d /lib/sqfs/comp/block_processor.c
parent1245c4eeb1eea7a5301f500d001b6db91c3f1283 (diff)
Move block processor from compressor to libsquashfs code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/comp/block_processor.c')
-rw-r--r--lib/sqfs/comp/block_processor.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/sqfs/comp/block_processor.c b/lib/sqfs/comp/block_processor.c
deleted file mode 100644
index 3a6926c..0000000
--- a/lib/sqfs/comp/block_processor.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * block_processor.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-
-#include "sqfs/block_processor.h"
-#include "util.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-struct block_processor_t {
- size_t max_block_size;
- compressor_t *cmp;
- block_cb cb;
- void *user;
- int status;
-
- uint8_t scratch[];
-};
-
-block_processor_t *block_processor_create(size_t max_block_size,
- compressor_t *cmp,
- unsigned int num_workers,
- void *user,
- block_cb callback)
-{
- block_processor_t *proc = alloc_flex(sizeof(*proc), 1, max_block_size);
- (void)num_workers;
-
- if (proc == NULL) {
- perror("Creating block processor");
- return NULL;
- }
-
- proc->max_block_size = max_block_size;
- proc->cmp = cmp;
- proc->cb = callback;
- proc->user = user;
- return proc;
-}
-
-void block_processor_destroy(block_processor_t *proc)
-{
- free(proc);
-}
-
-int block_processor_enqueue(block_processor_t *proc, block_t *block)
-{
- if (process_block(block, proc->cmp,
- proc->scratch, proc->max_block_size))
- goto fail;
-
- if (proc->cb(proc->user, block))
- goto fail;
-
- free(block);
- return 0;
-fail:
- free(block);
- proc->status = -1;
- return -1;
-}
-
-int block_processor_finish(block_processor_t *proc)
-{
- return proc->status;
-}