1 From 388bab890a4e09b09d2428c0e773ed083295f91b Mon Sep 17 00:00:00 2001
2 From: Colin Watson <cjwatson@ubuntu.com>
3 Date: Thu, 29 Oct 2015 21:12:01 +0100
4 Subject: [PATCH] parted: fix build error on s390
6 The preceding dasd probing patches have introduced a compile error
7 when building with blkid support. Fixed by reordering function
10 Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
11 Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 Signed-off-by: Brian C. Lane <bcl@redhat.com>
14 libparted/arch/linux.c | 106 ++++++++++++++++++++++++-------------------------
15 1 file changed, 53 insertions(+), 53 deletions(-)
17 diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
18 index 9344ceb..1198f52 100644
19 --- a/libparted/arch/linux.c
20 +++ b/libparted/arch/linux.c
21 @@ -3184,59 +3184,6 @@ linux_disk_commit (PedDisk* disk)
25 -#if defined __s390__ || defined __s390x__
27 - * Check whether this device could be a DASD
29 - * The device probing yields PED_DEVICE_DASD for native DASD transport
30 - * If the block device uses a different transport (e.g. virtio)
31 - * a simplified heuristic (assuming a model 3390 with 4K sectors)
32 - * is applied (only) on s390x systems for this check.
34 - * \return 1 if the geometry indicates this could be a DASD
38 -_ped_device_like_dasd(const PedDevice *dev)
40 - return (dev->type == PED_DEVICE_DASD)
41 - || (dev->hw_geom.heads == 15
42 - && dev->hw_geom.sectors == 12
43 - && (dev->hw_geom.cylinders
44 - * dev->hw_geom.heads
45 - * dev->hw_geom.sectors
46 - * dev->phys_sector_size
47 - == dev->length * dev->sector_size));
53 -s390_get_minimum_alignment(const PedDevice *dev)
56 - return linux_get_minimum_alignment(dev);
58 - return ped_alignment_new(0,
59 - dev->phys_sector_size
60 - / dev->sector_size);
65 -s390_get_optimum_alignment(const PedDevice *dev)
67 - /* DASD needs to use minimum alignment */
68 - if (_ped_device_like_dasd(dev))
69 - return s390_get_minimum_alignment(dev);
71 - return linux_get_optimum_alignment(dev);
80 linux_get_minimum_alignment(const PedDevice *dev)
81 @@ -3293,6 +3240,59 @@ linux_get_optimum_alignment(const PedDevice *dev)
85 +#if defined __s390__ || defined __s390x__
87 + * Check whether this device could be a DASD
89 + * The device probing yields PED_DEVICE_DASD for native DASD transport
90 + * If the block device uses a different transport (e.g. virtio)
91 + * a simplified heuristic (assuming a model 3390 with 4K sectors)
92 + * is applied (only) on s390x systems for this check.
94 + * \return 1 if the geometry indicates this could be a DASD
98 +_ped_device_like_dasd(const PedDevice *dev)
100 + return (dev->type == PED_DEVICE_DASD)
101 + || (dev->hw_geom.heads == 15
102 + && dev->hw_geom.sectors == 12
103 + && (dev->hw_geom.cylinders
104 + * dev->hw_geom.heads
105 + * dev->hw_geom.sectors
106 + * dev->phys_sector_size
107 + == dev->length * dev->sector_size));
112 +static PedAlignment*
113 +s390_get_minimum_alignment(const PedDevice *dev)
116 + return linux_get_minimum_alignment(dev);
118 + return ped_alignment_new(0,
119 + dev->phys_sector_size
120 + / dev->sector_size);
124 +static PedAlignment*
125 +s390_get_optimum_alignment(const PedDevice *dev)
127 + /* DASD needs to use minimum alignment */
128 + if (_ped_device_like_dasd(dev))
129 + return s390_get_minimum_alignment(dev);
131 + return linux_get_optimum_alignment(dev);
138 static PedDeviceArchOps linux_dev_ops = {
140 destroy: linux_destroy,