summaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-12 14:04:06 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-12 14:05:36 +0200
commit31ae9e5cc5337558ddb456c379949e23af43fd9f (patch)
tree9281c7a14449efd6300fa012310a5151657ea4a5 /lib/sqfs/block_processor.c
parent9879cd8393b0d5ec26885de9f9dce2d34997db42 (diff)
Cleanup: move block processor code to sub directory
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor.c')
-rw-r--r--lib/sqfs/block_processor.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/lib/sqfs/block_processor.c b/lib/sqfs/block_processor.c
deleted file mode 100644
index ef71f9e..0000000
--- a/lib/sqfs/block_processor.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* SPDX-License-Identifier: LGPL-3.0-or-later */
-/*
- * block_processor.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#define SQFS_BUILDING_DLL
-#include "config.h"
-
-#include "sqfs/block_processor.h"
-#include "sqfs/error.h"
-#include "util.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,
- size_t max_backlog,
- void *user,
- sqfs_block_cb callback)
-{
- sqfs_block_processor_t *proc;
- (void)num_workers;
- (void)max_backlog;
-
- proc = alloc_flex(sizeof(*proc), 1, max_block_size);
-
- if (proc == NULL)
- return NULL;
-
- proc->max_block_size = max_block_size;
- proc->cmp = cmp;
- proc->cb = callback;
- proc->user = user;
- return proc;
-}
-
-void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
-{
- free(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;
-
- ret = proc->cb(proc->user, block);
- if (ret)
- goto fail;
-
- free(block);
- return 0;
-fail:
- free(block);
- proc->status = ret;
- return ret;
-}
-
-int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
-{
- return proc->status;
-}