From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: oliver.yang@linux.alibaba.com, Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH] erofs-utils: mount: handle `-oloop` in the mount helper
Date: Tue, 3 Mar 2026 18:19:24 +0800 [thread overview]
Message-ID: <20260303101924.1541818-1-hsiangkao@linux.alibaba.com> (raw)
Generally, mount(8) does not pass the `-oloop` option to the mount
helper.
However, in case that users invoke `mount.erofs` directly, let's
handle this option here as well.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
mount/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mount/main.c b/mount/main.c
index dbee2ec..3ef4e9c 100644
--- a/mount/main.c
+++ b/mount/main.c
@@ -64,6 +64,7 @@ static struct erofsmount_cfg {
long flags;
enum erofs_backend_drv backend;
enum erofsmount_mode mountmode;
+ bool force_loopdev;
} mountcfg = {
.full_options = "ro",
.flags = MS_RDONLY, /* default mountflags */
@@ -225,7 +226,9 @@ static long erofsmount_parse_flagopts(char *s, long flags, char **more)
if (comma)
*comma = '\0';
- if (strncmp(s, "oci", 3) == 0) {
+ if (!strcmp(s, "loop")) {
+ mountcfg.force_loopdev = true;
+ } else if (strncmp(s, "oci", 3) == 0) {
/* Initialize ocicfg here iff != EROFSNBD_SOURCE_OCI */
if (nbdsrc.type != EROFSNBD_SOURCE_OCI) {
erofs_warn("EXPERIMENTAL OCI mount support in use, use at your own risk.");
@@ -1530,6 +1533,9 @@ int main(int argc, char *argv[])
goto exit;
}
+ if (mountcfg.force_loopdev)
+ goto loopmount;
+
err = mount(mountcfg.device, mountcfg.target, mountcfg.fstype,
mountcfg.flags, mountcfg.options);
if (err < 0)
@@ -1539,6 +1545,7 @@ int main(int argc, char *argv[])
err = erofsmount_fuse(mountcfg.device, mountcfg.target,
mountcfg.fstype, mountcfg.full_options);
else if (err == -ENOTBLK)
+loopmount:
err = erofsmount_loopmount(mountcfg.device, mountcfg.target,
mountcfg.fstype, mountcfg.flags,
mountcfg.options);
--
2.43.0
reply other threads:[~2026-03-03 10:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260303101924.1541818-1-hsiangkao@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=oliver.yang@linux.alibaba.com \
/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