Blame SOURCES/0053-xlat-provide-fallback-definitions-for-UFFD_FEATURE_-.patch

86f512
From 769b79f04163b8467f4acf24963c82ad17180885 Mon Sep 17 00:00:00 2001
86f512
From: Eugene Syromyatnikov <evgsyr@gmail.com>
86f512
Date: Wed, 9 Oct 2019 20:06:15 +0200
86f512
Subject: [PATCH 53/76] xlat: provide fallback definitions for UFFD_FEATURE_*
86f512
 constants
86f512
86f512
* xlat/uffd_api_features.in: Add fallback definitions.
86f512
86f512
References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201
86f512
---
86f512
 xlat/uffd_api_features.in | 18 +++++++++---------
86f512
 1 file changed, 9 insertions(+), 9 deletions(-)
86f512
86f512
Index: strace-5.1/xlat/uffd_api_features.in
86f512
===================================================================
86f512
--- strace-5.1.orig/xlat/uffd_api_features.in	2017-09-17 14:04:11.000000000 +0200
86f512
+++ strace-5.1/xlat/uffd_api_features.in	2020-01-29 12:06:42.473425856 +0100
86f512
@@ -1,10 +1,10 @@
86f512
 #val_type uint64_t
86f512
-UFFD_FEATURE_PAGEFAULT_FLAG_WP
86f512
-UFFD_FEATURE_EVENT_FORK
86f512
-UFFD_FEATURE_EVENT_REMAP
86f512
-UFFD_FEATURE_EVENT_REMOVE
86f512
-UFFD_FEATURE_MISSING_HUGETLBFS
86f512
-UFFD_FEATURE_MISSING_SHMEM
86f512
-UFFD_FEATURE_EVENT_UNMAP
86f512
-UFFD_FEATURE_SIGBUS
86f512
-UFFD_FEATURE_THREAD_ID
86f512
+UFFD_FEATURE_PAGEFAULT_FLAG_WP	(1<<0)
86f512
+UFFD_FEATURE_EVENT_FORK		(1<<1)
86f512
+UFFD_FEATURE_EVENT_REMAP	(1<<2)
86f512
+UFFD_FEATURE_EVENT_REMOVE	(1<<3)
86f512
+UFFD_FEATURE_MISSING_HUGETLBFS	(1<<4)
86f512
+UFFD_FEATURE_MISSING_SHMEM	(1<<5)
86f512
+UFFD_FEATURE_EVENT_UNMAP	(1<<6)
86f512
+UFFD_FEATURE_SIGBUS		(1<<7)
86f512
+UFFD_FEATURE_THREAD_ID		(1<<8)
86f512
Index: strace-5.1/xlat/uffd_api_features.h
86f512
===================================================================
86f512
--- strace-5.1.orig/xlat/uffd_api_features.h	2019-05-22 15:08:31.000000000 +0200
86f512
+++ strace-5.1/xlat/uffd_api_features.h	2020-01-29 12:07:13.199158142 +0100
86f512
@@ -3,44 +3,89 @@
86f512
 #include "gcc_compat.h"
86f512
 #include "static_assert.h"
86f512
 
86f512
-
86f512
-#ifndef XLAT_MACROS_ONLY
86f512
-
86f512
-# ifdef IN_MPERS
86f512
-
86f512
-#  error static const struct xlat uffd_api_features in mpers mode
86f512
-
86f512
-# else
86f512
-
86f512
-static
86f512
-const struct xlat uffd_api_features[] = {
86f512
 #if defined(UFFD_FEATURE_PAGEFAULT_FLAG_WP) || (defined(HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP) && HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_PAGEFAULT_FLAG_WP) == ((1<<0)), "UFFD_FEATURE_PAGEFAULT_FLAG_WP != (1<<0)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_EVENT_FORK) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_FORK) && HAVE_DECL_UFFD_FEATURE_EVENT_FORK)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_EVENT_FORK) == ((1<<1)), "UFFD_FEATURE_EVENT_FORK != (1<<1)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_EVENT_FORK (1<<1)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_EVENT_REMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_REMAP)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_EVENT_REMAP) == ((1<<2)), "UFFD_FEATURE_EVENT_REMAP != (1<<2)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_EVENT_REMAP (1<<2)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_EVENT_REMOVE) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE) && HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_EVENT_REMOVE) == ((1<<3)), "UFFD_FEATURE_EVENT_REMOVE != (1<<3)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_EVENT_REMOVE (1<<3)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_MISSING_HUGETLBFS) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS) && HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_MISSING_HUGETLBFS) == ((1<<4)), "UFFD_FEATURE_MISSING_HUGETLBFS != (1<<4)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_MISSING_SHMEM) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM) && HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_MISSING_SHMEM) == ((1<<5)), "UFFD_FEATURE_MISSING_SHMEM != (1<<5)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_MISSING_SHMEM (1<<5)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_EVENT_UNMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_EVENT_UNMAP) == ((1<<6)), "UFFD_FEATURE_EVENT_UNMAP != (1<<6)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_EVENT_UNMAP (1<<6)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_SIGBUS) || (defined(HAVE_DECL_UFFD_FEATURE_SIGBUS) && HAVE_DECL_UFFD_FEATURE_SIGBUS)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_SIGBUS) == ((1<<7)), "UFFD_FEATURE_SIGBUS != (1<<7)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_SIGBUS (1<<7)
86f512
 #endif
86f512
 #if defined(UFFD_FEATURE_THREAD_ID) || (defined(HAVE_DECL_UFFD_FEATURE_THREAD_ID) && HAVE_DECL_UFFD_FEATURE_THREAD_ID)
86f512
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID),
86f512
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+static_assert((UFFD_FEATURE_THREAD_ID) == ((1<<8)), "UFFD_FEATURE_THREAD_ID != (1<<8)");
86f512
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
86f512
+#else
86f512
+# define UFFD_FEATURE_THREAD_ID (1<<8)
86f512
 #endif
86f512
+
86f512
+#ifndef XLAT_MACROS_ONLY
86f512
+
86f512
+# ifdef IN_MPERS
86f512
+
86f512
+#  error static const struct xlat uffd_api_features in mpers mode
86f512
+
86f512
+# else
86f512
+
86f512
+static
86f512
+const struct xlat uffd_api_features[] = {
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS),
86f512
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID),
86f512
  XLAT_END
86f512
 };
86f512