Blame SOURCES/0053-parted-fix-build-error-on-s390.patch

fc4a62
From f0d72664c7c121bd4f4002356d8a9b75860418d4 Mon Sep 17 00:00:00 2001
fc4a62
From: Colin Watson <cjwatson@ubuntu.com>
fc4a62
Date: Thu, 29 Oct 2015 21:12:01 +0100
fc4a62
Subject: [PATCH 53/54] parted: fix build error on s390
fc4a62
fc4a62
The preceding dasd probing patches have introduced a compile error
fc4a62
when building with blkid support. Fixed by reordering function
fc4a62
definitions.
fc4a62
fc4a62
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
fc4a62
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
fc4a62
Signed-off-by: Brian C. Lane <bcl@redhat.com>
fc4a62
fc4a62
(cherry picked from commit 388bab890a4e09b09d2428c0e773ed083295f91b)
fc4a62
fc4a62
Related: rhbz#1676604
fc4a62
---
fc4a62
 libparted/arch/linux.c | 106 ++++++++++++++++++++---------------------
fc4a62
 1 file changed, 53 insertions(+), 53 deletions(-)
fc4a62
fc4a62
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
fc4a62
index 56cfe6f..cc40a1a 100644
fc4a62
--- a/libparted/arch/linux.c
fc4a62
+++ b/libparted/arch/linux.c
fc4a62
@@ -3129,59 +3129,6 @@ linux_disk_commit (PedDisk* disk)
fc4a62
         return 1;
fc4a62
 }
fc4a62
 
fc4a62
-#if defined __s390__ || defined __s390x__
fc4a62
-/**
fc4a62
- * Check whether this device could be a DASD
fc4a62
- *
fc4a62
- * The device probing yields PED_DEVICE_DASD for native DASD transport
fc4a62
- * If the block device uses a different transport (e.g. virtio)
fc4a62
- * a simplified heuristic (assuming a model 3390 with 4K sectors)
fc4a62
- * is applied (only) on s390x systems for this check.
fc4a62
- *
fc4a62
- * \return 1 if the geometry indicates this could be a DASD
fc4a62
- *         and 0 otherwise
fc4a62
- */
fc4a62
-static int
fc4a62
-_ped_device_like_dasd(const PedDevice *dev)
fc4a62
-{
fc4a62
-        return (dev->type == PED_DEVICE_DASD)
fc4a62
-          || (dev->hw_geom.heads == 15
fc4a62
-              && dev->hw_geom.sectors == 12
fc4a62
-              && (dev->hw_geom.cylinders
fc4a62
-                  * dev->hw_geom.heads
fc4a62
-                  * dev->hw_geom.sectors
fc4a62
-                  * dev->phys_sector_size
fc4a62
-                  == dev->length * dev->sector_size));
fc4a62
-}
fc4a62
-
fc4a62
-
fc4a62
-
fc4a62
-static PedAlignment*
fc4a62
-s390_get_minimum_alignment(const PedDevice *dev)
fc4a62
-{
fc4a62
-#if USE_BLKID
fc4a62
-        return linux_get_minimum_alignment(dev);
fc4a62
-#else
fc4a62
-        return ped_alignment_new(0,
fc4a62
-                                 dev->phys_sector_size
fc4a62
-                                 / dev->sector_size);
fc4a62
-#endif
fc4a62
-}
fc4a62
-
fc4a62
-static PedAlignment*
fc4a62
-s390_get_optimum_alignment(const PedDevice *dev)
fc4a62
-{
fc4a62
-        /* DASD needs to use minimum alignment */
fc4a62
-        if (_ped_device_like_dasd(dev))
fc4a62
-                return s390_get_minimum_alignment(dev);
fc4a62
-#if USE_BLKID
fc4a62
-        return linux_get_optimum_alignment(dev);
fc4a62
-#else
fc4a62
-        return NULL;
fc4a62
-#endif
fc4a62
-}
fc4a62
-#endif
fc4a62
-
fc4a62
 #if USE_BLKID
fc4a62
 static PedAlignment*
fc4a62
 linux_get_minimum_alignment(const PedDevice *dev)
fc4a62
@@ -3238,6 +3185,59 @@ linux_get_optimum_alignment(const PedDevice *dev)
fc4a62
 }
fc4a62
 #endif
fc4a62
 
fc4a62
+#if defined __s390__ || defined __s390x__
fc4a62
+/**
fc4a62
+ * Check whether this device could be a DASD
fc4a62
+ *
fc4a62
+ * The device probing yields PED_DEVICE_DASD for native DASD transport
fc4a62
+ * If the block device uses a different transport (e.g. virtio)
fc4a62
+ * a simplified heuristic (assuming a model 3390 with 4K sectors)
fc4a62
+ * is applied (only) on s390x systems for this check.
fc4a62
+ *
fc4a62
+ * \return 1 if the geometry indicates this could be a DASD
fc4a62
+ *         and 0 otherwise
fc4a62
+ */
fc4a62
+static int
fc4a62
+_ped_device_like_dasd(const PedDevice *dev)
fc4a62
+{
fc4a62
+        return (dev->type == PED_DEVICE_DASD)
fc4a62
+          || (dev->hw_geom.heads == 15
fc4a62
+              && dev->hw_geom.sectors == 12
fc4a62
+              && (dev->hw_geom.cylinders
fc4a62
+                  * dev->hw_geom.heads
fc4a62
+                  * dev->hw_geom.sectors
fc4a62
+                  * dev->phys_sector_size
fc4a62
+                  == dev->length * dev->sector_size));
fc4a62
+}
fc4a62
+
fc4a62
+
fc4a62
+
fc4a62
+static PedAlignment*
fc4a62
+s390_get_minimum_alignment(const PedDevice *dev)
fc4a62
+{
fc4a62
+#if USE_BLKID
fc4a62
+        return linux_get_minimum_alignment(dev);
fc4a62
+#else
fc4a62
+        return ped_alignment_new(0,
fc4a62
+                                 dev->phys_sector_size
fc4a62
+                                 / dev->sector_size);
fc4a62
+#endif
fc4a62
+}
fc4a62
+
fc4a62
+static PedAlignment*
fc4a62
+s390_get_optimum_alignment(const PedDevice *dev)
fc4a62
+{
fc4a62
+        /* DASD needs to use minimum alignment */
fc4a62
+        if (_ped_device_like_dasd(dev))
fc4a62
+                return s390_get_minimum_alignment(dev);
fc4a62
+#if USE_BLKID
fc4a62
+        return linux_get_optimum_alignment(dev);
fc4a62
+#else
fc4a62
+        return NULL;
fc4a62
+#endif
fc4a62
+}
fc4a62
+#endif
fc4a62
+
fc4a62
 static PedDeviceArchOps linux_dev_ops = {
fc4a62
         _new:           linux_new,
fc4a62
         destroy:        linux_destroy,
fc4a62
-- 
fc4a62
2.20.1
fc4a62