The LO_FLAGS_AUTOCLEAR constant was introduced to Linux in
commit 96c5865559cee0f9cbc5173f3c949f6ce3525581
Author: David Woodhouse <dwmw2(a)infradead.org>
Date: Wed Feb 6 01:36:27 2008 -0800
Allow auto-destruction of loop devices
This is old enough that all our supported platforms can be assumed
to have this feature. For added fun this whole meson check was
semantically insane because EPOLL_CLOEXEC is not a valid arg
to unshare().
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
meson.build | 3 +--
src/util/virfile.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index f313767cfe..212c3cfafb 100644
--- a/meson.build
+++ b/meson.build
@@ -1532,12 +1532,11 @@ if not get_option('driver_lxc').disabled() and
host_machine.system() == 'linux'
#include <sys/epoll.h>
void main(void) {
- unshare(!(LO_FLAGS_AUTOCLEAR));
+ unshare(1);
}
'''
if cc.compiles(lxc_support_code, name: 'lxc support', args:
'-D_GNU_SOURCE')
conf.set('WITH_LXC', 1)
- conf.set('WITH_DECL_LO_FLAGS_AUTOCLEAR', 1)
elif get_option('driver_lxc').enabled()
error('Required kernel features for LXC were not found')
endif
diff --git a/src/util/virfile.c b/src/util/virfile.c
index cef9f9979a..7b37d6888e 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -66,9 +66,7 @@
# include <linux/magic.h>
# endif
# include <sys/statfs.h>
-# if WITH_DECL_LO_FLAGS_AUTOCLEAR
-# include <linux/loop.h>
-# endif
+# include <linux/loop.h>
# include <sys/ioctl.h>
# include <linux/cdrom.h>
/* These come from linux/fs.h, but that header conflicts with
@@ -748,7 +746,7 @@ int virFileUpdatePerm(const char *path,
}
-#if defined(__linux__) && WITH_DECL_LO_FLAGS_AUTOCLEAR
+#if defined(__linux__)
/* virFileLoopDeviceOpenLoopCtl() returns -1 when a real failure has occurred
* while in the process of allocating or opening the loop device. On success
--
2.38.1