Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-fs/multipath-tools/files: multipath-tools-0.4.8-udev-scsi_id-changes.patch multipath-tools-0.4.8-r1-kpartx.patch init.d-multipath-0.4.8-r1
Date: Fri, 30 Oct 2009 06:50:15
Message-Id: E1N3lJM-00079M-0K@stork.gentoo.org
1 robbat2 09/10/30 06:50:12
2
3 Added: multipath-tools-0.4.8-udev-scsi_id-changes.patch
4 multipath-tools-0.4.8-r1-kpartx.patch
5 init.d-multipath-0.4.8-r1
6 Log:
7 Upstream is a slacker and has not made a release in 2+ years despite being active in Git. Fixes bug #235836: udev scsi_id lost the -s option a long time ago. Bug #245615: remove the 1TiB limit on kpartx.
8 (Portage version: 2.2_rc46/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 sys-fs/multipath-tools/files/multipath-tools-0.4.8-udev-scsi_id-changes.patch
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/multipath-tools-0.4.8-udev-scsi_id-changes.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/multipath-tools-0.4.8-udev-scsi_id-changes.patch?rev=1.1&content-type=text/plain
15
16 Index: multipath-tools-0.4.8-udev-scsi_id-changes.patch
17 ===================================================================
18 diff -Nuar multipath-tools-0.4.8.orig/libmultipath/defaults.h multipath-tools-0.4.8/libmultipath/defaults.h
19 --- multipath-tools-0.4.8.orig/libmultipath/defaults.h 2007-08-02 21:05:37.000000000 +0000
20 +++ multipath-tools-0.4.8/libmultipath/defaults.h 2009-10-30 06:00:21.432553430 +0000
21 @@ -1,4 +1,4 @@
22 -#define DEFAULT_GETUID "/lib/udev/scsi_id -g -u -s /block/%n"
23 +#define DEFAULT_GETUID "/lib/udev/scsi_id -g -u -d /dev/%n"
24 #define DEFAULT_UDEVDIR "/dev"
25 #define DEFAULT_SELECTOR "round-robin 0"
26 #define DEFAULT_FEATURES "0"
27 diff -Nuar multipath-tools-0.4.8.orig/libmultipath/hwtable.c multipath-tools-0.4.8/libmultipath/hwtable.c
28 --- multipath-tools-0.4.8.orig/libmultipath/hwtable.c 2007-08-02 21:05:37.000000000 +0000
29 +++ multipath-tools-0.4.8/libmultipath/hwtable.c 2009-10-30 06:00:08.087158020 +0000
30 @@ -157,7 +157,7 @@
31 /* HP Smart Array */
32 .vendor = "HP",
33 .product = "LOGICAL VOLUME.*",
34 - .getuid = "/lib/udev/scsi_id -n -g -u -s /block/%n",
35 + .getuid = "/lib/udev/scsi_id -n -g -u -d /dev/%n",
36 .getprio = NULL,
37 .features = DEFAULT_FEATURES,
38 .hwhandler = DEFAULT_HWHANDLER,
39 @@ -199,7 +199,7 @@
40 {
41 .vendor = "EMC",
42 .product = "SYMMETRIX",
43 - .getuid = "/lib/udev/scsi_id -g -u -ppre-spc3-83 -s /block/%n",
44 + .getuid = "/lib/udev/scsi_id -g -u -ppre-spc3-83 -d /dev/%n",
45 .getprio = NULL,
46 .features = DEFAULT_FEATURES,
47 .hwhandler = DEFAULT_HWHANDLER,
48 diff -Nuar multipath-tools-0.4.8.orig/multipath/multipath.conf.5 multipath-tools-0.4.8/multipath/multipath.conf.5
49 --- multipath-tools-0.4.8.orig/multipath/multipath.conf.5 2007-08-02 21:05:37.000000000 +0000
50 +++ multipath-tools-0.4.8/multipath/multipath.conf.5 2009-10-30 05:59:19.272559733 +0000
51 @@ -109,7 +109,7 @@
52 The default program and args to callout to obtain a unique path
53 identifier. Should be specified with an absolute path. Default value
54 is
55 -.I /lib/udev/scsi_id -g -u -s
56 +.I /lib/udev/scsi_id -g -u -d
57 .TP
58 .B prio_callout
59 The default program and args to callout to obtain a path priority
60 diff -Nuar multipath-tools-0.4.8.orig/multipath.conf.annotated multipath-tools-0.4.8/multipath.conf.annotated
61 --- multipath-tools-0.4.8.orig/multipath.conf.annotated 2007-08-02 21:05:37.000000000 +0000
62 +++ multipath-tools-0.4.8/multipath.conf.annotated 2009-10-30 05:59:53.002576683 +0000
63 @@ -47,9 +47,9 @@
64 # # scope : multipath
65 # # desc : the default program and args to callout to obtain a unique
66 # # path identifier. Absolute path required
67 -# # default : /lib/udev/scsi_id -g -u -s
68 +# # default : /lib/udev/scsi_id -g -u -d
69 # #
70 -# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
71 +# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
72 #
73 # #
74 # # name : prio_callout
75 @@ -291,9 +291,9 @@
76 # # scope : multipath
77 # # desc : the program and args to callout to obtain a unique
78 # # path identifier. Absolute path required
79 -# # default : /lib/udev/scsi_id -g -u -s
80 +# # default : /lib/udev/scsi_id -g -u -d
81 # #
82 -# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
83 +# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
84 #
85 # #
86 # # name : prio_callout
87 diff -Nuar multipath-tools-0.4.8.orig/multipath.conf.synthetic multipath-tools-0.4.8/multipath.conf.synthetic
88 --- multipath-tools-0.4.8.orig/multipath.conf.synthetic 2007-08-02 21:05:37.000000000 +0000
89 +++ multipath-tools-0.4.8/multipath.conf.synthetic 2009-10-30 05:59:38.569224508 +0000
90 @@ -7,7 +7,7 @@
91 # polling_interval 10
92 # selector "round-robin 0"
93 # path_grouping_policy multibus
94 -# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
95 +# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
96 # prio_callout /bin/true
97 # path_checker directio
98 # rr_min_io 100
99 @@ -52,7 +52,7 @@
100 # vendor "COMPAQ "
101 # product "HSV110 (C)COMPAQ"
102 # path_grouping_policy multibus
103 -# getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n"
104 +# getuid_callout "/lib/udev/scsi_id -g -u -d /dev/%n"
105 # path_checker directio
106 # path_selector "round-robin 0"
107 # hardware_handler "0"
108
109
110
111 1.1 sys-fs/multipath-tools/files/multipath-tools-0.4.8-r1-kpartx.patch
112
113 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/multipath-tools-0.4.8-r1-kpartx.patch?rev=1.1&view=markup
114 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/multipath-tools-0.4.8-r1-kpartx.patch?rev=1.1&content-type=text/plain
115
116 Index: multipath-tools-0.4.8-r1-kpartx.patch
117 ===================================================================
118 diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
119 index 3e973aa..893d6dd 100644
120 --- a/kpartx/devmapper.c
121 +++ b/kpartx/devmapper.c
122 @@ -4,10 +4,12 @@
123 #include <stdio.h>
124 #include <stdlib.h>
125 #include <string.h>
126 +#include <stdint.h>
127 #include <libdevmapper.h>
128 #include <ctype.h>
129 #include <linux/kdev_t.h>
130 #include <errno.h>
131 +#include "devmapper.h"
132
133 #define UUID_PREFIX "part%d-"
134 #define MAX_PREFIX_LEN 8
135 @@ -72,7 +74,7 @@ dm_simplecmd (int task, const char *name) {
136
137 extern int
138 dm_addmap (int task, const char *name, const char *target,
139 - const char *params, unsigned long size, const char *uuid, int part) {
140 + const char *params, uint64_t size, const char *uuid, int part) {
141 int r = 0;
142 struct dm_task *dmt;
143 char *prefixed_uuid = NULL;
144 diff --git a/kpartx/devmapper.h b/kpartx/devmapper.h
145 index ccdbead..2bd27d2 100644
146 --- a/kpartx/devmapper.h
147 +++ b/kpartx/devmapper.h
148 @@ -1,7 +1,7 @@
149 int dm_prereq (char *, int, int, int);
150 int dm_simplecmd (int, const char *);
151 -int dm_addmap (int, const char *, const char *, const char *, unsigned long,
152 - char *, int);
153 +int dm_addmap (int, const char *, const char *, const char *, uint64_t,
154 + const char *, int);
155 int dm_map_present (char *);
156 char * dm_mapname(int major, int minor);
157 dev_t dm_get_first_dep(char *devname);
158 diff --git a/kpartx/gpt.c b/kpartx/gpt.c
159 index dc846ca..047a829 100644
160 --- a/kpartx/gpt.c
161 +++ b/kpartx/gpt.c
162 @@ -36,6 +36,7 @@
163 #include <errno.h>
164 #include <endian.h>
165 #include <byteswap.h>
166 +#include <linux/fs.h>
167 #include "crc32.h"
168
169 #if BYTE_ORDER == LITTLE_ENDIAN
170 @@ -50,10 +51,18 @@
171 # define __cpu_to_le32(x) bswap_32(x)
172 #endif
173
174 +#ifndef BLKGETLASTSECT
175 #define BLKGETLASTSECT _IO(0x12,108) /* get last sector of block device */
176 +#endif
177 +#ifndef BLKGETSIZE
178 #define BLKGETSIZE _IO(0x12,96) /* return device size */
179 +#endif
180 +#ifndef BLKSSZGET
181 #define BLKSSZGET _IO(0x12,104) /* get block device sector size */
182 +#endif
183 +#ifndef BLKGETSIZE64
184 #define BLKGETSIZE64 _IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
185 +#endif
186
187 struct blkdev_ioctl_param {
188 unsigned int block;
189 @@ -143,20 +152,14 @@ get_sector_size(int filedes)
190 static uint64_t
191 _get_num_sectors(int filedes)
192 {
193 - unsigned long sectors=0;
194 int rc;
195 -#if 0
196 - uint64_t bytes=0;
197 + uint64_t bytes=0;
198
199 - rc = ioctl(filedes, BLKGETSIZE64, &bytes);
200 + rc = ioctl(filedes, BLKGETSIZE64, &bytes);
201 if (!rc)
202 return bytes / get_sector_size(filedes);
203 -#endif
204 - rc = ioctl(filedes, BLKGETSIZE, &sectors);
205 - if (rc)
206 - return 0;
207 -
208 - return sectors;
209 +
210 + return 0;
211 }
212
213 /************************************************************
214 @@ -193,7 +196,7 @@ last_lba(int filedes)
215 sectors = 1;
216 }
217
218 - return sectors - 1;
219 + return sectors ? sectors - 1 : 0;
220 }
221
222
223 @@ -220,17 +223,22 @@ read_lba(int fd, uint64_t lba, void *buffer, size_t bytes)
224 {
225 int sector_size = get_sector_size(fd);
226 off_t offset = lba * sector_size;
227 + uint64_t lastlba;
228 ssize_t bytesread;
229
230 lseek(fd, offset, SEEK_SET);
231 bytesread = read(fd, buffer, bytes);
232
233 + lastlba = last_lba(fd);
234 + if (!lastlba)
235 + return bytesread;
236 +
237 /* Kludge. This is necessary to read/write the last
238 block of an odd-sized disk, until Linux 2.5.x kernel fixes.
239 This is only used by gpt.c, and only to read
240 one sector, so we don't have to be fancy.
241 */
242 - if (!bytesread && !(last_lba(fd) & 1) && lba == last_lba(fd)) {
243 + if (!bytesread && !(lastlba & 1) && lba == lastlba) {
244 bytesread = read_lastoddsector(fd, lba, buffer, bytes);
245 }
246 return bytesread;
247 @@ -505,7 +513,8 @@ find_valid_gpt(int fd, gpt_header ** gpt, gpt_entry ** ptes)
248 if (!gpt || !ptes)
249 return 0;
250
251 - lastlba = last_lba(fd);
252 + if (!(lastlba = last_lba(fd)))
253 + return 0;
254 good_pgpt = is_gpt_valid(fd, GPT_PRIMARY_PARTITION_TABLE_LBA,
255 &pgpt, &pptes);
256 if (good_pgpt) {
257 diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
258 index dbe2ee2..72ca81d 100644
259 --- a/kpartx/kpartx.c
260 +++ b/kpartx/kpartx.c
261 @@ -25,6 +25,7 @@
262 #include <stdlib.h>
263 #include <string.h>
264 #include <unistd.h>
265 +#include <stdint.h>
266 #include <sys/stat.h>
267 #include <sys/types.h>
268 #include <ctype.h>
269 @@ -366,16 +367,16 @@ main(int argc, char **argv){
270
271 slices[j].minor = m++;
272
273 - printf("%s%s%d : 0 %lu %s %lu\n",
274 + printf("%s%s%d : 0 %" PRIu64 " %s %" PRIu64"\n",
275 mapname, delim, j+1,
276 - (unsigned long) slices[j].size, device,
277 - (unsigned long) slices[j].start);
278 + slices[j].size, device,
279 + slices[j].start);
280 }
281 /* Loop to resolve contained slices */
282 d = c;
283 while (c) {
284 for (j = 0; j < n; j++) {
285 - unsigned long start;
286 + uint64_t start;
287 int k = slices[j].container - 1;
288
289 if (slices[j].size == 0)
290 @@ -387,9 +388,9 @@ main(int argc, char **argv){
291 slices[j].minor = m++;
292
293 start = slices[j].start - slices[k].start;
294 - printf("%s%s%d : 0 %lu /dev/dm-%d %lu\n",
295 + printf("%s%s%d : 0 %" PRIu64 " /dev/dm-%d %" PRIu64 "\n",
296 mapname, delim, j+1,
297 - (unsigned long) slices[j].size,
298 + slices[j].size,
299 slices[k].minor, start);
300 c--;
301 }
302 @@ -448,8 +449,8 @@ main(int argc, char **argv){
303 }
304 strip_slash(partname);
305
306 - if (safe_sprintf(params, "%s %lu", device,
307 - (unsigned long)slices[j].start)) {
308 + if (safe_sprintf(params, "%s %" PRIu64 ,
309 + device, slices[j].start)) {
310 fprintf(stderr, "params too small\n");
311 exit(1);
312 }
313 @@ -468,7 +469,7 @@ main(int argc, char **argv){
314 &slices[j].minor);
315
316 if (verbose)
317 - printf("add map %s (%d:%d): 0 %lu %s %s\n",
318 + printf("add map %s (%d:%d): 0 %" PRIu64 " %s %s\n",
319 partname, slices[j].major,
320 slices[j].minor, slices[j].size,
321 DM_TARGET, params);
322 @@ -502,10 +503,10 @@ main(int argc, char **argv){
323 }
324 strip_slash(partname);
325
326 - if (safe_sprintf(params, "%d:%d %lu",
327 + if (safe_sprintf(params, "%d:%d %" PRIu64,
328 slices[k].major,
329 slices[k].minor,
330 - (unsigned long)slices[j].start)) {
331 + slices[j].start)) {
332 fprintf(stderr, "params too small\n");
333 exit(1);
334 }
335 @@ -524,7 +525,7 @@ main(int argc, char **argv){
336 &slices[j].minor);
337
338 if (verbose)
339 - printf("add map %s : 0 %lu %s %s\n",
340 + printf("add map %s : 0 %" PRIu64 " %s %s\n",
341 partname, slices[j].size,
342 DM_TARGET, params);
343 c--;
344 diff --git a/kpartx/kpartx.h b/kpartx/kpartx.h
345 index 9b3aeca..43ae3f8 100644
346 --- a/kpartx/kpartx.h
347 +++ b/kpartx/kpartx.h
348 @@ -1,6 +1,8 @@
349 #ifndef _KPARTX_H
350 #define _KPARTX_H
351
352 +#include <stdint.h>
353 +
354 /*
355 * For each partition type there is a routine that takes
356 * a block device and a range, and returns the list of
357 @@ -20,8 +22,8 @@
358 * units: 512 byte sectors
359 */
360 struct slice {
361 - unsigned long start;
362 - unsigned long size;
363 + uint64_t start;
364 + uint64_t size;
365 int container;
366 int major;
367 int minor;
368
369
370
371 1.1 sys-fs/multipath-tools/files/init.d-multipath-0.4.8-r1
372
373 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/init.d-multipath-0.4.8-r1?rev=1.1&view=markup
374 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/multipath-tools/files/init.d-multipath-0.4.8-r1?rev=1.1&content-type=text/plain
375
376 Index: init.d-multipath-0.4.8-r1
377 ===================================================================
378 #!/sbin/runscript
379 # Copyright 1999-2007 Gentoo Foundation
380 # Distributed under the terms of the GNU General Public License v2
381 # $Header: /var/cvsroot/gentoo-x86/sys-fs/multipath-tools/files/init.d-multipath-0.4.8-r1,v 1.1 2009/10/30 06:50:11 robbat2 Exp $
382
383 # Existence of this file means we are on baselayout 2.
384 check_bl2_file='/etc/init.d/sysfs'
385
386 depend() {
387 if [ -e ${check_bl2_file} ]; then
388 # on baselayout-1 this causes
389 # dependency-cycles with checkroot (before *)
390 before checkfs fsck multipathd lvm
391 after modules device-mapper
392 fi
393 }
394
395 # Once we are ready to stop baselayout1 support, we can just merge the addons
396 # into here.
397 run_addon() {
398 local f=/lib/rcscripts/addons/$1.sh
399 if [ -r "$f" ]; then
400 ( . "$f" )
401 fi
402 }
403
404 start() {
405 if [ ! -e ${check_bl2_file} ]; then
406 eerror "The $SVCNAME init-script is written for baselayout-2!"
407 eerror "Please do not use it with baselayout-1!".
408 return 1
409 fi
410
411 run_addon multipath-start
412 }
413
414 stop() {
415 run_addon multipath-stop
416 }
417
418 # vim:ts=4