diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-28 21:23:21 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-29 17:22:50 +0100 |
commit | 9d5b0c381a7961a14d2a94a6b31a4e25a2543eae (patch) | |
tree | 089a3cc96f54cd7b09762840d03e4dc2420c5ea9 /lib/sqfs/data_writer/common.c | |
parent | 60ff56b68ea0593782d7a2ef0ac4e667437418d2 (diff) |
Rename sqfs_data_writer_t back to sqfs_block_processor_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/data_writer/common.c')
-rw-r--r-- | lib/sqfs/data_writer/common.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/lib/sqfs/data_writer/common.c b/lib/sqfs/data_writer/common.c deleted file mode 100644 index b207291..0000000 --- a/lib/sqfs/data_writer/common.c +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * common.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#define SQFS_BUILDING_DLL -#include "internal.h" - -void free_blk_list(sqfs_block_t *list) -{ - sqfs_block_t *it; - - while (list != NULL) { - it = list; - list = list->next; - free(it); - } -} - -int data_writer_init(sqfs_data_writer_t *proc, size_t max_block_size, - sqfs_compressor_t *cmp, unsigned int num_workers, - size_t max_backlog, size_t devblksz, sqfs_file_t *file) -{ - 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) - return -1; - - return 0; -} - -void data_writer_cleanup(sqfs_data_writer_t *proc) -{ - if (proc->frag_tbl != NULL) - sqfs_frag_table_destroy(proc->frag_tbl); - free_blk_list(proc->queue); - free_blk_list(proc->done); - free(proc->blk_current); - free(proc->frag_block); - free(proc->blocks); - free(proc); -} - -int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc, - sqfs_super_t *super) -{ - return sqfs_frag_table_write(proc->frag_tbl, proc->file, - super, proc->cmp); -} - -int sqfs_data_writer_set_hooks(sqfs_data_writer_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; -} |