aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
blob: e8fcd98c640c86d7ec1d44685481e4df849545cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
Support older hosts with latest util-linux-native

mkostemp is not defined on older machines.  So we detect this and
provide a define that uses mkstemp instead.

O_CLOEXEC is not defined on older machines.  It is however defined
in the 'c.h' header.  Fix up the users to include 'c.h'.

fdisks/fdisksunlabel.c was modified to use qsort_r, however
this is not defined on older hosts.  Revert:
  commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
  fdisk: (sun): use ask API, remove global variable

Upstream-Status: Inappropriate [other]
Patches revert upstream changes in order to support older
machines.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>

diff -ur util-linux-2.23/configure.ac /home/lmhatle/util-linux-2.23-fixed/configure.ac
--- util-linux-2.23/configure.ac	2013-05-29 14:44:35.147853585 -0500
+++ /home/lmhatle/util-linux-2.23-fixed/configure.ac	2013-05-30 14:56:15.050799650 -0500
@@ -323,6 +323,7 @@
 	llseek \
 	lseek64 \
 	mempcpy \
+	mkostemp \
 	nanosleep \
 	personality \
 	posix_fadvise \
diff -ur util-linux-2.23/include/c.h /home/lmhatle/util-linux-2.23-fixed/include/c.h
--- util-linux-2.23/include/c.h	2013-04-12 04:25:46.852156874 -0500
+++ /home/lmhatle/util-linux-2.23-fixed/include/c.h	2013-05-30 14:56:11.310799488 -0500
@@ -236,6 +236,13 @@
 #endif
 
 /*
+ * mkostemp replacement
+ */
+#ifndef HAVE_MKOSTEMP
+#define mkostemp(template, flags) mkstemp(template)
+#endif
+
+/*
  * MAXHOSTNAMELEN replacement
  */
 static inline size_t get_hostname_max(void)
diff -ur util-linux-2.23/lib/randutils.c /home/lmhatle/util-linux-2.23-fixed/lib/randutils.c
--- util-linux-2.23/lib/randutils.c	2013-04-12 04:25:46.855156901 -0500
+++ /home/lmhatle/util-linux-2.23-fixed/lib/randutils.c	2013-05-30 14:55:26.622799644 -0500
@@ -16,6 +16,7 @@
 #include <sys/syscall.h>
 
 #include "randutils.h"
+#include "c.h"
 
 #ifdef HAVE_TLS
 #define THREAD_LOCAL static __thread
diff -ur util-linux-2.23/lib/wholedisk.c /home/lmhatle/util-linux-2.23-fixed/lib/wholedisk.c
--- util-linux-2.23/lib/wholedisk.c	2013-04-12 04:25:46.855156901 -0500
+++ /home/lmhatle/util-linux-2.23-fixed/lib/wholedisk.c	2013-05-30 14:55:31.182799350 -0500
@@ -10,6 +10,7 @@
 
 #include "blkdev.h"
 #include "wholedisk.h"
+#include "c.h"
 
 int is_whole_disk_fd(int fd, const char *name)
 {
diff -ur util-linux-2.23/fdisks/fdisksunlabel.c /home/lmhatle/util-linux-2.23-fixed/fdisks/fdisksunlabel.c
--- util-linux-2.23/fdisks/fdisksunlabel.c	2013-04-23 09:14:19.229015244 -0500
+++ /home/lmhatle/util-linux-2.23-fixed/fdisks/fdisksunlabel.c	2013-05-30 14:54:55.978799735 -0500
@@ -383,10 +383,10 @@
 	}
 }
 
-static int verify_sun_cmp(int *a, int *b, void *data)
-{
-    unsigned int *verify_sun_starts = (unsigned int *) data;
+static unsigned int *verify_sun_starts;
 
+static int verify_sun_cmp(int *a, int *b)
+{
     if (*a == -1)
 	    return 1;
     if (*b == -1)
@@ -401,7 +401,6 @@
     uint32_t starts[SUN_MAXPARTITIONS], lens[SUN_MAXPARTITIONS], start, stop;
     uint32_t i,j,k,starto,endo;
     int array[SUN_MAXPARTITIONS];
-    unsigned int *verify_sun_starts;
 
     assert(cxt);
     assert(cxt->label);
@@ -442,16 +441,14 @@
 	    }
 	}
     }
-
     for (i = 0; i < SUN_MAXPARTITIONS; i++) {
         if (lens[i])
             array[i] = i;
         else
             array[i] = -1;
     }
-    qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
-	  (int (*)(const void *,const void *,void *)) verify_sun_cmp,
-	  verify_sun_starts);
+    qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
+	  (int (*)(const void *,const void *)) verify_sun_cmp);
 
     if (array[0] == -1) {
 	fdisk_info(cxt, _("No partitions defined"));
@@ -468,6 +465,7 @@
     start = (starts[array[i]] + lens[array[i]]);
     if (start < stop)
         fdisk_warnx(cxt, _("Unused gap - sectors %d-%d"), start, stop);
+
     return 0;
 }
 
@@ -746,18 +744,12 @@
 	}
 }
 
-
 void fdisk_sun_set_alt_cyl(struct fdisk_context *cxt)
 {
 	struct sun_disklabel *sunlabel = self_disklabel(cxt);
-	uintmax_t res;
-	int rc = fdisk_ask_number(cxt, 0,			/* low */
-			be16_to_cpu(sunlabel->acyl),		/* default */
-			65535,					/* high */
-			_("Number of alternate cylinders"),	/* query */
-			&res);					/* result */
-	if (!rc)
-		sunlabel->acyl = cpu_to_be16(res);
+	sunlabel->acyl =
+		cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->acyl), 65535, 0,
+				_("Number of alternate cylinders")));
 }
 
 void fdisk_sun_set_ncyl(struct fdisk_context *cxt, int cyl)
@@ -769,54 +761,33 @@
 void fdisk_sun_set_xcyl(struct fdisk_context *cxt)
 {
 	struct sun_disklabel *sunlabel = self_disklabel(cxt);
-	uintmax_t res;
-	int rc = fdisk_ask_number(cxt, 0,			/* low */
-			be16_to_cpu(sunlabel->apc),		/* default */
-			cxt->geom.sectors,			/* high */
-			_("Extra sectors per cylinder"),	/* query */
-			&res);					/* result */
-	if (!rc)
-		sunlabel->apc = cpu_to_be16(res);
+	sunlabel->apc =
+		cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->apc), cxt->geom.sectors, 0,
+				_("Extra sectors per cylinder")));
 }
 
 void fdisk_sun_set_ilfact(struct fdisk_context *cxt)
 {
 	struct sun_disklabel *sunlabel = self_disklabel(cxt);
-	uintmax_t res;
-	int rc = fdisk_ask_number(cxt, 1,			/* low */
-			be16_to_cpu(sunlabel->intrlv),		/* default */
-			32,					/* high */
-			_("Interleave factor"),	/* query */
-			&res);					/* result */
-	if (!rc)
-		sunlabel->intrlv = cpu_to_be16(res);
+	sunlabel->intrlv =
+		cpu_to_be16(read_int(cxt, 1, be16_to_cpu(sunlabel->intrlv), 32, 0,
+				_("Interleave factor")));
 }
 
 void fdisk_sun_set_rspeed(struct fdisk_context *cxt)
 {
 	struct sun_disklabel *sunlabel = self_disklabel(cxt);
-	uintmax_t res;
-	int rc = fdisk_ask_number(cxt, 1,			/* low */
-			be16_to_cpu(sunlabel->rpm),		/* default */
-			USHRT_MAX,				/* high */
-			_("Rotation speed (rpm)"),		/* query */
-			&res);					/* result */
-	if (!rc)
-		sunlabel->rpm = cpu_to_be16(res);
-
+	sunlabel->rpm =
+		 cpu_to_be16(read_int(cxt, 1, be16_to_cpu(sunlabel->rpm), 100000, 0,
+				_("Rotation speed (rpm)")));
 }
 
 void fdisk_sun_set_pcylcount(struct fdisk_context *cxt)
 {
 	struct sun_disklabel *sunlabel = self_disklabel(cxt);
-	uintmax_t res;
-	int rc = fdisk_ask_number(cxt, 0,			/* low */
-			be16_to_cpu(sunlabel->pcyl),		/* default */
-			USHRT_MAX,				/* high */
-			_("Number of physical cylinders"),	/* query */
-			&res);					/* result */
-	if (!rc)
-		sunlabel->pcyl = cpu_to_be16(res);
+	sunlabel->pcyl =
+		cpu_to_be16(read_int(cxt, 0, be16_to_cpu(sunlabel->pcyl), 65535, 0,
+				_("Number of physical cylinders")));
 }
 
 static int sun_write_disklabel(struct fdisk_context *cxt)