summaryrefslogtreecommitdiff
path: root/mkfs/block.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-04 23:30:58 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-05 00:10:28 +0200
commitda5656a8a696863e0d9941091c09c75b03a6070b (patch)
tree175f713894fda83722be311e6b66bb957da11eaa /mkfs/block.c
parenta2750dee0e4c374ae51f83eead7eb7df3c018d95 (diff)
Print out what we are doing on the way and options to keep quiet
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs/block.c')
-rw-r--r--mkfs/block.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/mkfs/block.c b/mkfs/block.c
index 76b261d..545df53 100644
--- a/mkfs/block.c
+++ b/mkfs/block.c
@@ -175,18 +175,36 @@ fail_trunc:
goto fail;
}
-static int find_and_process_files(sqfs_info_t *info, tree_node_t *n)
+static void print_name(tree_node_t *n)
+{
+ if (n->parent != NULL) {
+ print_name(n->parent);
+ fputc('/', stdout);
+ }
+
+ fputs(n->name, stdout);
+}
+
+static int find_and_process_files(sqfs_info_t *info, tree_node_t *n,
+ bool quiet)
{
if (S_ISDIR(n->mode)) {
for (n = n->data.dir->children; n != NULL; n = n->next) {
- if (find_and_process_files(info, n))
+ if (find_and_process_files(info, n, quiet))
return -1;
}
return 0;
}
- if (S_ISREG(n->mode))
+ if (S_ISREG(n->mode)) {
+ if (!quiet) {
+ fputs("packing ", stdout);
+ print_name(n);
+ fputc('\n', stdout);
+ }
+
return process_file(info, n->data.file);
+ }
return 0;
}
@@ -218,7 +236,7 @@ int write_data_to_image(sqfs_info_t *info)
return -1;
}
- ret = find_and_process_files(info, info->fs.root);
+ ret = find_and_process_files(info, info->fs.root, info->opt.quiet);
free(info->block);
free(info->fragment);