summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux/util-linux-native.patch')
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-native.patch210
1 files changed, 210 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
new file mode 100644
index 0000000000..e8fcd98c64
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
@@ -0,0 +1,210 @@
1Support older hosts with latest util-linux-native
2
3mkostemp is not defined on older machines. So we detect this and
4provide a define that uses mkstemp instead.
5
6O_CLOEXEC is not defined on older machines. It is however defined
7in the 'c.h' header. Fix up the users to include 'c.h'.
8
9fdisks/fdisksunlabel.c was modified to use qsort_r, however
10this is not defined on older hosts. Revert:
11 commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
12 fdisk: (sun): use ask API, remove global variable
13
14Upstream-Status: Inappropriate [other]
15Patches revert upstream changes in order to support older
16machines.
17
18Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
19
20diff -ur util-linux-2.23/configure.ac /home/lmhatle/util-linux-2.23-fixed/configure.ac
21--- util-linux-2.23/configure.ac 2013-05-29 14:44:35.147853585 -0500
22+++ /home/lmhatle/util-linux-2.23-fixed/configure.ac 2013-05-30 14:56:15.050799650 -0500
23@@ -323,6 +323,7 @@
24 llseek \
25 lseek64 \
26 mempcpy \
27+ mkostemp \
28 nanosleep \
29 personality \
30 posix_fadvise \
31diff -ur util-linux-2.23/include/c.h /home/lmhatle/util-linux-2.23-fixed/include/c.h
32--- util-linux-2.23/include/c.h 2013-04-12 04:25:46.852156874 -0500
33+++ /home/lmhatle/util-linux-2.23-fixed/include/c.h 2013-05-30 14:56:11.310799488 -0500
34@@ -236,6 +236,13 @@
35 #endif
36
37 /*
38+ * mkostemp replacement
39+ */
40+#ifndef HAVE_MKOSTEMP
41+#define mkostemp(template, flags) mkstemp(template)
42+#endif
43+
44+/*
45 * MAXHOSTNAMELEN replacement
46 */
47 static inline size_t get_hostname_max(void)
48diff -ur util-linux-2.23/lib/randutils.c /home/lmhatle/util-linux-2.23-fixed/lib/randutils.c
49--- util-linux-2.23/lib/randutils.c 2013-04-12 04:25:46.855156901 -0500
50+++ /home/lmhatle/util-linux-2.23-fixed/lib/randutils.c 2013-05-30 14:55:26.622799644 -0500
51@@ -16,6 +16,7 @@
52 #include <sys/syscall.h>
53
54 #include "randutils.h"
55+#include "c.h"
56
57 #ifdef HAVE_TLS
58 #define THREAD_LOCAL static __thread
59diff -ur util-linux-2.23/lib/wholedisk.c /home/lmhatle/util-linux-2.23-fixed/lib/wholedisk.c
60--- util-linux-2.23/lib/wholedisk.c 2013-04-12 04:25:46.855156901 -0500
61+++ /home/lmhatle/util-linux-2.23-fixed/lib/wholedisk.c 2013-05-30 14:55:31.182799350 -0500
62@@ -10,6 +10,7 @@
63
64 #include "blkdev.h"
65 #include "wholedisk.h"
66+#include "c.h"
67
68 int is_whole_disk_fd(int fd, const char *name)
69 {
70diff -ur util-linux-2.23/fdisks/fdisksunlabel.c /home/lmhatle/util-linux-2.23-fixed/fdisks/fdisksunlabel.c
71--- util-linux-2.23/fdisks/fdisksunlabel.c 2013-04-23 09:14:19.229015244 -0500
72+++ /home/lmhatle/util-linux-2.23-fixed/fdisks/fdisksunlabel.c 2013-05-30 14:54:55.978799735 -0500
73@@ -383,10 +383,10 @@
74 }
75 }
76
77-static int verify_sun_cmp(int *a, int *b, void *data)
78-{
79- unsigned int *verify_sun_starts = (unsigned int *) data;
80+static unsigned int *verify_sun_starts;
81
82+static int verify_sun_cmp(int *a, int *b)
83+{
84 if (*a == -1)
85 return 1;
86 if (*b == -1)
87@@ -401,7 +401,6 @@
88 uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop;
89 uint32_t i,j,k,starto,endo;
90 int array[SUN_MAXPARTITIONS];
91- unsigned int *verify_sun_starts;
92
93 assert(cxt);
94 assert(cxt->label);
95@@ -442,16 +441,14 @@
96 }
97 }
98 }
99-
100 for (i = 0; i < SUN_MAXPARTITIONS; i++) {
101 if (lens[i])
102 array[i] = i;
103 else
104 array[i] = -1;
105 }
106- qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
107- (int (*)(const void *,const void *,void *)) verify_sun_cmp,
108- verify_sun_starts);
109+ qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
110+ (int (*)(const void *,const void *)) verify_sun_cmp);
111
112 if (array[0] == -1) {
113 fdisk_info(cxt, _("No partitions defined"));
114@@ -468,6 +465,7 @@
115 start = (starts[array[i]] + lens[array[i]]);
116 if (start < stop)
117 fdisk_warnx(cxt, _("Unused gap - sectors %d-%d"), start, stop);
118+
119 return 0;
120 }
121
122@@ -746,18 +744,12 @@
123 }
124 }
125
126-
127 void fdisk_sun_set_alt_cyl(struct fdisk_context *cxt)
128 {
129 struct sun_disklabel *sunlabel = self_disklabel(cxt);
130- uintmax_t res;
131- int rc = fdisk_ask_number(cxt, 0, /* low */
132- be16_to_cpu(sunlabel->acyl), /* default */
133- 65535, /* high */
134- _("Number of alternate cylinders"), /* query */
135- &res); /* result */
136- if (!rc)
137- sunlabel->acyl = cpu_to_be16(res);
138+ sunlabel->acyl =
139+ cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->acyl), 65535, 0,
140+ _("Number of alternate cylinders")));
141 }
142
143 void fdisk_sun_set_ncyl(struct fdisk_context *cxt, int cyl)
144@@ -769,54 +761,33 @@
145 void fdisk_sun_set_xcyl(struct fdisk_context *cxt)
146 {
147 struct sun_disklabel *sunlabel = self_disklabel(cxt);
148- uintmax_t res;
149- int rc = fdisk_ask_number(cxt, 0, /* low */
150- be16_to_cpu(sunlabel->apc), /* default */
151- cxt->geom.sectors, /* high */
152- _("Extra sectors per cylinder"), /* query */
153- &res); /* result */
154- if (!rc)
155- sunlabel->apc = cpu_to_be16(res);
156+ sunlabel->apc =
157+ cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->apc), cxt->geom.sectors, 0,
158+ _("Extra sectors per cylinder")));
159 }
160
161 void fdisk_sun_set_ilfact(struct fdisk_context *cxt)
162 {
163 struct sun_disklabel *sunlabel = self_disklabel(cxt);
164- uintmax_t res;
165- int rc = fdisk_ask_number(cxt, 1, /* low */
166- be16_to_cpu(sunlabel->intrlv), /* default */
167- 32, /* high */
168- _("Interleave factor"), /* query */
169- &res); /* result */
170- if (!rc)
171- sunlabel->intrlv = cpu_to_be16(res);
172+ sunlabel->intrlv =
173+ cpu_to_be16(read_int(cxt, 1, be16_to_cpu(sunlabel->intrlv), 32, 0,
174+ _("Interleave factor")));
175 }
176
177 void fdisk_sun_set_rspeed(struct fdisk_context *cxt)
178 {
179 struct sun_disklabel *sunlabel = self_disklabel(cxt);
180- uintmax_t res;
181- int rc = fdisk_ask_number(cxt, 1, /* low */
182- be16_to_cpu(sunlabel->rpm), /* default */
183- USHRT_MAX, /* high */
184- _("Rotation speed (rpm)"), /* query */
185- &res); /* result */
186- if (!rc)
187- sunlabel->rpm = cpu_to_be16(res);
188-
189+ sunlabel->rpm =
190+ cpu_to_be16(read_int(cxt, 1, be16_to_cpu(sunlabel->rpm), 100000, 0,
191+ _("Rotation speed (rpm)")));
192 }
193
194 void fdisk_sun_set_pcylcount(struct fdisk_context *cxt)
195 {
196 struct sun_disklabel *sunlabel = self_disklabel(cxt);
197- uintmax_t res;
198- int rc = fdisk_ask_number(cxt, 0, /* low */
199- be16_to_cpu(sunlabel->pcyl), /* default */
200- USHRT_MAX, /* high */
201- _("Number of physical cylinders"), /* query */
202- &res); /* result */
203- if (!rc)
204- sunlabel->pcyl = cpu_to_be16(res);
205+ sunlabel->pcyl =
206+ cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->pcyl), 65535, 0,
207+ _("Number of physical cylinders")));
208 }
209
210 static int sun_write_disklabel(struct fdisk_context *cxt)