On Fri, 18 Nov 2022 17:11:17 +0800
Xiaoming Ni <nixiaom...@huawei.com> wrote:

> >> +#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?

Probably, if it works (I don't remember what errno an invalid ioctl
returns). Also wrong comment (RING_CONFIGURE)

- Lauri
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to