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

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