loop: optionally use ioctl(LOOP_CONFIGURE) to set up loopdevs

LOOP_CONFIGURE is added to Linux 5.8

function                                             old     new   delta
NO_LOOP_CONFIGURE (old code):
set_loop                                             784     782      -2
LOOP_CONFIGURE:
set_loop                                             784     653    -131
TRY_LOOP_CONFIGURE:
set_loop                                             784     811     +27

Based on a patch by Xiaoming Ni <nixiaoming@huawei.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/libbb/Config.src b/libbb/Config.src
index 66a3ffa..b980f19 100644
--- a/libbb/Config.src
+++ b/libbb/Config.src
@@ -369,3 +369,25 @@
 	For example, this means that entering 'l', 's', ' ', 0xff, [Enter]
 	at shell prompt will list file named 0xff (single char name
 	with char value 255), not file named '?'.
+
+choice
+	prompt "Use LOOP_CONFIGURE for losetup and loop mounts"
+	default TRY_LOOP_CONFIGURE
+	help
+	LOOP_CONFIGURE is added to Linux 5.8
+	https://lwn.net/Articles/820408/
+	This allows userspace to completely setup a loop device with a single
+	ioctl, removing the in-between state where the device can be partially
+	configured - eg the loop device has a backing file associated with it,
+	but is reading from the wrong offset.
+
+config LOOP_CONFIGURE
+	bool "use LOOP_CONFIGURE, needs kernel >= 5.8"
+
+config NO_LOOP_CONFIGURE
+	bool "use LOOP_SET_FD + LOOP_SET_STATUS"
+
+config TRY_LOOP_CONFIGURE
+	bool "try LOOP_CONFIGURE, fall back to LOOP_SET_FD + LOOP_SET_STATUS"
+
+endchoice