From: Gao Xiang <hsiangkao@redhat.com>
To: linux-erofs@lists.ozlabs.org
Subject: [PATCH 3/4] mkfs: introduce erofs_mkfs_default_options()
Date: Fri, 30 Oct 2020 20:30:19 +0800 [thread overview]
Message-ID: <20201030123020.133084-3-hsiangkao@redhat.com> (raw)
In-Reply-To: <20201030123020.133084-1-hsiangkao@redhat.com>
Gather all default settings, and generate UUID before
parse_options_cfg(), therefore the UUID can be overridden
later by command line for reproducible images.
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
mkfs/main.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/mkfs/main.c b/mkfs/main.c
index 5c41fc0..0e17314 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -368,18 +368,18 @@ static int erofs_mkfs_superblock_csum_set(void)
return 0;
}
-static void erofs_mkfs_generate_uuid(void)
+static void erofs_mkfs_default_options(void)
{
- char uuid_str[37] = "not available";
+ cfg.c_legacy_compress = false;
+ sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_LZ4_0PADDING;
+ sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM;
+ /* generate a default uuid first */
#ifdef HAVE_LIBUUID
do {
uuid_generate(sbi.uuid);
} while (uuid_is_null(sbi.uuid));
-
- uuid_unparse_lower(sbi.uuid, uuid_str);
#endif
- erofs_info("filesystem UUID: %s", uuid_str);
}
/* https://reproducible-builds.org/specs/source-date-epoch/ for more details */
@@ -418,13 +418,12 @@ int main(int argc, char **argv)
struct stat64 st;
erofs_blk_t nblocks;
struct timeval t;
+ char uuid_str[37] = "not available";
erofs_init_configure();
fprintf(stderr, "%s %s\n", basename(argv[0]), cfg.c_version);
- cfg.c_legacy_compress = false;
- sbi.feature_incompat = EROFS_FEATURE_INCOMPAT_LZ4_0PADDING;
- sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM;
+ erofs_mkfs_default_options();
err = mkfs_parse_options_cfg(argc, argv);
if (err) {
@@ -495,7 +494,11 @@ int main(int argc, char **argv)
goto exit;
}
- erofs_mkfs_generate_uuid();
+#ifdef HAVE_LIBUUID
+ uuid_unparse_lower(sbi.uuid, uuid_str);
+#endif
+ erofs_info("filesystem UUID: %s", uuid_str);
+
erofs_inode_manager_init();
err = erofs_build_shared_xattrs_from_path(cfg.c_src_path);
--
2.18.1
next prev parent reply other threads:[~2020-10-30 12:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 12:30 [PATCH 1/4] erofs-utils: fix build error without lz4 library Gao Xiang
2020-10-30 12:30 ` [PATCH 2/4] erofs-utils: support $SOURCE_DATE_EPOCH Gao Xiang
2020-11-01 14:38 ` Li GuiFu via Linux-erofs
2020-10-30 12:30 ` Gao Xiang [this message]
2020-11-01 14:55 ` [PATCH 3/4] mkfs: introduce erofs_mkfs_default_options() Li GuiFu via Linux-erofs
2020-10-30 12:30 ` [PATCH 4/4] mkfs: add option to use a pre-defined UUID Gao Xiang
2020-11-01 14:55 ` Li GuiFu via Linux-erofs
2020-11-01 14:35 ` [PATCH 1/4] erofs-utils: fix build error without lz4 library Li GuiFu via Linux-erofs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201030123020.133084-3-hsiangkao@redhat.com \
--to=hsiangkao@redhat.com \
--cc=linux-erofs@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).