summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-25 07:28:04 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-25 07:29:11 +0200
commitedac31f28863ae9f1b310d971fb194959c42c916 (patch)
treed9d81491e442123d776c6265795db47247ee6346 /lib
parent9434bdfaedb733e1441d87fedde8056efeda7145 (diff)
Rename block processor to sqfs_data_writer_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/Makemodule.am14
-rw-r--r--lib/sqfs/data_reader.c2
-rw-r--r--lib/sqfs/data_writer/block.c (renamed from lib/sqfs/blk_proc/block.c)8
-rw-r--r--lib/sqfs/data_writer/common.c (renamed from lib/sqfs/blk_proc/common.c)23
-rw-r--r--lib/sqfs/data_writer/fragment.c (renamed from lib/sqfs/blk_proc/fragment.c)8
-rw-r--r--lib/sqfs/data_writer/internal.h (renamed from lib/sqfs/blk_proc/internal.h)29
-rw-r--r--lib/sqfs/data_writer/pthread.c (renamed from lib/sqfs/blk_proc/pthread.c)52
-rw-r--r--lib/sqfs/data_writer/serial.c (renamed from lib/sqfs/blk_proc/serial.c)42
-rw-r--r--lib/sqfs/io.c2
-rw-r--r--lib/sqfshelper/data_reader_dump.c2
-rw-r--r--lib/sqfshelper/data_writer.c23
11 files changed, 99 insertions, 106 deletions
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index e8b9284..459f359 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -1,6 +1,6 @@
LIBSQFS_HEARDS = include/sqfs/data.h include/sqfs/meta_writer.h \
include/sqfs/meta_reader.h include/sqfs/id_table.h \
- include/sqfs/compress.h include/sqfs/block_processor.h \
+ include/sqfs/compress.h include/sqfs/data_writer.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 \
@@ -17,10 +17,10 @@ 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/io_stdin.c lib/sqfs/comp/internal.h
libsquashfs_la_SOURCES += lib/sqfs/dir_reader.c lib/sqfs/read_tree.c
-libsquashfs_la_SOURCES += lib/sqfs/inode.c lib/sqfs/blk_proc/fragment.c
-libsquashfs_la_SOURCES += lib/sqfs/blk_proc/block.c lib/sqfs/io.c
-libsquashfs_la_SOURCES += lib/sqfs/blk_proc/internal.h lib/sqfs/data_reader.c
-libsquashfs_la_SOURCES += lib/sqfs/blk_proc/common.c
+libsquashfs_la_SOURCES += lib/sqfs/inode.c lib/sqfs/data_writer/fragment.c
+libsquashfs_la_SOURCES += lib/sqfs/data_writer/block.c lib/sqfs/io.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_CPPFLAGS = $(AM_CPPFLAGS)
libsquashfs_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
libsquashfs_la_CFLAGS += $(XZ_CFLAGS) $(LZO_CFLAGS) $(LZ4_CFLAGS)
@@ -29,10 +29,10 @@ libsquashfs_la_LIBADD = $(XZ_LIBS) $(ZLIB_LIBS) $(LZO_LIBS) $(LZ4_LIBS)
libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS) libutil.la
if HAVE_PTHREAD
-libsquashfs_la_SOURCES += lib/sqfs/blk_proc/pthread.c
+libsquashfs_la_SOURCES += lib/sqfs/data_writer/pthread.c
libsquashfs_la_CPPFLAGS += -DWITH_PTHREAD
else
-libsquashfs_la_SOURCES += lib/sqfs/blk_proc/serial.c
+libsquashfs_la_SOURCES += lib/sqfs/data_writer/serial.c
endif
if WITH_GZIP
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index 19b416b..0ea08ee 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -7,7 +7,7 @@
#define SQFS_BUILDING_DLL
#include "config.h"
-#include "sqfs/block_processor.h"
+#include "sqfs/data_writer.h"
#include "sqfs/data_reader.h"
#include "sqfs/compress.h"
#include "sqfs/error.h"
diff --git a/lib/sqfs/blk_proc/block.c b/lib/sqfs/data_writer/block.c
index 69a7119..9461737 100644
--- a/lib/sqfs/blk_proc/block.c
+++ b/lib/sqfs/data_writer/block.c
@@ -9,7 +9,7 @@
#include <string.h>
-static int store_block_location(sqfs_block_processor_t *proc, uint64_t offset,
+static int store_block_location(sqfs_data_writer_t *proc, uint64_t offset,
uint32_t size, uint32_t chksum)
{
size_t new_sz;
@@ -32,7 +32,7 @@ static int store_block_location(sqfs_block_processor_t *proc, uint64_t offset,
return 0;
}
-static size_t deduplicate_blocks(sqfs_block_processor_t *proc, size_t count)
+static size_t deduplicate_blocks(sqfs_data_writer_t *proc, size_t count)
{
size_t i, j;
@@ -50,7 +50,7 @@ static size_t deduplicate_blocks(sqfs_block_processor_t *proc, size_t count)
return i;
}
-static int allign_file(sqfs_block_processor_t *proc, sqfs_block_t *blk)
+static int allign_file(sqfs_data_writer_t *proc, sqfs_block_t *blk)
{
if (!(blk->flags & SQFS_BLK_ALLIGN))
return 0;
@@ -59,7 +59,7 @@ static int allign_file(sqfs_block_processor_t *proc, sqfs_block_t *blk)
proc->devblksz);
}
-int process_completed_block(sqfs_block_processor_t *proc, sqfs_block_t *blk)
+int process_completed_block(sqfs_data_writer_t *proc, sqfs_block_t *blk)
{
size_t start, count;
uint64_t offset;
diff --git a/lib/sqfs/blk_proc/common.c b/lib/sqfs/data_writer/common.c
index a3c91eb..51acc1e 100644
--- a/lib/sqfs/blk_proc/common.c
+++ b/lib/sqfs/data_writer/common.c
@@ -18,10 +18,9 @@ void free_blk_list(sqfs_block_t *list)
}
}
-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)
+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;
@@ -44,7 +43,7 @@ int block_processor_init(sqfs_block_processor_t *proc, size_t max_block_size,
return 0;
}
-void block_processor_cleanup(sqfs_block_processor_t *proc)
+void data_writer_cleanup(sqfs_data_writer_t *proc)
{
free_blk_list(proc->queue);
free_blk_list(proc->done);
@@ -55,8 +54,8 @@ void block_processor_cleanup(sqfs_block_processor_t *proc)
free(proc);
}
-void block_processor_store_done(sqfs_block_processor_t *proc,
- sqfs_block_t *blk, int status)
+void data_writer_store_done(sqfs_data_writer_t *proc, sqfs_block_t *blk,
+ int status)
{
sqfs_block_t *it = proc->done, *prev = NULL;
@@ -81,7 +80,7 @@ void block_processor_store_done(sqfs_block_processor_t *proc,
proc->backlog -= 1;
}
-sqfs_block_t *block_processor_next_work_item(sqfs_block_processor_t *proc)
+sqfs_block_t *data_writer_next_work_item(sqfs_data_writer_t *proc)
{
sqfs_block_t *blk;
@@ -98,8 +97,8 @@ sqfs_block_t *block_processor_next_work_item(sqfs_block_processor_t *proc)
return blk;
}
-int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- uint8_t *scratch, size_t scratch_size)
+int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
+ uint8_t *scratch, size_t scratch_size)
{
ssize_t ret;
@@ -129,8 +128,8 @@ int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
return 0;
}
-int sqfs_block_processor_write_fragment_table(sqfs_block_processor_t *proc,
- sqfs_super_t *super)
+int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc,
+ sqfs_super_t *super)
{
uint64_t start;
size_t size;
diff --git a/lib/sqfs/blk_proc/fragment.c b/lib/sqfs/data_writer/fragment.c
index 5fa2349..e4fe9b4 100644
--- a/lib/sqfs/blk_proc/fragment.c
+++ b/lib/sqfs/data_writer/fragment.c
@@ -7,7 +7,7 @@
#define SQFS_BUILDING_DLL
#include "internal.h"
-static int grow_fragment_table(sqfs_block_processor_t *proc)
+static int grow_fragment_table(sqfs_data_writer_t *proc)
{
size_t newsz;
void *new;
@@ -28,7 +28,7 @@ static int grow_fragment_table(sqfs_block_processor_t *proc)
return 0;
}
-static int grow_deduplication_list(sqfs_block_processor_t *proc)
+static int grow_deduplication_list(sqfs_data_writer_t *proc)
{
size_t new_sz;
void *new;
@@ -48,7 +48,7 @@ static int grow_deduplication_list(sqfs_block_processor_t *proc)
return 0;
}
-static int store_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
+static int store_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
uint64_t hash)
{
int err = grow_deduplication_list(proc);
@@ -72,7 +72,7 @@ static int store_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
return 0;
}
-int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
+int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
sqfs_block_t **blk_out)
{
uint64_t hash;
diff --git a/lib/sqfs/blk_proc/internal.h b/lib/sqfs/data_writer/internal.h
index 1c403a9..10cc82c 100644
--- a/lib/sqfs/blk_proc/internal.h
+++ b/lib/sqfs/data_writer/internal.h
@@ -9,7 +9,7 @@
#include "config.h"
-#include "sqfs/block_processor.h"
+#include "sqfs/data_writer.h"
#include "sqfs/compress.h"
#include "sqfs/inode.h"
#include "sqfs/table.h"
@@ -47,14 +47,14 @@ typedef struct {
#ifdef WITH_PTHREAD
typedef struct {
- sqfs_block_processor_t *shared;
+ sqfs_data_writer_t *shared;
sqfs_compressor_t *cmp;
pthread_t thread;
uint8_t scratch[];
} compress_worker_t;
#endif
-struct sqfs_block_processor_t {
+struct sqfs_data_writer_t {
/* synchronization primitives */
#ifdef WITH_PTHREAD
pthread_mutex_t mtx;
@@ -107,32 +107,31 @@ struct sqfs_block_processor_t {
#endif
};
-SQFS_INTERNAL int process_completed_block(sqfs_block_processor_t *proc,
+SQFS_INTERNAL int process_completed_block(sqfs_data_writer_t *proc,
sqfs_block_t *block);
SQFS_INTERNAL
-int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag,
+int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
sqfs_block_t **blk_out);
SQFS_INTERNAL void free_blk_list(sqfs_block_t *list);
SQFS_INTERNAL
-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);
+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);
-SQFS_INTERNAL void block_processor_cleanup(sqfs_block_processor_t *proc);
+SQFS_INTERNAL void data_writer_cleanup(sqfs_data_writer_t *proc);
SQFS_INTERNAL
-void block_processor_store_done(sqfs_block_processor_t *proc,
- sqfs_block_t *blk, int status);
+void data_writer_store_done(sqfs_data_writer_t *proc, sqfs_block_t *blk,
+ int status);
SQFS_INTERNAL
-sqfs_block_t *block_processor_next_work_item(sqfs_block_processor_t *proc);
+sqfs_block_t *data_writer_next_work_item(sqfs_data_writer_t *proc);
SQFS_INTERNAL
-int block_processor_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- uint8_t *scratch, size_t scratch_size);
+int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
+ uint8_t *scratch, size_t scratch_size);
#endif /* INTERNAL_H */
diff --git a/lib/sqfs/blk_proc/pthread.c b/lib/sqfs/data_writer/pthread.c
index 7b95c7c..3170c11 100644
--- a/lib/sqfs/blk_proc/pthread.c
+++ b/lib/sqfs/data_writer/pthread.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
- * block_processor.c
+ * pthread.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
@@ -10,41 +10,41 @@
static void *worker_proc(void *arg)
{
compress_worker_t *worker = arg;
- sqfs_block_processor_t *shared = worker->shared;
+ sqfs_data_writer_t *shared = worker->shared;
sqfs_block_t *blk = NULL;
int status = 0;
for (;;) {
pthread_mutex_lock(&shared->mtx);
if (blk != NULL) {
- block_processor_store_done(shared, blk, status);
+ data_writer_store_done(shared, blk, status);
pthread_cond_broadcast(&shared->done_cond);
}
while (shared->queue == NULL && shared->status == 0)
pthread_cond_wait(&shared->queue_cond, &shared->mtx);
- blk = block_processor_next_work_item(shared);
+ blk = data_writer_next_work_item(shared);
pthread_mutex_unlock(&shared->mtx);
if (blk == NULL)
break;
- status = block_processor_do_block(blk, worker->cmp,
- worker->scratch,
- shared->max_block_size);
+ status = data_writer_do_block(blk, worker->cmp,
+ worker->scratch,
+ shared->max_block_size);
}
return NULL;
}
-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 *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 *proc;
+ sqfs_data_writer_t *proc;
unsigned int i;
int ret;
@@ -60,8 +60,8 @@ sqfs_block_processor_t *sqfs_block_processor_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 (block_processor_init(proc, max_block_size, cmp, num_workers,
- max_backlog, devblksz, file)) {
+ if (data_writer_init(proc, max_block_size, cmp, num_workers,
+ max_backlog, devblksz, file)) {
goto fail_init;
}
@@ -113,11 +113,11 @@ fail_init:
pthread_cond_destroy(&proc->done_cond);
pthread_cond_destroy(&proc->queue_cond);
pthread_mutex_destroy(&proc->mtx);
- block_processor_cleanup(proc);
+ data_writer_cleanup(proc);
return NULL;
}
-void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
+void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
{
unsigned int i;
@@ -137,10 +137,10 @@ void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
pthread_cond_destroy(&proc->queue_cond);
pthread_mutex_destroy(&proc->mtx);
- block_processor_cleanup(proc);
+ data_writer_cleanup(proc);
}
-static void append_to_work_queue(sqfs_block_processor_t *proc,
+static void append_to_work_queue(sqfs_data_writer_t *proc,
sqfs_block_t *block)
{
if (proc->queue_last == NULL) {
@@ -156,7 +156,7 @@ static void append_to_work_queue(sqfs_block_processor_t *proc,
pthread_cond_broadcast(&proc->queue_cond);
}
-static int test_and_set_status(sqfs_block_processor_t *proc, int status)
+static int test_and_set_status(sqfs_data_writer_t *proc, int status)
{
pthread_mutex_lock(&proc->mtx);
if (proc->status == 0) {
@@ -168,7 +168,7 @@ static int test_and_set_status(sqfs_block_processor_t *proc, int status)
return status;
}
-static sqfs_block_t *try_dequeue(sqfs_block_processor_t *proc)
+static sqfs_block_t *try_dequeue(sqfs_data_writer_t *proc)
{
sqfs_block_t *queue, *it, *prev;
@@ -214,8 +214,7 @@ static sqfs_block_t *queue_merge(sqfs_block_t *lhs, sqfs_block_t *rhs)
return head;
}
-static int process_done_queue(sqfs_block_processor_t *proc,
- sqfs_block_t *queue)
+static int process_done_queue(sqfs_data_writer_t *proc, sqfs_block_t *queue)
{
sqfs_block_t *it, *block = NULL;
int status = 0;
@@ -261,8 +260,7 @@ static int process_done_queue(sqfs_block_processor_t *proc,
return status;
}
-int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
- sqfs_block_t *block)
+int sqfs_data_writer_enqueue(sqfs_data_writer_t *proc, sqfs_block_t *block)
{
sqfs_block_t *queue;
int status;
@@ -296,7 +294,7 @@ int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
return 0;
}
-int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
+int sqfs_data_writer_finish(sqfs_data_writer_t *proc)
{
sqfs_block_t *queue;
int status = 0;
diff --git a/lib/sqfs/blk_proc/serial.c b/lib/sqfs/data_writer/serial.c
index fcbf002..38dcc58 100644
--- a/lib/sqfs/blk_proc/serial.c
+++ b/lib/sqfs/data_writer/serial.c
@@ -1,42 +1,41 @@
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
- * block_processor.c
+ * serial.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
#define SQFS_BUILDING_DLL
#include "internal.h"
-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 *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 *proc;
+ sqfs_data_writer_t *proc;
proc = alloc_flex(sizeof(*proc), 1, max_block_size);
if (proc == NULL)
return NULL;
- if (block_processor_init(proc, max_block_size, cmp, num_workers,
- max_backlog, devblksz, file)) {
- block_processor_cleanup(proc);
+ if (data_writer_init(proc, max_block_size, cmp, num_workers,
+ max_backlog, devblksz, file)) {
+ data_writer_cleanup(proc);
return NULL;
}
return proc;
}
-void sqfs_block_processor_destroy(sqfs_block_processor_t *proc)
+void sqfs_data_writer_destroy(sqfs_data_writer_t *proc)
{
- block_processor_cleanup(proc);
+ data_writer_cleanup(proc);
}
-int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
- sqfs_block_t *block)
+int sqfs_data_writer_enqueue(sqfs_data_writer_t *proc, sqfs_block_t *block)
{
sqfs_block_t *fragblk = NULL;
@@ -69,9 +68,8 @@ int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
block = fragblk;
}
- proc->status = block_processor_do_block(block, proc->cmp,
- proc->scratch,
- proc->max_block_size);
+ proc->status = data_writer_do_block(block, proc->cmp, proc->scratch,
+ proc->max_block_size);
if (proc->status == 0)
proc->status = process_completed_block(proc, block);
@@ -80,14 +78,14 @@ int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc,
return proc->status;
}
-int sqfs_block_processor_finish(sqfs_block_processor_t *proc)
+int sqfs_data_writer_finish(sqfs_data_writer_t *proc)
{
if (proc->status != 0 || proc->frag_block == NULL)
return proc->status;
- proc->status = block_processor_do_block(proc->frag_block, proc->cmp,
- proc->scratch,
- proc->max_block_size);
+ proc->status = data_writer_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);
diff --git a/lib/sqfs/io.c b/lib/sqfs/io.c
index eafa1cd..40bf5d8 100644
--- a/lib/sqfs/io.c
+++ b/lib/sqfs/io.c
@@ -9,7 +9,7 @@
#include "sqfs/io.h"
#include "sqfs/error.h"
-#include "sqfs/block_processor.h"
+#include "sqfs/data_writer.h"
#include "util.h"
#include <stdlib.h>
diff --git a/lib/sqfshelper/data_reader_dump.c b/lib/sqfshelper/data_reader_dump.c
index a6c7aa2..fa876c3 100644
--- a/lib/sqfshelper/data_reader_dump.c
+++ b/lib/sqfshelper/data_reader_dump.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "sqfs/block_processor.h"
+#include "sqfs/data_writer.h"
#include "sqfs/data_reader.h"
#include "highlevel.h"
#include "util.h"
diff --git a/lib/sqfshelper/data_writer.c b/lib/sqfshelper/data_writer.c
index 9f9631b..e2a8538 100644
--- a/lib/sqfshelper/data_writer.c
+++ b/lib/sqfshelper/data_writer.c
@@ -6,7 +6,7 @@
*/
#include "config.h"
-#include "sqfs/block_processor.h"
+#include "sqfs/data_writer.h"
#include "data_writer.h"
#include "highlevel.h"
#include "util.h"
@@ -19,7 +19,7 @@
#include <zlib.h>
struct data_writer_t {
- sqfs_block_processor_t *proc;
+ sqfs_data_writer_t *proc;
sqfs_compressor_t *cmp;
sqfs_super_t *super;
@@ -44,7 +44,7 @@ static int add_sentinel_block(data_writer_t *data, sqfs_inode_generic_t *inode,
blk->inode = inode;
blk->flags = flags;
- return sqfs_block_processor_enqueue(data->proc, blk);
+ return sqfs_data_writer_enqueue(data->proc, blk);
}
int write_data_from_file_condensed(data_writer_t *data, sqfs_file_t *file,
@@ -113,10 +113,10 @@ int write_data_from_file_condensed(data_writer_t *data, sqfs_file_t *file,
blk->flags |= SQFS_BLK_IS_FRAGMENT;
- if (sqfs_block_processor_enqueue(data->proc, blk))
+ if (sqfs_data_writer_enqueue(data->proc, blk))
return -1;
} else {
- if (sqfs_block_processor_enqueue(data->proc, blk))
+ if (sqfs_data_writer_enqueue(data->proc, blk))
return -1;
blk_flags &= ~SQFS_BLK_FIRST_BLOCK;
@@ -155,9 +155,9 @@ data_writer_t *data_writer_create(sqfs_super_t *super, sqfs_compressor_t *cmp,
return NULL;
}
- data->proc = sqfs_block_processor_create(super->block_size, cmp,
- num_jobs, max_backlog,
- devblksize, file);
+ data->proc = sqfs_data_writer_create(super->block_size, cmp,
+ num_jobs, max_backlog,
+ devblksize, file);
if (data->proc == NULL) {
perror("creating data block processor");
free(data);
@@ -171,14 +171,13 @@ data_writer_t *data_writer_create(sqfs_super_t *super, sqfs_compressor_t *cmp,
void data_writer_destroy(data_writer_t *data)
{
- sqfs_block_processor_destroy(data->proc);
+ sqfs_data_writer_destroy(data->proc);
free(data);
}
int data_writer_write_fragment_table(data_writer_t *data)
{
- if (sqfs_block_processor_write_fragment_table(data->proc,
- data->super)) {
+ if (sqfs_data_writer_write_fragment_table(data->proc, data->super)) {
fputs("error storing fragment table\n", stderr);
return -1;
}
@@ -187,7 +186,7 @@ int data_writer_write_fragment_table(data_writer_t *data)
int data_writer_sync(data_writer_t *data)
{
- return sqfs_block_processor_finish(data->proc);
+ return sqfs_data_writer_finish(data->proc);
}
data_writer_stats_t *data_writer_get_stats(data_writer_t *data)