summaryrefslogtreecommitdiff
path: root/src/basic/missing_loop.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-08-06 09:47:14 +0200
committerLennart Poettering <lennart@poettering.net>2020-08-11 15:24:18 +0200
commit86c1c1f34522b960724a6adda5425712bcfd95f7 (patch)
tree8391adadca46a2589d564cebf330741c7eac139e /src/basic/missing_loop.h
parent834c15ec383ba7cf4be9d064c080d49294f98901 (diff)
downloadsystemd-86c1c1f34522b960724a6adda5425712bcfd95f7.tar.gz
loop-util: use new LOOP_CONFIGURE ioctl
LOOP_CONFIGURE allows us to configure a loopback device in one ioctl instead of two, which is not just faster but also removes the race that udev might start probing the device before we adjusted things properly. Unfortunately LOOP_CONFIGURE is broken in regards to LO_FLAGS_PARTSCAN as of kernel 5.8.0. This patch contains a work-around for that, to fallback to old behaviour if partition scanning is requested but does not work. Sucks a bit. Proposed upstream fix for that issue: https://lkml.org/lkml/2020/8/6/97
Diffstat (limited to 'src/basic/missing_loop.h')
-rw-r--r--src/basic/missing_loop.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/missing_loop.h b/src/basic/missing_loop.h
new file mode 100644
index 0000000000..5326777419
--- /dev/null
+++ b/src/basic/missing_loop.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <linux/loop.h>
+
+#ifndef LOOP_CONFIGURE
+struct loop_config {
+ __u32 fd;
+ __u32 block_size;
+ struct loop_info64 info;
+ __u64 __reserved[8];
+};
+
+#define LOOP_CONFIGURE 0x4C0A
+#endif