aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-28 21:23:21 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-29 17:22:50 +0100
commit9d5b0c381a7961a14d2a94a6b31a4e25a2543eae (patch)
tree089a3cc96f54cd7b09762840d03e4dc2420c5ea9 /lib
parent60ff56b68ea0593782d7a2ef0ac4e667437418d2 (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')
-rw-r--r--lib/common/data_writer.c8
-rw-r--r--lib/common/statistics.c15
-rw-r--r--lib/common/writer.c19
-rw-r--r--lib/sqfs/Makemodule.am19
-rw-r--r--lib/sqfs/block_processor/block.c (renamed from lib/sqfs/data_writer/block.c)12
-rw-r--r--lib/sqfs/block_processor/common.c (renamed from lib/sqfs/data_writer/common.c)16
-rw-r--r--lib/sqfs/block_processor/fileapi.c (renamed from lib/sqfs/data_writer/fileapi.c)18
-rw-r--r--lib/sqfs/block_processor/fragment.c (renamed from lib/sqfs/data_writer/fragment.c)2
-rw-r--r--lib/sqfs/block_processor/internal.h (renamed from lib/sqfs/data_writer/internal.h)27
-rw-r--r--lib/sqfs/block_processor/serial.c (renamed from lib/sqfs/data_writer/serial.c)34
-rw-r--r--lib/sqfs/block_processor/winpthread.c (renamed from lib/sqfs/data_writer/winpthread.c)68
11 files changed, 121 insertions, 117 deletions
diff --git a/lib/common/data_writer.c b/lib/common/data_writer.c
index c5beba8..8ebd868 100644
--- a/lib/common/data_writer.c
+++ b/lib/common/data_writer.c
@@ -8,7 +8,7 @@
static sqfs_u8 buffer[4096];
-int write_data_from_file(const char *filename, sqfs_data_writer_t *data,
+int write_data_from_file(const char *filename, sqfs_block_processor_t *data,
sqfs_inode_generic_t *inode, sqfs_file_t *file,
int flags)
{
@@ -16,7 +16,7 @@ int write_data_from_file(const char *filename, sqfs_data_writer_t *data,
size_t diff;
int ret;
- ret = sqfs_data_writer_begin_file(data, inode, flags);
+ ret = sqfs_block_processor_begin_file(data, inode, flags);
if (ret) {
sqfs_perror(filename, "beginning file data blocks", ret);
return -1;
@@ -37,14 +37,14 @@ int write_data_from_file(const char *filename, sqfs_data_writer_t *data,
return -1;
}
- ret = sqfs_data_writer_append(data, buffer, diff);
+ ret = sqfs_block_processor_append(data, buffer, diff);
if (ret) {
sqfs_perror(filename, "packing file data", ret);
return -1;
}
}
- ret = sqfs_data_writer_end_file(data);
+ ret = sqfs_block_processor_end_file(data);
if (ret) {
sqfs_perror(filename, "finishing file data", ret);
return -1;
diff --git a/lib/common/statistics.c b/lib/common/statistics.c
index 7bf8fca..b41cd22 100644
--- a/lib/common/statistics.c
+++ b/lib/common/statistics.c
@@ -11,7 +11,7 @@
static void post_block_write(void *user, const sqfs_block_t *block,
sqfs_file_t *file)
{
- data_writer_stats_t *stats = user;
+ block_processor_stats_t *stats = user;
(void)file;
if (block->size == 0)
@@ -28,7 +28,7 @@ static void post_block_write(void *user, const sqfs_block_t *block,
static void pre_fragment_store(void *user, sqfs_block_t *block)
{
- data_writer_stats_t *stats = user;
+ block_processor_stats_t *stats = user;
(void)block;
stats->frag_count += 1;
@@ -36,7 +36,7 @@ static void pre_fragment_store(void *user, sqfs_block_t *block)
static void notify_blocks_erased(void *user, size_t count, sqfs_u64 bytes)
{
- data_writer_stats_t *stats = user;
+ block_processor_stats_t *stats = user;
stats->bytes_written -= bytes;
stats->blocks_written -= count;
@@ -45,7 +45,7 @@ static void notify_blocks_erased(void *user, size_t count, sqfs_u64 bytes)
static void notify_fragment_discard(void *user, const sqfs_block_t *block)
{
- data_writer_stats_t *stats = user;
+ block_processor_stats_t *stats = user;
(void)block;
stats->frag_dup += 1;
@@ -59,12 +59,13 @@ static const sqfs_block_hooks_t hooks = {
.notify_fragment_discard = notify_fragment_discard,
};
-void register_stat_hooks(sqfs_data_writer_t *data, data_writer_stats_t *stats)
+void register_stat_hooks(sqfs_block_processor_t *data,
+ block_processor_stats_t *stats)
{
- sqfs_data_writer_set_hooks(data, stats, &hooks);
+ sqfs_block_processor_set_hooks(data, stats, &hooks);
}
-void sqfs_print_statistics(sqfs_super_t *super, data_writer_stats_t *stats)
+void sqfs_print_statistics(sqfs_super_t *super, block_processor_stats_t *stats)
{
size_t ratio;
diff --git a/lib/common/writer.c b/lib/common/writer.c
index b6adc59..ed3ebbd 100644
--- a/lib/common/writer.c
+++ b/lib/common/writer.c
@@ -123,11 +123,11 @@ int sqfs_writer_init(sqfs_writer_t *sqfs, const sqfs_writer_cfg_t *wrcfg)
if (ret > 0)
sqfs->super.flags |= SQFS_FLAG_COMPRESSOR_OPTIONS;
- sqfs->data = sqfs_data_writer_create(sqfs->super.block_size,
- sqfs->cmp, wrcfg->num_jobs,
- wrcfg->max_backlog,
- wrcfg->devblksize,
- sqfs->outfile);
+ sqfs->data = sqfs_block_processor_create(sqfs->super.block_size,
+ sqfs->cmp, wrcfg->num_jobs,
+ wrcfg->max_backlog,
+ wrcfg->devblksize,
+ sqfs->outfile);
if (sqfs->data == NULL) {
perror("creating data block processor");
goto fail_cmp;
@@ -187,7 +187,7 @@ fail_xwr:
fail_id:
sqfs_id_table_destroy(sqfs->idtbl);
fail_data:
- sqfs_data_writer_destroy(sqfs->data);
+ sqfs_block_processor_destroy(sqfs->data);
fail_cmp:
sqfs->cmp->destroy(sqfs->cmp);
fail_fs:
@@ -204,7 +204,7 @@ int sqfs_writer_finish(sqfs_writer_t *sqfs, const sqfs_writer_cfg_t *cfg)
if (!cfg->quiet)
fputs("Waiting for remaining data blocks...\n", stdout);
- ret = sqfs_data_writer_finish(sqfs->data);
+ ret = sqfs_block_processor_finish(sqfs->data);
if (ret) {
sqfs_perror(cfg->filename, "finishing data blocks", ret);
return -1;
@@ -221,7 +221,8 @@ int sqfs_writer_finish(sqfs_writer_t *sqfs, const sqfs_writer_cfg_t *cfg)
if (!cfg->quiet)
fputs("Writing fragment table...\n", stdout);
- ret = sqfs_data_writer_write_fragment_table(sqfs->data, &sqfs->super);
+ ret = sqfs_block_processor_write_fragment_table(sqfs->data,
+ &sqfs->super);
if (ret) {
sqfs_perror(cfg->filename, "writing fragment table", ret);
return -1;
@@ -291,7 +292,7 @@ void sqfs_writer_cleanup(sqfs_writer_t *sqfs)
sqfs_meta_writer_destroy(sqfs->dm);
sqfs_meta_writer_destroy(sqfs->im);
sqfs_id_table_destroy(sqfs->idtbl);
- sqfs_data_writer_destroy(sqfs->data);
+ sqfs_block_processor_destroy(sqfs->data);
sqfs->cmp->destroy(sqfs->cmp);
fstree_cleanup(&sqfs->fs);
sqfs->outfile->destroy(sqfs->outfile);
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index 47b9ad7..cde947d 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -1,6 +1,6 @@
LIBSQFS_HEARDS = include/sqfs/meta_writer.h \
include/sqfs/meta_reader.h include/sqfs/id_table.h \
- include/sqfs/compressor.h include/sqfs/data_writer.h \
+ include/sqfs/compressor.h include/sqfs/block_processor.h \
include/sqfs/super.h include/sqfs/inode.h \
include/sqfs/dir.h include/sqfs/xattr.h \
include/sqfs/table.h include/sqfs/predef.h \
@@ -19,11 +19,12 @@ libsquashfs_la_SOURCES += lib/sqfs/dir_writer.c lib/sqfs/xattr_reader.c
libsquashfs_la_SOURCES += lib/sqfs/read_table.c lib/sqfs/comp/compressor.c
libsquashfs_la_SOURCES += lib/sqfs/comp/internal.h lib/sqfs/xattr_writer.c
libsquashfs_la_SOURCES += lib/sqfs/dir_reader.c lib/sqfs/read_tree.c
-libsquashfs_la_SOURCES += lib/sqfs/inode.c lib/sqfs/data_writer/fragment.c
-libsquashfs_la_SOURCES += lib/sqfs/write_super.c lib/sqfs/data_writer/block.c
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/internal.h lib/sqfs/data_reader.c
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/common.c
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/fileapi.c
+libsquashfs_la_SOURCES += lib/sqfs/inode.c lib/sqfs/block_processor/fragment.c
+libsquashfs_la_SOURCES += lib/sqfs/write_super.c lib/sqfs/data_reader.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/block.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/internal.h
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/common.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/fileapi.c
libsquashfs_la_SOURCES += lib/sqfs/str_table.c lib/sqfs/str_table.h
libsquashfs_la_SOURCES += lib/sqfs/alloc.c lib/sqfs/util.h
libsquashfs_la_SOURCES += lib/sqfs/frag_table.c include/sqfs/frag_table.h
@@ -45,13 +46,13 @@ libsquashfs_la_SOURCES += lib/sqfs/unix/io_file.c
endif
if HAVE_PTHREAD
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/winpthread.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/winpthread.c
libsquashfs_la_CPPFLAGS += -DWITH_PTHREAD
else
if WINDOWS
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/winpthread.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/winpthread.c
else
-libsquashfs_la_SOURCES += lib/sqfs/data_writer/serial.c
+libsquashfs_la_SOURCES += lib/sqfs/block_processor/serial.c
endif
endif
diff --git a/lib/sqfs/data_writer/block.c b/lib/sqfs/block_processor/block.c
index b45b1ff..49892be 100644
--- a/lib/sqfs/data_writer/block.c
+++ b/lib/sqfs/block_processor/block.c
@@ -9,7 +9,7 @@
#include <string.h>
-static int store_block_location(sqfs_data_writer_t *proc, sqfs_u64 offset,
+static int store_block_location(sqfs_block_processor_t *proc, sqfs_u64 offset,
sqfs_u32 size, sqfs_u32 chksum)
{
size_t new_sz;
@@ -32,7 +32,7 @@ static int store_block_location(sqfs_data_writer_t *proc, sqfs_u64 offset,
return 0;
}
-static size_t deduplicate_blocks(sqfs_data_writer_t *proc, size_t count)
+static size_t deduplicate_blocks(sqfs_block_processor_t *proc, size_t count)
{
size_t i, j;
@@ -50,7 +50,7 @@ static size_t deduplicate_blocks(sqfs_data_writer_t *proc, size_t count)
return i;
}
-static int align_file(sqfs_data_writer_t *proc, sqfs_block_t *blk)
+static int align_file(sqfs_block_processor_t *proc, sqfs_block_t *blk)
{
sqfs_u32 chksum;
void *padding;
@@ -83,7 +83,7 @@ static int align_file(sqfs_data_writer_t *proc, sqfs_block_t *blk)
return store_block_location(proc, size, diff | (1 << 24), chksum);
}
-int process_completed_block(sqfs_data_writer_t *proc, sqfs_block_t *blk)
+int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
{
sqfs_u64 offset, bytes;
size_t start, count;
@@ -171,8 +171,8 @@ int process_completed_block(sqfs_data_writer_t *proc, sqfs_block_t *blk)
return 0;
}
-int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- sqfs_u8 *scratch, size_t scratch_size)
+int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
+ sqfs_u8 *scratch, size_t scratch_size)
{
ssize_t ret;
diff --git a/lib/sqfs/data_writer/common.c b/lib/sqfs/block_processor/common.c
index b207291..c6375dd 100644
--- a/lib/sqfs/data_writer/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -18,9 +18,9 @@ void free_blk_list(sqfs_block_t *list)
}
}
-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)
+int block_processor_init(sqfs_block_processor_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;
@@ -41,7 +41,7 @@ int data_writer_init(sqfs_data_writer_t *proc, size_t max_block_size,
return 0;
}
-void data_writer_cleanup(sqfs_data_writer_t *proc)
+void block_processor_cleanup(sqfs_block_processor_t *proc)
{
if (proc->frag_tbl != NULL)
sqfs_frag_table_destroy(proc->frag_tbl);
@@ -53,15 +53,15 @@ void data_writer_cleanup(sqfs_data_writer_t *proc)
free(proc);
}
-int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc,
- sqfs_super_t *super)
+int sqfs_block_processor_write_fragment_table(sqfs_block_processor_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)
+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;
diff --git a/lib/sqfs/data_writer/fileapi.c b/lib/sqfs/block_processor/fileapi.c
index 89bac0b..9e59c1d 100644
--- a/lib/sqfs/data_writer/fileapi.c
+++ b/lib/sqfs/block_processor/fileapi.c
@@ -12,7 +12,7 @@ static bool is_zero_block(unsigned char *ptr, size_t size)
return ptr[0] == 0 && memcmp(ptr, ptr + 1, size - 1) == 0;
}
-static int enqueue_block(sqfs_data_writer_t *proc, sqfs_block_t *block)
+static int enqueue_block(sqfs_block_processor_t *proc, sqfs_block_t *block)
{
int status;
@@ -28,7 +28,7 @@ static int enqueue_block(sqfs_data_writer_t *proc, sqfs_block_t *block)
return append_to_work_queue(proc, block, proc->notify_threads);
}
-static int add_sentinel_block(sqfs_data_writer_t *proc)
+static int add_sentinel_block(sqfs_block_processor_t *proc)
{
sqfs_block_t *blk = calloc(1, sizeof(*blk));
@@ -41,8 +41,8 @@ static int add_sentinel_block(sqfs_data_writer_t *proc)
return enqueue_block(proc, blk);
}
-int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc,
- sqfs_inode_generic_t *inode, sqfs_u32 flags)
+int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc,
+ sqfs_inode_generic_t *inode, sqfs_u32 flags)
{
if (proc->inode != NULL)
return test_and_set_status(proc, SQFS_ERROR_INTERNAL);
@@ -57,7 +57,7 @@ int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc,
return 0;
}
-static int flush_block(sqfs_data_writer_t *proc, sqfs_block_t *block)
+static int flush_block(sqfs_block_processor_t *proc, sqfs_block_t *block)
{
block->index = proc->blk_index++;
block->flags = proc->blk_flags;
@@ -83,8 +83,8 @@ static int flush_block(sqfs_data_writer_t *proc, sqfs_block_t *block)
return enqueue_block(proc, block);
}
-int sqfs_data_writer_append(sqfs_data_writer_t *proc, const void *data,
- size_t size)
+int sqfs_block_processor_append(sqfs_block_processor_t *proc, const void *data,
+ size_t size)
{
size_t diff;
void *new;
@@ -133,7 +133,7 @@ int sqfs_data_writer_append(sqfs_data_writer_t *proc, const void *data,
return 0;
}
-int sqfs_data_writer_end_file(sqfs_data_writer_t *proc)
+int sqfs_block_processor_end_file(sqfs_block_processor_t *proc)
{
int err;
@@ -162,7 +162,7 @@ int sqfs_data_writer_end_file(sqfs_data_writer_t *proc)
return 0;
}
-int sqfs_data_writer_finish(sqfs_data_writer_t *proc)
+int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
{
int status = 0;
diff --git a/lib/sqfs/data_writer/fragment.c b/lib/sqfs/block_processor/fragment.c
index 9862c89..3701b3c 100644
--- a/lib/sqfs/data_writer/fragment.c
+++ b/lib/sqfs/block_processor/fragment.c
@@ -7,7 +7,7 @@
#define SQFS_BUILDING_DLL
#include "internal.h"
-int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
+int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
sqfs_block_t **blk_out)
{
sqfs_u32 index, offset;
diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/block_processor/internal.h
index 8f59fb7..40871b9 100644
--- a/lib/sqfs/data_writer/internal.h
+++ b/lib/sqfs/block_processor/internal.h
@@ -9,7 +9,7 @@
#include "config.h"
-#include "sqfs/data_writer.h"
+#include "sqfs/block_processor.h"
#include "sqfs/frag_table.h"
#include "sqfs/compressor.h"
#include "sqfs/inode.h"
@@ -46,7 +46,7 @@ typedef struct {
typedef struct compress_worker_t compress_worker_t;
-struct sqfs_data_writer_t {
+struct sqfs_block_processor_t {
/* synchronization primitives */
#ifdef WITH_PTHREAD
pthread_mutex_t mtx;
@@ -108,33 +108,34 @@ struct sqfs_data_writer_t {
#endif
};
-SQFS_INTERNAL int process_completed_block(sqfs_data_writer_t *proc,
+SQFS_INTERNAL int process_completed_block(sqfs_block_processor_t *proc,
sqfs_block_t *block);
SQFS_INTERNAL
-int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
+int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
sqfs_block_t **blk_out);
SQFS_INTERNAL void free_blk_list(sqfs_block_t *list);
SQFS_INTERNAL
-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);
+int block_processor_init(sqfs_block_processor_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);
-SQFS_INTERNAL void data_writer_cleanup(sqfs_data_writer_t *proc);
+SQFS_INTERNAL void block_processor_cleanup(sqfs_block_processor_t *proc);
SQFS_INTERNAL
-int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- sqfs_u8 *scratch, size_t scratch_size);
+int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
+ sqfs_u8 *scratch, size_t scratch_size);
SQFS_INTERNAL
-int test_and_set_status(sqfs_data_writer_t *proc, int status);
+int test_and_set_status(sqfs_block_processor_t *proc, int status);
SQFS_INTERNAL
-int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
+int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block,
bool notify_threads);
-SQFS_INTERNAL int wait_completed(sqfs_data_writer_t *proc);
+SQFS_INTERNAL int wait_completed(sqfs_block_processor_t *proc);
#endif /* INTERNAL_H */
diff --git a/lib/sqfs/data_writer/serial.c b/lib/sqfs/block_processor/serial.c
index 82f7836..eedb19c 100644
--- a/lib/sqfs/data_writer/serial.c
+++ b/lib/sqfs/block_processor/serial.c
@@ -7,35 +7,35 @@
#define SQFS_BUILDING_DLL
#include "internal.h"
-sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
- sqfs_compressor_t *cmp,
- unsigned int num_workers,
- size_t max_backlog,
- size_t devblksz,
- sqfs_file_t *file)
+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,
+ size_t devblksz,
+ sqfs_file_t *file)
{
- sqfs_data_writer_t *proc;
+ sqfs_block_processor_t *proc;
proc = alloc_flex(sizeof(*proc), 1, max_block_size);
if (proc == NULL)
return NULL;
- if (data_writer_init(proc, max_block_size, cmp, num_workers,
- max_backlog, devblksz, file)) {
- data_writer_cleanup(proc);
+ if (block_processor_init(proc, max_block_size, cmp, num_workers,
+ max_backlog, devblksz, file)) {
+ block_processor_cleanup(proc);
return NULL;
}
return proc;
}
-void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
+void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
{
- data_writer_cleanup(proc);
+ block_processor_cleanup(proc);
}
-int test_and_set_status(sqfs_data_writer_t *proc, int status)
+int test_and_set_status(sqfs_block_processor_t *proc, int status)
{
if (proc->status == 0)
proc->status = status;
@@ -43,7 +43,7 @@ int test_and_set_status(sqfs_data_writer_t *proc, int status)
return proc->status;
}
-int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
+int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block,
bool signal_threads)
{
sqfs_block_t *fragblk = NULL;
@@ -72,8 +72,8 @@ int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
block = fragblk;
}
- proc->status = data_writer_do_block(block, proc->cmp, proc->scratch,
- proc->max_block_size);
+ proc->status = block_processor_do_block(block, proc->cmp, proc->scratch,
+ proc->max_block_size);
if (proc->status == 0)
proc->status = process_completed_block(proc, block);
@@ -82,7 +82,7 @@ int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
return proc->status;
}
-int wait_completed(sqfs_data_writer_t *proc)
+int wait_completed(sqfs_block_processor_t *proc)
{
return proc->status;
}
diff --git a/lib/sqfs/data_writer/winpthread.c b/lib/sqfs/block_processor/winpthread.c
index e575859..b16a17c 100644
--- a/lib/sqfs/data_writer/winpthread.c
+++ b/lib/sqfs/block_processor/winpthread.c
@@ -28,7 +28,7 @@
#endif
struct compress_worker_t {
- sqfs_data_writer_t *shared;
+ sqfs_block_processor_t *shared;
sqfs_compressor_t *cmp;
THREAD_HANDLE thread;
sqfs_u8 scratch[];
@@ -37,7 +37,7 @@ struct compress_worker_t {
static THREAD_TYPE worker_proc(THREAD_ARG arg)
{
compress_worker_t *worker = arg;
- sqfs_data_writer_t *shared = worker->shared;
+ sqfs_block_processor_t *shared = worker->shared;
sqfs_block_t *it, *prev, *blk = NULL;
int status = 0;
@@ -85,23 +85,23 @@ static THREAD_TYPE worker_proc(THREAD_ARG arg)
if (blk == NULL)
break;
- status = data_writer_do_block(blk, worker->cmp,
- worker->scratch,
- shared->max_block_size);
+ status = block_processor_do_block(blk, worker->cmp,
+ worker->scratch,
+ shared->max_block_size);
}
return THREAD_EXIT_SUCCESS;
}
#if defined(_WIN32) || defined(__WINDOWS__)
-sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
- sqfs_compressor_t *cmp,
- unsigned int num_workers,
- size_t max_backlog,
- size_t devblksz,
- sqfs_file_t *file)
+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,
+ size_t devblksz,
+ sqfs_file_t *file)
{
- sqfs_data_writer_t *proc;
+ sqfs_block_processor_t *proc;
unsigned int i;
if (num_workers < 1)
@@ -116,8 +116,8 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
InitializeConditionVariable(&proc->queue_cond);
InitializeConditionVariable(&proc->done_cond);
- if (data_writer_init(proc, max_block_size, cmp, num_workers,
- max_backlog, devblksz, file)) {
+ if (block_processor_init(proc, max_block_size, cmp, num_workers,
+ max_backlog, devblksz, file)) {
goto fail;
}
@@ -142,11 +142,11 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
return proc;
fail:
- sqfs_data_writer_destroy(proc);
+ sqfs_block_processor_destroy(proc);
return NULL;
}
-void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
+void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
{
unsigned int i;
@@ -171,17 +171,17 @@ void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
}
DeleteCriticalSection(&proc->mtx);
- data_writer_cleanup(proc);
+ block_processor_cleanup(proc);
}
#else
-sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
- sqfs_compressor_t *cmp,
- unsigned int num_workers,
- size_t max_backlog,
- size_t devblksz,
- sqfs_file_t *file)
+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,
+ size_t devblksz,
+ sqfs_file_t *file)
{
- sqfs_data_writer_t *proc;
+ sqfs_block_processor_t *proc;
sigset_t set, oldset;
unsigned int i;
int ret;
@@ -198,8 +198,8 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
proc->queue_cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
proc->done_cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER;
- if (data_writer_init(proc, max_block_size, cmp, num_workers,
- max_backlog, devblksz, file)) {
+ if (block_processor_init(proc, max_block_size, cmp, num_workers,
+ max_backlog, devblksz, file)) {
goto fail_init;
}
@@ -257,11 +257,11 @@ fail_init:
pthread_cond_destroy(&proc->done_cond);
pthread_cond_destroy(&proc->queue_cond);
pthread_mutex_destroy(&proc->mtx);
- data_writer_cleanup(proc);
+ block_processor_cleanup(proc);
return NULL;
}
-void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
+void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
{
unsigned int i;
@@ -281,11 +281,11 @@ void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
pthread_cond_destroy(&proc->queue_cond);
pthread_mutex_destroy(&proc->mtx);
- data_writer_cleanup(proc);
+ block_processor_cleanup(proc);
}
#endif
-int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
+int append_to_work_queue(sqfs_block_processor_t *proc, sqfs_block_t *block,
bool signal_threads)
{
int status;
@@ -317,7 +317,7 @@ out:
return 0;
}
-static sqfs_block_t *try_dequeue(sqfs_data_writer_t *proc)
+static sqfs_block_t *try_dequeue(sqfs_block_processor_t *proc)
{
sqfs_block_t *queue, *it, *prev;
@@ -363,7 +363,7 @@ static sqfs_block_t *queue_merge(sqfs_block_t *lhs, sqfs_block_t *rhs)
return head;
}
-static int process_done_queue(sqfs_data_writer_t *proc, sqfs_block_t *queue)
+static int process_done_queue(sqfs_block_processor_t *proc, sqfs_block_t *queue)
{
sqfs_block_t *it, *block = NULL;
int status = 0;
@@ -410,7 +410,7 @@ static int process_done_queue(sqfs_data_writer_t *proc, sqfs_block_t *queue)
return status;
}
-int test_and_set_status(sqfs_data_writer_t *proc, int status)
+int test_and_set_status(sqfs_block_processor_t *proc, int status)
{
LOCK(&proc->mtx);
if (proc->status == 0) {
@@ -423,7 +423,7 @@ int test_and_set_status(sqfs_data_writer_t *proc, int status)
return status;
}
-int wait_completed(sqfs_data_writer_t *proc)
+int wait_completed(sqfs_block_processor_t *proc)
{
sqfs_block_t *queue;
int status;