]> git.pld-linux.org Git - packages/parted.git/blob - 0023-parted-fix-build-error-on-s390.patch
- rel 4; tons of patches from FC
[packages/parted.git] / 0023-parted-fix-build-error-on-s390.patch
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
5
6 The preceding dasd probing patches have introduced a compile error
7 when building with blkid support. Fixed by reordering function
8 definitions.
9
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>
13 ---
14  libparted/arch/linux.c | 106 ++++++++++++++++++++++++-------------------------
15  1 file changed, 53 insertions(+), 53 deletions(-)
16
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)
22          return 1;
23  }
24  
25 -#if defined __s390__ || defined __s390x__
26 -/**
27 - * Check whether this device could be a DASD
28 - *
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.
33 - *
34 - * \return 1 if the geometry indicates this could be a DASD
35 - *         and 0 otherwise
36 - */
37 -static int
38 -_ped_device_like_dasd(const PedDevice *dev)
39 -{
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));
48 -}
49 -
50 -
51 -
52 -static PedAlignment*
53 -s390_get_minimum_alignment(const PedDevice *dev)
54 -{
55 -#if USE_BLKID
56 -        return linux_get_minimum_alignment(dev);
57 -#else
58 -        return ped_alignment_new(0,
59 -                                 dev->phys_sector_size
60 -                                 / dev->sector_size);
61 -#endif
62 -}
63 -
64 -static PedAlignment*
65 -s390_get_optimum_alignment(const PedDevice *dev)
66 -{
67 -        /* DASD needs to use minimum alignment */
68 -        if (_ped_device_like_dasd(dev))
69 -                return s390_get_minimum_alignment(dev);
70 -#if USE_BLKID
71 -        return linux_get_optimum_alignment(dev);
72 -#else
73 -        return NULL;
74 -#endif
75 -}
76 -#endif
77 -
78  #if USE_BLKID
79  static PedAlignment*
80  linux_get_minimum_alignment(const PedDevice *dev)
81 @@ -3293,6 +3240,59 @@ linux_get_optimum_alignment(const PedDevice *dev)
82  }
83  #endif
84  
85 +#if defined __s390__ || defined __s390x__
86 +/**
87 + * Check whether this device could be a DASD
88 + *
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.
93 + *
94 + * \return 1 if the geometry indicates this could be a DASD
95 + *         and 0 otherwise
96 + */
97 +static int
98 +_ped_device_like_dasd(const PedDevice *dev)
99 +{
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));
108 +}
109 +
110 +
111 +
112 +static PedAlignment*
113 +s390_get_minimum_alignment(const PedDevice *dev)
114 +{
115 +#if USE_BLKID
116 +        return linux_get_minimum_alignment(dev);
117 +#else
118 +        return ped_alignment_new(0,
119 +                                 dev->phys_sector_size
120 +                                 / dev->sector_size);
121 +#endif
122 +}
123 +
124 +static PedAlignment*
125 +s390_get_optimum_alignment(const PedDevice *dev)
126 +{
127 +        /* DASD needs to use minimum alignment */
128 +        if (_ped_device_like_dasd(dev))
129 +                return s390_get_minimum_alignment(dev);
130 +#if USE_BLKID
131 +        return linux_get_optimum_alignment(dev);
132 +#else
133 +        return NULL;
134 +#endif
135 +}
136 +#endif
137 +
138  static PedDeviceArchOps linux_dev_ops = {
139          _new:           linux_new,
140          destroy:        linux_destroy,
141 -- 
142 2.4.3
143
This page took 0.113013 seconds and 3 git commands to generate.