]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - parted/patches/parted-2.1-default-alignment.patch
Change file layout of the makefiles.
[people/ms/ipfire-3.x.git] / parted / patches / parted-2.1-default-alignment.patch
1 From 6c4c8464c704b645ddeccce4c4931b8e9d11c3a8 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Fri, 29 Jan 2010 10:58:17 +0100
4 Subject: [PATCH parted 1/7] linux: Fixup phys_sector_size setting
5
6 1) Use the logical sector size as physical sector size instead of 512
7 when not compiled with libblkid support, this fixes problems
8 with logical sector size > physical sector size.
9 2) blkid_topology_get_physical_sector_size() can return 0 when it could
10 not determine the physical sector size, handle this.
11 * libparted/arch/linux.c (_device_set_sector_size): Fixup
12 phys_sector_size setting.
13 ---
14 libparted/arch/linux.c | 17 +++++++++++------
15 2 files changed, 14 insertions(+), 6 deletions(-)
16
17 diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
18 index f3b54f0..4b7b9f5 100644
19 --- a/libparted/arch/linux.c
20 +++ b/libparted/arch/linux.c
21 @@ -654,22 +654,27 @@ _device_set_sector_size (PedDevice* dev)
22 dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
23 } else {
24 dev->sector_size = (long long)sector_size;
25 + dev->phys_sector_size = dev->sector_size;
26 }
27
28 #if USE_BLKID
29 get_blkid_topology(arch_specific);
30 if (!arch_specific->topology) {
31 - ped_exception_throw (
32 - PED_EXCEPTION_WARNING,
33 - PED_EXCEPTION_OK,
34 - _("Could not determine minimum io size for %s: %s.\n"
35 - "Using the default size (%lld)."),
36 - dev->path, strerror (errno), PED_SECTOR_SIZE_DEFAULT);
37 + dev->phys_sector_size = 0;
38 } else {
39 dev->phys_sector_size =
40 blkid_topology_get_physical_sector_size(
41 arch_specific->topology);
42 }
43 + if (dev->phys_sector_size == 0) {
44 + ped_exception_throw (
45 + PED_EXCEPTION_WARNING,
46 + PED_EXCEPTION_OK,
47 + _("Could not determine physical sector size for %s.\n"
48 + "Using the logical sector size (%lld)."),
49 + dev->path, dev->sector_size);
50 + dev->phys_sector_size = dev->sector_size;
51 + }
52 #endif
53
54 #if defined __s390__ || defined __s390x__
55 --
56 1.6.6
57
58 From 4bb123a121b54d758f87fc6c38d8edab4ddc6d6b Mon Sep 17 00:00:00 2001
59 From: Hans de Goede <hdegoede@redhat.com>
60 Date: Fri, 29 Jan 2010 19:55:10 +0100
61 Subject: [PATCH parted 2/7] libparted: Give device_get_*_alignment sane defaults
62
63 When the topology info is incomplete or non existent, return something
64 more sensible then NULL (which ends up being interpreted as
65 PedAlignmentAny in most cases). The default minimum alignment aligns to
66 physical sector size, the default optimal alignment is 1 MiB, which is
67 what vista and windows 7 do.
68 * libparted/device.c (device_get_*_alignment): Add default aligments.
69 ---
70 libparted/device.c | 30 ++++++++++++++++++++++++++----
71 2 files changed, 33 insertions(+), 4 deletions(-)
72
73 diff --git a/libparted/device.c b/libparted/device.c
74 index dda8d74..0f36a03 100644
75 --- a/libparted/device.c
76 +++ b/libparted/device.c
77 @@ -501,10 +501,16 @@ ped_device_get_optimal_aligned_constraint(const PedDevice *dev)
78 PedAlignment*
79 ped_device_get_minimum_alignment(const PedDevice *dev)
80 {
81 + PedAlignment *align = NULL;
82 +
83 if (ped_architecture->dev_ops->get_minimum_alignment)
84 - return ped_architecture->dev_ops->get_minimum_alignment(dev);
85 + align = ped_architecture->dev_ops->get_minimum_alignment(dev);
86 +
87 + if (align == NULL)
88 + align = ped_alignment_new(0,
89 + dev->phys_sector_size / dev->sector_size);
90
91 - return NULL; /* ped_alignment_none */
92 + return align;
93 }
94
95 /**
96 @@ -521,10 +527,26 @@ ped_device_get_minimum_alignment(const PedDevice *dev)
97 PedAlignment*
98 ped_device_get_optimum_alignment(const PedDevice *dev)
99 {
100 + PedAlignment *align = NULL;
101 +
102 if (ped_architecture->dev_ops->get_optimum_alignment)
103 - return ped_architecture->dev_ops->get_optimum_alignment(dev);
104 + align = ped_architecture->dev_ops->get_optimum_alignment(dev);
105 +
106 + /* If the arch specific code could not give as an alignment
107 + return a default value based on the type of device. */
108 + if (align == NULL) {
109 + switch (dev->type) {
110 + case PED_DEVICE_DASD:
111 + align = ped_device_get_minimum_alignment(dev);
112 + break;
113 + default:
114 + /* Align to a grain of 1MiB (like vista / win7) */
115 + align = ped_alignment_new(0,
116 + 1048576 / dev->sector_size);
117 + }
118 + }
119
120 - return NULL; /* ped_alignment_none */
121 + return align;
122 }
123
124 /** @} */
125 --
126 1.6.6
127
128 From 82f42a9e059a8f5dea46090889914041204ebe36 Mon Sep 17 00:00:00 2001
129 From: Hans de Goede <hdegoede@redhat.com>
130 Date: Fri, 29 Jan 2010 19:59:06 +0100
131 Subject: [PATCH parted 3/7] linux: handle incomplete topology information
132
133 The topology information returned by libblkid is not always complete
134 (as the kernel does not always have complete information).
135 This patch makes the linux_get_*_alignment() alignment functions handle
136 this. The algorithm used for linux_get_optimum_alignment is:
137 1) Always use the reported aligment offset as offset
138 2a)If optimal io size is present in the topology info use that as grain
139 2b)If optimal io size is not present in topology info and aligment
140 offset is 0 and minimum io size is a power of 2, use the device.c
141 default optimal alignment (grain 1MiB).
142 2c)If not 2a and 2b, use the minimum io size, or if that is not defined
143 the physical sector size as grain (iow the minimum alignment).
144 The algorithm used for linux_get_minimum_alignment is:
145 1) Always use the reported aligment offset as offset
146 2) Use the minimum io size, or if that is not defined the physical
147 sector size as grain.
148 * libparted/arch/linux.c (linux_get_*_alignment): handle incomplete
149 topology information.
150 ---
151 libparted/arch/linux.c | 25 +++++++++++++++++++++----
152 1 files changed, 21 insertions(+), 4 deletions(-)
153
154 diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
155 index 4b7b9f5..a083028 100644
156 --- a/libparted/arch/linux.c
157 +++ b/libparted/arch/linux.c
158 @@ -2564,9 +2564,14 @@ PedAlignment*
159 linux_get_minimum_alignment(const PedDevice *dev)
160 {
161 blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
162 + if (!tp)
163 + return NULL;
164
165 - if (!tp || blkid_topology_get_minimum_io_size(tp) == 0)
166 - return NULL; /* ped_alignment_none */
167 + if (blkid_topology_get_minimum_io_size(tp) == 0)
168 + return ped_alignment_new(
169 + blkid_topology_get_alignment_offset(tp) /
170 + dev->sector_size,
171 + dev->phys_sector_size / dev->sector_size);
172
173 return ped_alignment_new(
174 blkid_topology_get_alignment_offset(tp) / dev->sector_size,
175 @@ -2577,9 +2582,21 @@ PedAlignment*
176 linux_get_optimum_alignment(const PedDevice *dev)
177 {
178 blkid_topology tp = LINUX_SPECIFIC(dev)->topology;
179 + if (!tp)
180 + return NULL;
181 +
182 + /* If optimal_io_size is 0 _and_ alignment_offset is 0 _and_
183 + minimum_io_size is a power of 2 then go with the device.c default */
184 + unsigned long minimum_io_size = blkid_topology_get_minimum_io_size(tp);
185 + if (blkid_topology_get_optimal_io_size(tp) == 0 &&
186 + blkid_topology_get_alignment_offset(tp) == 0 &&
187 + (minimum_io_size & (minimum_io_size - 1)) == 0)
188 + return NULL;
189
190 - if (!tp || blkid_topology_get_optimal_io_size(tp) == 0)
191 - return NULL; /* ped_alignment_none */
192 + /* If optimal_io_size is 0 and we don't meet the other criteria
193 + for using the device.c default, return the minimum alignment. */
194 + if (blkid_topology_get_optimal_io_size(tp) == 0)
195 + return linux_get_minimum_alignment(dev);
196
197 return ped_alignment_new(
198 blkid_topology_get_alignment_offset(tp) / dev->sector_size,
199 --
200 1.6.6
201
202 From 4be1b004ad2c576fc093ca5227e22bb78b35f1fd Mon Sep 17 00:00:00 2001
203 From: Hans de Goede <hdegoede@redhat.com>
204 Date: Fri, 29 Jan 2010 23:28:13 +0100
205 Subject: [PATCH parted 4/7] parted: Honor --align option also in mkpartfs, resize and print cmds
206
207 parted/parted.c (do_mkpartfs,do_print,do_resize): honor --align
208 ---
209 parted/parted.c | 26 +++++++++++++++++++++++++-
210 1 files changed, 25 insertions(+), 1 deletions(-)
211
212 diff --git a/parted/parted.c b/parted/parted.c
213 index c4d1779..5ba8bbf 100644
214 --- a/parted/parted.c
215 +++ b/parted/parted.c
216 @@ -949,6 +949,11 @@ do_mkpartfs (PedDevice** dev)
217 if (!disk)
218 goto error;
219
220 + if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
221 + if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
222 + alignment == ALIGNMENT_CYLINDER))
223 + goto error_destroy_disk;
224 +
225 if (!ped_disk_type_check_feature (disk->type, PED_DISK_TYPE_EXTENDED)) {
226 part_type = PED_PARTITION_NORMAL;
227 } else {
228 @@ -989,7 +994,14 @@ do_mkpartfs (PedDevice** dev)
229 range_end);
230 PED_ASSERT (user_constraint != NULL, return 0);
231
232 - dev_constraint = ped_device_get_constraint (*dev);
233 + if (alignment == ALIGNMENT_OPTIMAL)
234 + dev_constraint =
235 + ped_device_get_optimal_aligned_constraint(*dev);
236 + else if (alignment == ALIGNMENT_MINIMAL)
237 + dev_constraint =
238 + ped_device_get_minimal_aligned_constraint(*dev);
239 + else
240 + dev_constraint = ped_device_get_constraint(*dev);
241 PED_ASSERT (dev_constraint != NULL, return 0);
242
243 final_constraint = ped_constraint_intersect (user_constraint,
244 @@ -1353,6 +1365,11 @@ do_print (PedDevice** dev)
245 if (!disk)
246 goto error;
247
248 + if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
249 + if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
250 + alignment == ALIGNMENT_CYLINDER))
251 + goto error_destroy_disk;
252 +
253 peek_word = command_line_peek_word ();
254 if (peek_word) {
255 if (strncmp (peek_word, "devices", 7) == 0) {
256 @@ -1697,6 +1697,7 @@ do_print (PedDevice** dev)
257
258 return 1;
259
260 +error_destroy_disk:
261 ped_disk_destroy (disk);
262 error:
263 return 0;
264 @@ -1862,6 +1881,11 @@ do_resize (PedDevice** dev)
265 if (!disk)
266 goto error;
267
268 + if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT))
269 + if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT,
270 + alignment == ALIGNMENT_CYLINDER))
271 + goto error_destroy_disk;
272 +
273 if (!command_line_get_partition (_("Partition number?"), disk, &part))
274 goto error_destroy_disk;
275 if (part->type != PED_PARTITION_EXTENDED) {
276 --
277 1.6.6
278
279 From 950bfc92b1a67c8baa8c7cfab04103bd38a2d24b Mon Sep 17 00:00:00 2001
280 From: Hans de Goede <hdegoede@redhat.com>
281 Date: Fri, 29 Jan 2010 22:51:30 +0100
282 Subject: [PATCH parted 5/7] parted: change warnings when initial constrained mkpart fails
283
284 In do_mkpart we first try to create a partition using a constraint
285 derived from the user input intersected with the devices alignment
286 needs. And if that fails we try again without any constraint.
287
288 However the warning given when this happens only takes into account
289 the user not getting what he asked for, while the alignment might be
290 a problem too (or even the only problem). So this patch adds a check
291 to see if the user really did not get what he asked before giving that
292 warning, and adds a new check + warning to see if the created partition
293 is properly aligned.
294 *parted/parted.c (do_mkpart,do_mkpartfs): change warnings when initial
295 constrained mkpart fails.
296 ---
297 parted/parted.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++------
298 1 files changed, 52 insertions(+), 7 deletions(-)
299
300 diff --git a/parted/parted.c b/parted/parted.c
301 index 5ba8bbf..3ce356f 100644
302 --- a/parted/parted.c
303 +++ b/parted/parted.c
304 @@ -178,6 +178,8 @@ static TimerContext timer_context;
305
306 static int _print_list ();
307 static void _done (PedDevice* dev);
308 +static bool partition_align_check (PedDisk const *disk,
309 + PedPartition const *part, enum AlignmentType a_type);
310
311 static void
312 _timer_handler (PedTimer* timer, void* context)
313 @@ -833,7 +835,12 @@ do_mkpart (PedDevice** dev)
314 bool added_ok = ped_disk_add_partition (disk, part,
315 constraint_any);
316 ped_constraint_destroy (constraint_any);
317 - if (added_ok) {
318 +
319 + if (!added_ok)
320 + goto error_remove_part;
321 +
322 + if (!ped_geometry_test_sector_inside(range_start, part->geom.start) ||
323 + !ped_geometry_test_sector_inside(range_end, part->geom.end)) {
324 start_usr = ped_unit_format (*dev, start);
325 end_usr = ped_unit_format (*dev, end);
326 start_sol = ped_unit_format (*dev, part->geom.start);
327 @@ -867,8 +874,23 @@ do_mkpart (PedDevice** dev)
328 /* undo partition addition */
329 goto error_remove_part;
330 }
331 - } else {
332 - goto error_remove_part;
333 + }
334 +
335 + if ((alignment == ALIGNMENT_OPTIMAL &&
336 + !partition_align_check(disk, part, PA_OPTIMUM)) ||
337 + (alignment == ALIGNMENT_MINIMAL &&
338 + !partition_align_check(disk, part, PA_MINIMUM))) {
339 + if (ped_exception_throw(
340 + PED_EXCEPTION_WARNING,
341 + (opt_script_mode
342 + ? PED_EXCEPTION_OK
343 + : PED_EXCEPTION_IGNORE_CANCEL),
344 + _("The resulting partition is not properly "
345 + "aligned for best performance.")) ==
346 + PED_EXCEPTION_CANCEL) {
347 + /* undo partition addition */
348 + goto error_remove_part;
349 + }
350 }
351 } else {
352 ped_exception_leave_all();
353 @@ -1018,8 +1040,16 @@ do_mkpartfs (PedDevice** dev)
354 if (!added_ok) {
355 ped_exception_leave_all();
356
357 - if (ped_disk_add_partition (disk, part,
358 - ped_constraint_any (*dev))) {
359 + PedConstraint *constraint_any = ped_constraint_any (*dev);
360 + bool added_ok = ped_disk_add_partition (disk, part,
361 + constraint_any);
362 + ped_constraint_destroy (constraint_any);
363 +
364 + if (!added_ok)
365 + goto error_remove_part;
366 +
367 + if (!ped_geometry_test_sector_inside(range_start, part->geom.start) ||
368 + !ped_geometry_test_sector_inside(range_end, part->geom.end)) {
369 start_usr = ped_unit_format (*dev, start);
370 end_usr = ped_unit_format (*dev, end);
371 start_sol = ped_unit_format (*dev, part->geom.start);
372 @@ -1048,8 +1078,23 @@ do_mkpartfs (PedDevice** dev)
373 /* undo partition addition */
374 goto error_remove_part;
375 }
376 - } else {
377 - goto error_remove_part;
378 + }
379 +
380 + if ((alignment == ALIGNMENT_OPTIMAL &&
381 + !partition_align_check(disk, part, PA_OPTIMUM)) ||
382 + (alignment == ALIGNMENT_MINIMAL &&
383 + !partition_align_check(disk, part, PA_MINIMUM))) {
384 + if (ped_exception_throw(
385 + PED_EXCEPTION_WARNING,
386 + (opt_script_mode
387 + ? PED_EXCEPTION_OK
388 + : PED_EXCEPTION_IGNORE_CANCEL),
389 + _("The resulting partition is not properly "
390 + "aligned for best performance.")) ==
391 + PED_EXCEPTION_CANCEL) {
392 + /* undo partition addition */
393 + goto error_remove_part;
394 + }
395 }
396 } else {
397 ped_exception_leave_all();
398 --
399 1.6.6
400
401 From 6c2db872647816b84a5efc8c8995a019d47f89a9 Mon Sep 17 00:00:00 2001
402 From: Hans de Goede <hdegoede@redhat.com>
403 Date: Sat, 30 Jan 2010 17:46:23 +0100
404 Subject: [PATCH parted 6/7] Makefiles: Fix check-other-sector_sizes
405
406 Atleast on my system check-other-sector_sizes was actually just testing
407 512 bytes sectors 4 times. This fixes this.
408 * Makefile.am: Fix check-other-sector_sizes
409 ---
410 Makefile.am | 2 +-
411 1 files changed, 1 insertions(+), 1 deletions(-)
412
413 diff --git a/Makefile.am b/Makefile.am
414 index 0e80967..d5a32ef 100644
415 --- a/Makefile.in
416 +++ b/Makefile.in
417 @@ -1415,7 +1415,7 @@ MAINTAINERCLEANFILES += \
418
419 .PHONY: ss-1024 ss-2048 ss-4096
420 ss-1024 ss-2048 ss-4096:
421 - PARTED_SECTOR_SIZE=$(ss-,,$@) $(MAKE) check-recursive
422 + PARTED_SECTOR_SIZE=$(subst ss-,,$@) $(MAKE) check-recursive
423
424 # Run the regression test suite with different settings,
425 # to ensure it works with simulated partition sizes > 512.
426 --
427 1.6.6
428
429 From 6ba62ce27f84c5c931d021f4be4af0cce011bdbf Mon Sep 17 00:00:00 2001
430 From: Hans de Goede <hdegoede@redhat.com>
431 Date: Fri, 29 Jan 2010 20:30:18 +0100
432 Subject: [PATCH parted 7/7] parted: Change default alignment to optimal
433
434 parted/parted.c: change --align default value to optimal
435 tests/*.sh: adjust for alignment changes where necessary
436 ---
437 parted/parted.c | 2 +-
438 tests/t0220-gpt-msftres.sh | 4 ++--
439 tests/t0280-gpt-corrupt.sh | 6 +++---
440 tests/t2100-mkswap.sh | 14 +++++++-------
441 tests/t2200-dos-label-recog.sh | 11 ++++++-----
442 tests/t2300-dos-label-extended-bootcode.sh | 12 ++++++------
443 tests/t3000-resize-fs.sh | 4 ++--
444 tests/t4100-dvh-partition-limits.sh | 4 +++-
445 tests/t4100-msdos-partition-limits.sh | 22 +++++-----------------
446 tests/t4100-msdos-starting-sector.sh | 10 +++++-----
447 tests/t5000-tags.sh | 6 +++---
448 tests/t8000-loop.sh | 1 +
449 tests/t9021-maxima.sh | 3 ++-
450 14 files changed, 49 insertions(+), 53 deletions(-)
451
452 diff --git a/parted/parted.c b/parted/parted.c
453 index 3ce356f..e35ce6a 100644
454 --- a/parted/parted.c
455 +++ b/parted/parted.c
456 @@ -133,7 +133,7 @@ int pretend_input_tty = 0;
457 int opt_machine_mode = 0;
458 int disk_is_modified = 0;
459 int is_toggle_mode = 0;
460 -int alignment = ALIGNMENT_CYLINDER;
461 +int alignment = ALIGNMENT_OPTIMAL;
462
463 static const char* number_msg = N_(
464 "NUMBER is the partition number used by Linux. On MS-DOS disk labels, the "
465 diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
466 index 8ef885f..bbc415b 100755
467 --- a/tests/t0220-gpt-msftres.sh
468 +++ b/tests/t0220-gpt-msftres.sh
469 @@ -35,8 +35,8 @@ NTFS
470 reiserfs
471 '
472
473 -start=200
474 -part_size=100
475 +start=2048
476 +part_size=2048
477 n_types=$(echo "$fs_types"|wc -w)
478
479 # Create a "disk" with enough room for one partition per FS type,
480 diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
481 index 28c9035..5c48116 100755
482 --- a/tests/t0280-gpt-corrupt.sh
483 +++ b/tests/t0280-gpt-corrupt.sh
484 @@ -43,7 +43,7 @@ poke()
485 dev=loop-file
486
487 ss=$sector_size_
488 -n_sectors=200
489 +n_sectors=5000
490
491 fail=0
492 dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
493 @@ -62,7 +62,7 @@ printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt:;\n" \
494 compare exp out || fail=1
495
496 # create a partition
497 -parted -s $dev mkpart sw linux-swap 60s 100s > empty 2>&1 || fail=1
498 +parted -s $dev mkpart sw linux-swap 2048s 4095s > empty 2>&1 || fail=1
499 compare /dev/null empty || fail=1
500
501 # We're going to change the name of the first partition,
502 @@ -123,7 +123,7 @@ compare exp err || fail=1
503 parted -m -s $dev u s print > out 2>&1 || fail=1
504
505 # check for expected output
506 -printf "BYT;\nfile\n1:60s:100s:41s::foo:;\n" > exp || fail=1
507 +printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1
508 sed "s/.*gpt:;/file/" out > k && mv k out || fail=1
509 compare exp out || fail=1
510
511 diff --git a/tests/t2100-mkswap.sh b/tests/t2100-mkswap.sh
512 index 1462e5d..1e4c444 100755
513 --- a/tests/t2100-mkswap.sh
514 +++ b/tests/t2100-mkswap.sh
515 @@ -27,7 +27,7 @@ require_512_byte_sector_size_
516 # table, ensure that the proper file system type (0x82) is used.
517 # Some releases, e.g. parted-1.8.8 would mistakenly use 0x83.
518 ######################################################################
519 -N=1M
520 +N=2M
521 dev=loop-file
522 dev2=loop-file-2
523 test_expect_success \
524 @@ -41,7 +41,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
525
526 test_expect_success \
527 'create a partition' \
528 - 'parted -s $dev mkpart primary 0 1 > out 2>&1'
529 + 'parted -s $dev mkpart primary 2048s 4095s > out 2>&1'
530 test_expect_success 'expect no output' 'compare out /dev/null'
531
532 test_expect_success \
533 @@ -66,7 +66,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
534
535 test_expect_success \
536 'create another partition' \
537 - 'parted -s $dev2 mkpart primary 0 1 > out 2>&1'
538 + 'parted -s $dev2 mkpart primary 2048s 4095s > out 2>&1'
539 test_expect_success 'expect no output' 'compare out /dev/null'
540
541 test_expect_success \
542 @@ -74,13 +74,13 @@ test_expect_success \
543 'parted -s $dev2 mkfs 1 "linux-swap(v1)" > out 2>&1'
544 test_expect_success 'expect no output' 'compare out /dev/null'
545
546 -# partition starts at offset 16384; swap UUID is 1036 bytes in
547 +# partition starts at offset 1048576; swap UUID is 1036 bytes in
548 test_expect_success \
549 'extract UUID 1' \
550 - 'od -t x1 -An -j17420 -N16 $dev > uuid1'
551 + 'od -t x1 -An -j1049612 -N16 $dev > uuid1'
552 test_expect_success \
553 'extract UUID 2' \
554 - 'od -t x1 -An -j17420 -N16 $dev2 > uuid2'
555 + 'od -t x1 -An -j1049612 -N16 $dev2 > uuid2'
556 test_expect_failure \
557 'two linux-swap file systems have different UUIDs' \
558 'compare uuid1 uuid2'
559 @@ -92,7 +92,7 @@ test_expect_success 'expect no output' 'compare out /dev/null'
560
561 test_expect_success \
562 'extract new UUID 2' \
563 - 'od -t x1 -An -j17420 -N16 $dev2 > uuid2-new'
564 + 'od -t x1 -An -j1049612 -N16 $dev2 > uuid2-new'
565 test_expect_success \
566 'check preserves linux-swap UUID' \
567 'compare uuid2 uuid2-new'
568 diff --git a/tests/t2200-dos-label-recog.sh b/tests/t2200-dos-label-recog.sh
569 index 1254226..92e6d42 100755
570 --- a/tests/t2200-dos-label-recog.sh
571 +++ b/tests/t2200-dos-label-recog.sh
572 @@ -25,11 +25,12 @@ test_description='improved MSDOS partition-table recognition'
573 # parted 1.8.8.1.29 and earlier would fail to recognize a DOS
574 # partition table.
575 ######################################################################
576 -N=10M
577 +ss=$sector_size_
578 +N=8192
579 dev=loop-file
580 test_expect_success \
581 'create a file to simulate the underlying device' \
582 - 'dd if=/dev/null of=$dev bs=1 seek=$N 2> /dev/null'
583 + 'dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null'
584
585 test_expect_success \
586 'label the test disk' \
587 @@ -39,8 +40,8 @@ test_expect_success 'expect no output' 'compare out /dev/null'
588 test_expect_success \
589 'create two partition' \
590 '
591 - parted -s $dev mkpart primary 1s 40s > out 2>&1 &&
592 - parted -s $dev mkpart primary 41s 80s >> out 2>&1
593 + parted -s $dev mkpart primary 2048s 4095s > out 2>&1 &&
594 + parted -s $dev mkpart primary 4096s 8191s >> out 2>&1
595
596 '
597 test_expect_success 'expect no output' 'compare out /dev/null'
598 @@ -54,7 +55,7 @@ test_expect_success \
599 '
600 parted -m -s $dev unit s p > out &&
601 tail -2 out > k && mv k out &&
602 - printf "1:1s:40s:40s:::;\n2:41s:80s:40s:::;\n" > exp
603 + printf "1:2048s:4095s:2048s:::;\n2:4096s:8191s:4096s:::;\n" > exp
604
605 '
606 test_expect_success 'expect two partitions' 'compare out exp'
607 diff --git a/tests/t2300-dos-label-extended-bootcode.sh b/tests/t2300-dos-label-extended-bootcode.sh
608 index 6f2b219..73fa45b 100755
609 --- a/tests/t2300-dos-label-extended-bootcode.sh
610 +++ b/tests/t2300-dos-label-extended-bootcode.sh
611 @@ -27,7 +27,7 @@ bootcode_size=446
612
613 test_expect_success \
614 'Create the test file' \
615 - 'dd if=/dev/zero of=$dev bs=1024c count=100 >/dev/null 2>&1'
616 + 'dd if=/dev/zero of=$dev bs=1M count=4 >/dev/null 2>&1'
617
618 test_expect_success \
619 'Create msdos label' \
620 @@ -36,23 +36,23 @@ test_expect_success 'Expect no output' 'compare out /dev/null'
621
622 test_expect_success \
623 'Create extended partition' \
624 - 'parted -s $dev mkpart extended 32s 127s > out 2>&1'
625 + 'parted -s $dev mkpart extended 2048s 8191s > out 2>&1'
626 test_expect_success 'Expect no output' 'compare out /dev/null'
627
628 test_expect_success \
629 'Create logical partition' \
630 - 'parted -s $dev mkpart logical 64s 127s > out 2>&1'
631 + 'parted -s $dev mkpart logical 4096s 8191s > out 2>&1'
632 test_expect_success 'Expect no output' 'compare out /dev/null'
633
634 test_expect_success \
635 'Install fake bootcode' \
636 'printf %0${bootcode_size}d 0 > in &&
637 - dd if=in of=$dev bs=1c seek=16384 count=$bootcode_size \
638 + dd if=in of=$dev bs=1c seek=1M count=$bootcode_size \
639 conv=notrunc > /dev/null 2>&1'
640
641 test_expect_success \
642 'Save fake bootcode for later comparison' \
643 - 'dd if=$dev of=before bs=1 skip=16384 count=$bootcode_size > /dev/null 2>&1'
644 + 'dd if=$dev of=before bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
645
646 test_expect_success \
647 'Do something to the label' \
648 @@ -61,7 +61,7 @@ test_expect_success 'Expect no output' 'compare out /dev/null'
649
650 test_expect_success \
651 'Extract the bootcode for comparison' \
652 - 'dd if=$dev of=after bs=1 skip=16384 count=$bootcode_size > /dev/null 2>&1'
653 + 'dd if=$dev of=after bs=1 skip=1M count=$bootcode_size > /dev/null 2>&1'
654
655 test_expect_success \
656 'Expect bootcode has not changed' \
657 diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh
658 index 2abc71b..d6af67d 100755
659 --- a/tests/t3000-resize-fs.sh
660 +++ b/tests/t3000-resize-fs.sh
661 @@ -64,8 +64,8 @@ for fs_type in hfs+ fat32; do
662
663 # create an empty $fs_type partition, cylinder aligned, size > 256 MB
664 parted -s $dev mkpart primary $fs_type $start $default_end > out 2>&1 || fail=1
665 - # expect no output
666 - compare out /dev/null || fail=1
667 + echo "Warning: The resulting partition is not properly aligned for best performance." > exp
668 + compare out exp || fail=1
669
670 # print partition table
671 parted -m -s $dev u s p > out 2>&1 || fail=1
672 diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
673 index 01e3078..17b1530 100755
674 --- a/tests/t4100-dvh-partition-limits.sh
675 +++ b/tests/t4100-dvh-partition-limits.sh
676 @@ -33,11 +33,13 @@ fs=fs_file
677 mp=`pwd`/mount-point
678 n=4096
679
680 +# We must use -f otherwise newer mkfs.xfs fail with:
681 +# mkfs.xfs: probe of test.img failed, cannot detect existing filesystem.
682 test_expect_success \
683 'create an XFS file system' \
684 '
685 dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 &&
686 - mkfs.xfs -q $fs &&
687 + mkfs.xfs -f -q $fs &&
688 mkdir "$mp"
689
690 '
691 diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
692 index 0c5b404..b9f168a 100755
693 --- a/tests/t4100-msdos-partition-limits.sh
694 +++ b/tests/t4100-msdos-partition-limits.sh
695 @@ -33,11 +33,13 @@ fs=fs_file
696 mp=`pwd`/mount-point
697 n=4096
698
699 +# We must use -f otherwise newer mkfs.xfs fail with:
700 +# mkfs.xfs: probe of test.img failed, cannot detect existing filesystem.
701 test_expect_success \
702 'create an XFS file system' \
703 '
704 dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 &&
705 - mkfs.xfs -q $fs &&
706 + mkfs.xfs -f -q $fs &&
707 mkdir "$mp"
708
709 '
710 @@ -102,27 +104,13 @@ test_expect_success \
711 'check for new diagnostic' \
712 'bad_part_length 4294967296 > exp && diff -u err exp'
713
714 -# FIXME: investigate this.
715 -# Unexpectedly to me, both of these failed with this same diagnostic:
716 -#
717 -# Error: partition length of 4294967296 sectors exceeds the \
718 -# DOS-partition-table-imposed maximum of 2^32-1" > exp &&
719 -#
720 -# I expected the one below to fail with a length of _4294967297_.
721 -# Debugging, I see that _check_partition *does* detect this,
722 -# but the diagnostic doesn't get displayed because of the wonders
723 -# of parted's exception mechanism.
724 -
725 test_expect_failure \
726 "$table_type: a partition length of 2^32+1 sectors provokes failure." \
727 'do_mkpart $n $(echo $n+2^32|bc) > err 2>&1'
728
729 -# FIXME: odd that we asked for 2^32+1, yet the diagnostic says 2^32
730 -# FIXME: Probably due to constraints.
731 -# FIXME: For now, just accept the current output.
732 test_expect_success \
733 'check for new diagnostic' \
734 - 'bad_part_length 4294967296 > exp && diff -u err exp'
735 + 'bad_part_length 4294967297 > exp && diff -u err exp'
736
737 # =========================================================
738 # Now consider partition starting sector numbers.
739 @@ -164,7 +152,7 @@ test_expect_failure \
740 'do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1'
741 test_expect_success \
742 'check for new diagnostic' \
743 - 'bad_start_sector 4294967296 > exp && diff -u err exp'
744 + 'bad_start_sector 4294967297 > exp && diff -u err exp'
745
746 done
747
748 diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
749 index 7761e75..3d0233b 100755
750 --- a/tests/t4100-msdos-starting-sector.sh
751 +++ b/tests/t4100-msdos-starting-sector.sh
752 @@ -27,7 +27,7 @@ ss=$sector_size_
753 # consistent in the use of metadata padding for msdos labels.
754 ######################################################################
755
756 -N=200 # number of sectors
757 +N=4096 # number of sectors
758 dev=loop-file
759 test_expect_success \
760 'create a file to simulate the underlying device' \
761 @@ -43,7 +43,7 @@ fail=0
762 cat <<EOF > exp || fail=1
763 BYT;
764 path:${N}s:file:$ss:$ss:msdos:;
765 -1:32s:127s:96s:free;
766 +1:32s:4095s:4064s:free;
767 EOF
768
769 test_expect_success 'create expected output file' 'test $fail = 0'
770 @@ -62,15 +62,15 @@ fail=0
771 cat <<EOF > exp || fail=1
772 BYT;
773 path:${N}s:file:$ss:$ss:msdos:;
774 -1:32s:50s:19s:free;
775 -1:51s:199s:149s:::;
776 +1:32s:2047s:2016s:free;
777 +1:2048s:4095s:2048s:::;
778 EOF
779
780 test_expect_success 'create expected output file' 'test $fail = 0'
781
782 test_expect_success \
783 'create a partition at the end of the label' \
784 - 'parted -s $dev mkpart primary 51s 199s'
785 + 'parted -s $dev mkpart primary 2048s 4095s'
786
787 test_expect_success \
788 'display output of label with partition' \
789 diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
790 index d1e9533..9b0a1cc 100755
791 --- a/tests/t5000-tags.sh
792 +++ b/tests/t5000-tags.sh
793 @@ -22,10 +22,10 @@ test_description="test bios_grub flag in gpt labels"
794 ss=$sector_size_
795
796 dev=loop-file
797 -N=300 # number of sectors
798 +N=4200 # number of sectors
799
800 -part_sectors=128
801 -start_sector=60
802 +part_sectors=2048
803 +start_sector=2048
804 end_sector=$(expr $start_sector + $part_sectors - 1)
805
806 test_expect_success \
807 diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh
808 index 313e3b8..cba3454 100755
809 --- a/tests/t8000-loop.sh
810 +++ b/tests/t8000-loop.sh
811 @@ -25,6 +25,7 @@ fi
812 . $srcdir/t-lib.sh
813
814 require_root_
815 +lvm_init_root_dir_
816
817 d1= f1=
818 cleanup_()
819 diff --git a/tests/t9021-maxima.sh b/tests/t9021-maxima.sh
820 index 999a696..c8316bc 100755
821 --- a/tests/t9021-maxima.sh
822 +++ b/tests/t9021-maxima.sh
823 @@ -25,6 +25,7 @@ fi
824 . $srcdir/t-lib.sh
825
826 fail=0
827 +ss=$sector_size_
828 dev=dev-file
829 PATH="..:$PATH"
830 export PATH
831 @@ -33,7 +34,7 @@ export PATH
832 for t in msdos gpt dvh sun mac bsd amiga loop pc98; do
833 echo $t
834 rm -f $dev
835 - dd if=/dev/zero of=$dev bs=512 count=1 seek=10000 || { fail=1; continue; }
836 + dd if=/dev/zero of=$dev bs=$ss count=1 seek=10000 || { fail=1; continue; }
837 parted -s $dev mklabel $t || { fail=1; continue; }
838
839 #case $t in pc98) sleep 999d;; esac
840 --
841 1.6.6
842