File linux-user-drop-conditionals-for-obsolet.patch of Package qemu
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Tue, 4 Oct 2022 10:32:06 +0100
Subject: linux-user: drop conditionals for obsolete kernel header versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 0000000000000000000000000000000000000000
Refereces: bsc#1204001
Given our newly enforced 4.18 baseline for the kernel headers version,
we can drop any conditional checks for older versions.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
---
linux-user/linux_loop.h | 4 ----
linux-user/syscall.c | 14 ++------------
tests/tcg/i386/test-i386.c | 10 +++-------
3 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/linux-user/linux_loop.h b/linux-user/linux_loop.h
index f80b96f1ff92c71bc1232b733d37..5a9e0edef2729642bfca8f146e6d 100644
--- a/linux-user/linux_loop.h
+++ b/linux-user/linux_loop.h
@@ -31,10 +31,6 @@ enum {
#include <asm/posix_types.h> /* for __kernel_old_dev_t */
#include <asm/types.h> /* for __u64 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) /* This is a guess. */
-#define __kernel_old_dev_t __kernel_dev_t
-#endif
-
/* Backwards compatibility version */
struct loop_info {
int lo_number; /* ioctl r/o */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5acb463d5e11311b2108358c7c01..d7c0d4a45d3907f1ef28fe93f9b6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2525,16 +2525,12 @@ set_timeout:
case NETLINK_DROP_MEMBERSHIP:
case NETLINK_BROADCAST_ERROR:
case NETLINK_NO_ENOBUFS:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LISTEN_ALL_NSID:
case NETLINK_CAP_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
case NETLINK_EXT_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
case NETLINK_GET_STRICT_CHK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
break;
default:
goto unimplemented;
@@ -2903,16 +2899,12 @@ get_timeout:
case NETLINK_PKTINFO:
case NETLINK_BROADCAST_ERROR:
case NETLINK_NO_ENOBUFS:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LISTEN_ALL_NSID:
case NETLINK_CAP_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
case NETLINK_EXT_ACK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
case NETLINK_GET_STRICT_CHK:
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
if (get_user_u32(len, optlen)) {
return -TARGET_EFAULT;
}
@@ -2929,7 +2921,6 @@ get_timeout:
return -TARGET_EFAULT;
}
break;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
case NETLINK_LIST_MEMBERSHIPS:
{
uint32_t *results;
@@ -2960,7 +2951,6 @@ get_timeout:
unlock_user(results, optval_addr, 0);
break;
}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) */
default:
goto unimplemented;
}
diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c
index ac8d5a3c1f8b6eacf32649155c98..bd7ebb9d68b9e90673ed16a6f4cd 100644
--- a/tests/tcg/i386/test-i386.c
+++ b/tests/tcg/i386/test-i386.c
@@ -1231,10 +1231,6 @@ static inline int modify_ldt(int func, void * ptr, unsigned long bytecount)
return syscall(__NR_modify_ldt, func, ptr, bytecount);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 66)
-#define modify_ldt_ldt_s user_desc
-#endif
-
#define MK_SEL(n) (((n) << 3) | 7)
uint8_t seg_data1[4096];
@@ -1272,7 +1268,7 @@ uint8_t seg_data2[4096];
/* NOTE: we use Linux modify_ldt syscall */
void test_segs(void)
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
long long ldt_table[3];
int res, res2;
char tmp;
@@ -1374,7 +1370,7 @@ extern char code16_func3;
void test_code16(void)
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
int res, res2;
/* build a code segment */
@@ -1781,7 +1777,7 @@ void test_exceptions(void)
}
{
- struct modify_ldt_ldt_s ldt;
+ struct user_desc ldt;
ldt.entry_number = 1;
ldt.base_addr = (unsigned long)&seg_data1;
ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12;