On 2022/11/18 14:34, Lauri Kasanen wrote:
On Fri, 18 Nov 2022 09:01:58 +0800
Xiaoming Ni <[email protected]> wrote:
LOOP_CONFIGURE is added to Linux 5.8
...
diff --git a/libbb/loop.c b/libbb/loop.c
index 9a7ca666d..d4f4906b0 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -126,6 +126,30 @@ static int open_file(const char *file, unsigned flags, int
*mode)
return ffd;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
+static int set_loop_configure(int ffd, int lfd, bb_loop_info *loopinfo)
+#else
This assumes compile-time matches runtime. Ie, if you build on a 5.8
system, but run on an earlier kernel, the resulting busybox would be
unable to mount loops at all.
Please put it backward runtime compatibility, probably by having the
new-kernel code in the same func.
+ rc = ioctl(lfd, LOOP_CONFIGURE, &config);
+ if (rc == 0) {
+ return lfd;
+ }
+ if (rc == -1 && errno == EINVAL) /* The system may not support
RING_CONFIGURE. */
+ return set_loop_configure_old(ffd, lfd, loopinfo);
+ return -1;
Is this ok?
- Lauri
.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox