aboutsummaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-26 14:33:55 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-26 15:32:38 +0200
commit248765bd9f6ead4fbe4e5822bcaf46b85fe1687f (patch)
tree1e487925a3bb4011ea1c355bce77413657e79b06 /mkfs
parent2341da0e0654aa8e89e5f3630f8142346788e061 (diff)
Remove remnants of the old data writer
- Move the statstics hooks to the rest of the statistics code - Used the new data writer directly in gensquashfs & tar2sqfs - Demote what is left to a helper function for processing an input file and submitting it to the new data writer Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/mkfs.c29
-rw-r--r--mkfs/mkfs.h1
2 files changed, 19 insertions, 11 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index acb3202..71e1863 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -28,7 +28,8 @@ static int restore_working_dir(options_t *opt)
return 0;
}
-static int pack_files(data_writer_t *data, fstree_t *fs, options_t *opt)
+static int pack_files(sqfs_data_writer_t *data, fstree_t *fs,
+ data_writer_stats_t *stats, options_t *opt)
{
sqfs_inode_generic_t *inode;
size_t max_blk_count;
@@ -72,14 +73,18 @@ static int pack_files(data_writer_t *data, fstree_t *fs, options_t *opt)
fi->user_ptr = inode;
- ret = write_data_from_file(data, inode, file, 0);
+ ret = write_data_from_file(data, inode, file,
+ fs->block_size, 0);
file->destroy(file);
if (ret)
return -1;
+
+ stats->file_count += 1;
+ stats->bytes_read += filesize;
}
- if (data_writer_sync(data))
+ if (sqfs_data_writer_finish(data))
return -1;
return restore_working_dir(opt);
@@ -118,10 +123,11 @@ int main(int argc, char **argv)
{
int status = EXIT_FAILURE, ret;
sqfs_compressor_config_t cfg;
+ data_writer_stats_t stats;
+ sqfs_data_writer_t *data;
sqfs_compressor_t *cmp;
sqfs_id_table_t *idtbl;
sqfs_file_t *outfile;
- data_writer_t *data;
sqfs_super_t super;
options_t opt;
fstree_t fs;
@@ -188,18 +194,21 @@ int main(int argc, char **argv)
if (ret > 0)
super.flags |= SQFS_FLAG_COMPRESSOR_OPTIONS;
- data = data_writer_create(&super, cmp, outfile,
- opt.devblksz, opt.num_jobs, opt.max_backlog);
+ data = sqfs_data_writer_create(super.block_size, cmp, opt.num_jobs,
+ opt.max_backlog, opt.devblksz, outfile);
if (data == NULL)
goto out_cmp;
- if (pack_files(data, &fs, &opt))
+ memset(&stats, 0, sizeof(stats));
+ register_stat_hooks(data, &stats);
+
+ if (pack_files(data, &fs, &stats, &opt))
goto out_data;
if (sqfs_serialize_fstree(outfile, &super, &fs, cmp, idtbl))
goto out_data;
- if (data_writer_write_fragment_table(data))
+ if (sqfs_data_writer_write_fragment_table(data, &super))
goto out_data;
if (opt.exportable) {
@@ -222,11 +231,11 @@ int main(int argc, char **argv)
goto out_data;
if (!opt.quiet)
- sqfs_print_statistics(&super, data_writer_get_stats(data));
+ sqfs_print_statistics(&super, &stats);
status = EXIT_SUCCESS;
out_data:
- data_writer_destroy(data);
+ sqfs_data_writer_destroy(data);
out_cmp:
cmp->destroy(cmp);
out_outfile:
diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h
index 9d34d02..bbe5572 100644
--- a/mkfs/mkfs.h
+++ b/mkfs/mkfs.h
@@ -15,7 +15,6 @@
#include "sqfs/data.h"
#include "sqfs/io.h"
-#include "data_writer.h"
#include "highlevel.h"
#include "fstree.h"
#include "util.h"