Fix building on big-endian architectures again

Resolves bz#1015494

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2013-10-10 09:46:06 +02:00
parent a73c68d519
commit b946c84e0b
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From f2d6b478f7e171fc23d364dde2d5e059909bcc71 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Thu, 10 Oct 2013 09:17:49 +0200
Subject: [PATCH 1/1] Be consistent in return types from byteswap macros
The bswap_*() macros return int values. Make sure we return the
equivalent types in same byteorder pass-through functions to avoid
problems with the original type leaking through to printf() etc.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
mdadm.h | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/mdadm.h b/mdadm.h
index c90fe10..cb207c9 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -129,12 +129,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#if !defined(__KLIBC__)
#if BYTE_ORDER == LITTLE_ENDIAN
-#define __cpu_to_le16(_x) (_x)
-#define __cpu_to_le32(_x) (_x)
-#define __cpu_to_le64(_x) (_x)
-#define __le16_to_cpu(_x) (_x)
-#define __le32_to_cpu(_x) (_x)
-#define __le64_to_cpu(_x) (_x)
+#define __cpu_to_le16(_x) (unsigned int)(_x)
+#define __cpu_to_le32(_x) (unsigned int)(_x)
+#define __cpu_to_le64(_x) (unsigned long long)(_x)
+#define __le16_to_cpu(_x) (unsigned int)(_x)
+#define __le32_to_cpu(_x) (unsigned int)(_x)
+#define __le64_to_cpu(_x) (unsigned long long)(_x)
#define __cpu_to_be16(_x) bswap_16(_x)
#define __cpu_to_be32(_x) bswap_32(_x)
@@ -150,12 +150,12 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
#define __le32_to_cpu(_x) bswap_32(_x)
#define __le64_to_cpu(_x) bswap_64(_x)
-#define __cpu_to_be16(_x) (_x)
-#define __cpu_to_be32(_x) (_x)
-#define __cpu_to_be64(_x) (_x)
-#define __be16_to_cpu(_x) (_x)
-#define __be32_to_cpu(_x) (_x)
-#define __be64_to_cpu(_x) (_x)
+#define __cpu_to_be16(_x) (unsigned int)(_x)
+#define __cpu_to_be32(_x) (unsigned int)(_x)
+#define __cpu_to_be64(_x) (unsigned long long)(_x)
+#define __be16_to_cpu(_x) (unsigned int)(_x)
+#define __be32_to_cpu(_x) (unsigned int)(_x)
+#define __be64_to_cpu(_x) (unsigned long long)(_x)
#else
# error "unknown endianness."
#endif
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: The mdadm program controls Linux md devices (software RAID arrays)
Name: mdadm
Version: 3.3
Release: 3%{?dist}
Release: 4%{?dist}
Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.xz
Source1: mdmonitor.init
Source2: raid-check
@ -11,6 +11,7 @@ Source5: mdadm-cron
Source6: mdmonitor.service
Source7: mdadm.conf
Source8: mdadm_event.conf
Patch1: mdadm-3.3-Be-consistent-in-return-types-from-byteswap-macros.patch
Patch93: mdadm-3.2.6-Remove-offroot-argument-and-default-to-always-settin.patch
Patch94: mdadm-3.2.6-Add-support-for-launching-mdmon-via-systemctl-instea.patch
Patch95: mdadm-3.2.6-In-case-launching-mdmon-fails-print-an-error-message.patch
@ -41,6 +42,7 @@ file can be used to help with some common tasks.
%prep
%setup -q
%patch1 -p1 -b .types
# Fedora customization patches
%patch97 -p1 -b .udev
%patch98 -p1 -b .static
@ -104,6 +106,11 @@ rm -rf %{buildroot}
/etc/libreport/events.d/*
%changelog
* Thu Oct 10 2013 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3-4
- Fix byteswap macros return types to allow for building on big endian
architectures again.
- Resolvez bz1015494
* Wed Oct 9 2013 Jes Sorensen <Jes.Sorensen@redhat.com> - 3.3-3
- Check for DM_UDEV_DISABLE_OTHER_RULES_FLAG instead of
DM_UDEV_DISABLE_DISK_RULES_FLAG in 65-md-incremental.rules