From: Wenyuan Xu <sereno.xu@deepseek.com>
To: xiang@kernel.org, linux-erofs@lists.ozlabs.org
Cc: sereno.xu@deepseek.com
Subject: [RFC 1/7] erofs-utils: mkfs: init root inode in local source mode
Date: Wed, 4 Nov 2026 04:07:19 +0000 [thread overview]
Message-ID: <20261104040725.2473313-2-sereno.xu@deepseek.com> (raw)
In-Reply-To: <20261104040725.2473313-1-sereno.xu@deepseek.com>
Signed-off-by: Wenyuan Xu <sereno.xu@deepseek.com>
---
include/erofs/inode.h | 2 ++
lib/inode.c | 30 ++++--------------------------
mkfs/main.c | 8 +++++++-
3 files changed, 13 insertions(+), 27 deletions(-)
diff --git a/include/erofs/inode.h b/include/erofs/inode.h
index 5b67b95..88c413b 100644
--- a/include/erofs/inode.h
+++ b/include/erofs/inode.h
@@ -42,6 +42,8 @@ int erofs_allocate_inode_bh_data(struct erofs_inode *inode, erofs_blk_t nblocks,
bool erofs_dentry_is_wht(struct erofs_sb_info *sbi, struct erofs_dentry *d);
int __erofs_fill_inode(struct erofs_importer *im, struct erofs_inode *inode,
struct stat *st, const char *path);
+int erofs_fill_inode(struct erofs_importer *im, struct erofs_inode *inode,
+ struct stat *st, const char *path);
struct erofs_inode *erofs_new_inode(struct erofs_sb_info *sbi);
int erofs_importer_load_tree(struct erofs_importer *im, bool rebuild,
bool incremental);
diff --git a/lib/inode.c b/lib/inode.c
index da29b5a..2a3d022 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -1334,7 +1334,7 @@ int __erofs_fill_inode(struct erofs_importer *im, struct erofs_inode *inode,
return 0;
}
-static int erofs_fill_inode(struct erofs_importer *im, struct erofs_inode *inode,
+int erofs_fill_inode(struct erofs_importer *im, struct erofs_inode *inode,
struct stat *st, const char *path)
{
const struct erofs_importer_params *params = im->params;
@@ -2251,30 +2251,6 @@ struct erofs_mkfs_buildtree_ctx {
struct erofs_importer *im;
bool rebuild, incremental;
};
-#ifndef EROFS_MT_ENABLED
-#define __erofs_mkfs_build_tree erofs_mkfs_build_tree
-#endif
-
-static int __erofs_mkfs_build_tree(const struct erofs_mkfs_btctx *ctx)
-{
- struct erofs_importer *im = ctx->im;
-
- if (!ctx->rebuild) {
- struct erofs_importer_params *params = im->params;
- struct stat st;
- int err;
-
- err = lstat(params->source, &st);
- if (err)
- return -errno;
-
- err = erofs_fill_inode(im, im->root, &st, params->source);
- if (err)
- return err;
- }
- return erofs_mkfs_dump_tree(ctx);
-}
-
#ifdef EROFS_MT_ENABLED
#ifdef HAVE_SYS_RESOURCE_H
@@ -2339,7 +2315,7 @@ static int erofs_mkfs_build_tree(struct erofs_mkfs_btctx *ctx)
if (err)
goto fail;
- err = __erofs_mkfs_build_tree(ctx);
+ err = erofs_mkfs_dump_tree(ctx);
erofs_mkfs_go(ctx, ~0, NULL, 0);
err2 = pthread_join(sbi->dfops_worker, &retval);
DBG_BUGON(!q->exited);
@@ -2358,6 +2334,8 @@ fail:
free(q);
return err;
}
+#else
+#define erofs_mkfs_build_tree erofs_mkfs_dump_tree
#endif
int erofs_importer_load_tree(struct erofs_importer *im, bool rebuild,
diff --git a/mkfs/main.c b/mkfs/main.c
index 93123c1..d8706d7 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1987,7 +1987,13 @@ int main(int argc, char **argv)
}
importer.root = root;
- if (source_mode == EROFS_MKFS_SOURCE_TAR) {
+ if (source_mode == EROFS_MKFS_SOURCE_LOCALDIR) {
+ struct stat st;
+
+ err = lstat(cfg.c_src_path, &st);
+ if (!err)
+ err = erofs_fill_inode(&importer, importer.root, &st, cfg.c_src_path);
+ } else if (source_mode == EROFS_MKFS_SOURCE_TAR) {
while (!(err = tarerofs_parse_tar(&importer, &erofstar)))
;
} else if (source_mode == EROFS_MKFS_SOURCE_REBUILD) {
--
2.43.0
next prev parent reply other threads:[~2026-11-04 4:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 4:07 [RFC 0/7] erofs-utils: add manifest input support Wenyuan Xu
2026-11-04 4:07 ` Wenyuan Xu [this message]
2026-11-04 4:07 ` [RFC 2/7] erofs-utils: lib: add erofs_inode_has_xattr helper Wenyuan Xu
2026-11-04 4:07 ` [RFC 3/7] erofs-utils: lib: add erofs_build_shared_xattrs() helper Wenyuan Xu
2026-11-04 4:07 ` [RFC 4/7] erofs-utils: mkfs: add manifest input mode Wenyuan Xu
2026-11-04 4:07 ` [RFC 5/7] erofs-utils: mkfs: support two-field manifest records Wenyuan Xu
2026-11-04 4:07 ` [RFC 6/7] erofs-utils: man: document manifest input formats Wenyuan Xu
2026-11-04 4:07 ` [RFC 7/7] erofs-utils: tests: cover manifest input Wenyuan Xu
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=20261104040725.2473313-2-sereno.xu@deepseek.com \
--to=sereno.xu@deepseek.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=xiang@kernel.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