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

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