[PATCH v4 9/9] loop: Add LOOP_CONFIGURE ioctl
Denys Vlasenko
vda.linux at googlemail.com
Tue Dec 13 14:22:47 UTC 2022
> +config LOOP_CONFIGURE
> + bool "always uses LOOP_CONFIGURE, kernel version >= 5.8"
> +
> +config NO_LOOP_CONFIGURE
> + bool "never uses LOOP_CONFIGURE, kernel version < 5.8"
> +
> +config TRY_LOOP_CONFIGURE
> + bool "try LOOP_CONFIGURE, kernel version is unknown"
The descriptions need improvement.
> +static int set_loop_configure(int ffd, int lfd, const bb_loop_info *loopinfo)
> +{
> + int rc;
> + struct loop_config config;
> +
> + memset(&config, 0, sizeof(config));
> + config.fd = ffd;
> + memcpy(&config.info, loopinfo, sizeof(config.info));
This copying of the struct can be eliminated, a-la:
+#if ENABLE_TRY_LOOP_CONFIGURE || ENABLE_LOOP_CONFIGURE
+ struct loop_config lconfig;
+# define loopinfo lconfig.info
+#else
bb_loop_info loopinfo;
+#endif
I reworked and applied it. Please try current git.
More information about the busybox
mailing list