From 73dec828ad61d046d10648ddca5c89ce70352a7a Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 23 Jun 2019 02:19:27 +0200 Subject: 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 --- mkfs/mkfs.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'mkfs/mkfs.c') 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; } -- cgit v1.2.3