summaryrefslogtreecommitdiff
path: root/mkfs/mkfs.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-23 02:19:27 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-23 02:39:57 +0200
commit73dec828ad61d046d10648ddca5c89ce70352a7a (patch)
treef9c6ac79c1a97736d9c39a282f78dca4ef4ec04d /mkfs/mkfs.c
parent0b22d6ad0ebed2af239259dbfa36cd9920c6f4a2 (diff)
Move fstree default option processing to fstree code
Instead of decomposing a default string in gensquashfs option processing, move that to fstree_init instead and pass the option string directly to fstree_init. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs/mkfs.c')
-rw-r--r--mkfs/mkfs.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index 371c578..e72b669 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -117,11 +117,16 @@ int main(int argc, char **argv)
process_command_line(&opt, argc, argv);
- if (sqfs_super_init(&super, opt.blksz, opt.def_mtime, opt.compressor))
+ if (fstree_init(&fs, opt.blksz, opt.fs_defaults))
return EXIT_FAILURE;
+ if (sqfs_super_init(&super, opt.blksz, fs.defaults.st_mtime,
+ opt.compressor)) {
+ goto out_fstree;
+ }
+
if (id_table_init(&idtbl))
- return EXIT_FAILURE;
+ goto out_fstree;
outfd = open(opt.outfile, opt.outmode, 0644);
if (outfd < 0) {
@@ -132,25 +137,20 @@ int main(int argc, char **argv)
if (sqfs_super_write(&super, outfd))
goto out_outfd;
- if (fstree_init(&fs, opt.blksz, opt.def_mtime, opt.def_mode,
- opt.def_uid, opt.def_gid)) {
- goto out_outfd;
- }
-
if (read_fstree(&fs, &opt))
- goto out_fstree;
+ goto out_outfd;
tree_node_sort_recursive(fs.root);
if (fstree_gen_inode_table(&fs))
- goto out_fstree;
+ goto out_outfd;
super.inode_count = fs.inode_tbl_size - 2;
#ifdef WITH_SELINUX
if (opt.selinux != NULL) {
if (fstree_relabel_selinux(&fs, opt.selinux))
- goto out_fstree;
+ goto out_outfd;
}
#endif
@@ -202,11 +202,11 @@ out_data:
data_writer_destroy(data);
out_cmp:
cmp->destroy(cmp);
-out_fstree:
- fstree_cleanup(&fs);
out_outfd:
close(outfd);
out_idtbl:
id_table_cleanup(&idtbl);
+out_fstree:
+ fstree_cleanup(&fs);
return status;
}