meson: remove obsolete check for LOOP_CTL_GET_FREE

The LOOP_CTL_GET_FREE constant was introduced to Linux in

  commit 770fe30a46a12b6fb6b63fbe1737654d28e84844
  Author: Kay Sievers <kay.sievers@vrfy.org>
  Date:   Sun Jul 31 22:08:04 2011 +0200

    loop: add management interface for on-demand device allocation

This is old enough that all our supported platforms can be assumed
to have this feature. As a plus point, this meson check is going
to start failing with future GCC. It fails to set _GNU_SOURCE, thus
'unshare' is not defined by the header, and its relying on an
implicit function decl. For added fun this whole meson check was
semantically insane because LOOP_CTL_GET_FREE is not a valid arg
to unshare().

Fixes https://fedoraproject.org/wiki/Toolchain/PortingToModernC
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2022-12-08 09:03:23 +00:00
parent e48677e29f
commit cbd6cf45ae
2 changed files with 0 additions and 18 deletions

View File

@ -1541,19 +1541,6 @@ void main(void) {
elif get_option('driver_lxc').enabled() elif get_option('driver_lxc').enabled()
error('Required kernel features for LXC were not found') error('Required kernel features for LXC were not found')
endif endif
lxc_get_free_code = '''
#include <sched.h>
#include <linux/loop.h>
#include <sys/epoll.h>
void main(void) {
unshare(!(LOOP_CTL_GET_FREE));
}
'''
if cc.compiles(lxc_get_free_code)
conf.set('WITH_DECL_LOOP_CTL_GET_FREE', 1)
endif
elif get_option('driver_lxc').enabled() elif get_option('driver_lxc').enabled()
error('linux and remote_driver are required for LXC') error('linux and remote_driver are required for LXC')
endif endif

View File

@ -750,8 +750,6 @@ int virFileUpdatePerm(const char *path,
#if defined(__linux__) && WITH_DECL_LO_FLAGS_AUTOCLEAR #if defined(__linux__) && WITH_DECL_LO_FLAGS_AUTOCLEAR
# if WITH_DECL_LOOP_CTL_GET_FREE
/* virFileLoopDeviceOpenLoopCtl() returns -1 when a real failure has occurred /* virFileLoopDeviceOpenLoopCtl() returns -1 when a real failure has occurred
* while in the process of allocating or opening the loop device. On success * while in the process of allocating or opening the loop device. On success
* we return 0 and modify the fd to the appropriate file descriptor. * we return 0 and modify the fd to the appropriate file descriptor.
@ -795,7 +793,6 @@ static int virFileLoopDeviceOpenLoopCtl(char **dev_name, int *fd)
*dev_name = looppath; *dev_name = looppath;
return 0; return 0;
} }
# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
static int virFileLoopDeviceOpenSearch(char **dev_name) static int virFileLoopDeviceOpenSearch(char **dev_name)
{ {
@ -864,7 +861,6 @@ static int virFileLoopDeviceOpen(char **dev_name)
{ {
int loop_fd = -1; int loop_fd = -1;
# if WITH_DECL_LOOP_CTL_GET_FREE
if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0) if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0)
return -1; return -1;
@ -872,7 +868,6 @@ static int virFileLoopDeviceOpen(char **dev_name)
if (loop_fd >= 0) if (loop_fd >= 0)
return loop_fd; return loop_fd;
# endif /* WITH_DECL_LOOP_CTL_GET_FREE */
/* Without the loop control device we just use the old technique. */ /* Without the loop control device we just use the old technique. */
loop_fd = virFileLoopDeviceOpenSearch(dev_name); loop_fd = virFileLoopDeviceOpenSearch(dev_name);