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

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