aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/data_writer.c8
-rw-r--r--lib/common/statistics.c15
-rw-r--r--lib/common/writer.c19
3 files changed, 22 insertions, 20 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);