[PATCH 9/9] loop: Add LOOP_CONFIGURE ioctl

Lauri Kasanen cand at gmx.com
Fri Nov 18 09:56:21 UTC 2022


On Fri, 18 Nov 2022 17:11:17 +0800
Xiaoming Ni <nixiaoming at 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


More information about the busybox mailing list