From fc4a6200a3fa3edf3cfefb5ed0b5b9ccc869654c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 02 2019 16:13:18 +0000 Subject: import parted-3.1-31.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ff51ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/parted-3.1.tar.xz +SOURCES/pubkey.jim.meyering diff --git a/.parted.metadata b/.parted.metadata new file mode 100644 index 0000000..019f8b2 --- /dev/null +++ b/.parted.metadata @@ -0,0 +1,2 @@ +4f006d29451f7cfbf6131efdb0148e7f386ebc8f SOURCES/parted-3.1.tar.xz +4bd7444e752e7cfcb922051483a8a3c0f2c0bcb4 SOURCES/pubkey.jim.meyering diff --git a/SOURCES/0021-tests-Remove-rmmod-loop-from-t8001-1040504.patch b/SOURCES/0021-tests-Remove-rmmod-loop-from-t8001-1040504.patch new file mode 100644 index 0000000..fbb5231 --- /dev/null +++ b/SOURCES/0021-tests-Remove-rmmod-loop-from-t8001-1040504.patch @@ -0,0 +1,35 @@ +From 7ed256294ba287c807eca7bcc915a42f0030e5f9 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 22 Jan 2014 11:57:56 -0800 +Subject: [PATCH] tests: Remove rmmod loop from t8001 (#1040504) + +There is no reason to remove and reload the loop module, which may be in +use by other things on the system the test is running on. + + * tests/t8001-loop-blkpg.sh: Drop loop remove/load code. +--- + tests/t8001-loop-blkpg.sh | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/tests/t8001-loop-blkpg.sh b/tests/t8001-loop-blkpg.sh +index deef18b..abffd4e 100755 +--- a/tests/t8001-loop-blkpg.sh ++++ b/tests/t8001-loop-blkpg.sh +@@ -27,14 +27,6 @@ cleanup_fn_() + && { udevadm settle --timeout=3; losetup -d "$loopdev"; } + } + +-# If the loop module is loaded, unload it first +-if lsmod | grep '^loop[[:space:]]'; then +- rmmod loop || fail=1 +-fi +- +-# Insert loop module with max_part > 1 +-modprobe loop max_part=7 || fail=1 +- + # Create backing file + dd if=/dev/zero of=backing_file bs=1M count=4 >/dev/null 2>&1 || fail=1 + +-- +1.8.4.2 + diff --git a/SOURCES/0022-tests-Increase-size-of-container-filesystem-in-t4100.patch b/SOURCES/0022-tests-Increase-size-of-container-filesystem-in-t4100.patch new file mode 100644 index 0000000..7c05a6a --- /dev/null +++ b/SOURCES/0022-tests-Increase-size-of-container-filesystem-in-t4100.patch @@ -0,0 +1,45 @@ +From 9f0da5d1112d148fc9bdbedfe3f0ee04b7a66708 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 22 Jan 2014 14:51:51 -0800 +Subject: [PATCH] tests: Increase size of container filesystem in t4100 tests + (#1036149) + +The xfs container filesystem was running out of space with larger sector +size tests. Increase it from 20M to 100M. + +* tests/t4100-dvh-partition-limits.sh: Increase fs_file to 100M +* tests/t4100-msdos-partition-limits.sh: Increase fs_file to 100M +--- + tests/t4100-dvh-partition-limits.sh | 2 +- + tests/t4100-msdos-partition-limits.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh +index d885502..ec6981d 100755 +--- a/tests/t4100-dvh-partition-limits.sh ++++ b/tests/t4100-dvh-partition-limits.sh +@@ -37,7 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 || fail=1 ++dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1 + mkfs.xfs -f -q $fs || fail=1 + mkdir "$mp" || fail=1 + +diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh +index ec1854f..f03a85e 100755 +--- a/tests/t4100-msdos-partition-limits.sh ++++ b/tests/t4100-msdos-partition-limits.sh +@@ -37,7 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 || fail=1 ++dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1 + mkfs.xfs -f -q $fs || fail=1 + mkdir "$mp" || fail=1 + +-- +1.8.4.2 + diff --git a/SOURCES/0023-tests-Disable-t4100-dvh-test-for-now-1036093.patch b/SOURCES/0023-tests-Disable-t4100-dvh-test-for-now-1036093.patch new file mode 100644 index 0000000..acd26f7 --- /dev/null +++ b/SOURCES/0023-tests-Disable-t4100-dvh-test-for-now-1036093.patch @@ -0,0 +1,36 @@ +From 2b55a78efa8e11202c8c5b266bc6e80386487f4d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 22 Jan 2014 17:17:25 -0800 +Subject: [PATCH] tests: Disable t4100-dvh test for now (#1036093) + +This test is failing on ppc64, possibly because of a bug in the dvh +code. + +* tests/Makefile.am: Move t4100-dvh- test to XFAIL +--- + tests/Makefile.am | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 98310f2..faa0f37 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -1,5 +1,6 @@ + XFAIL_TESTS = \ +- t3200-type-change.sh ++ t3200-type-change.sh \ ++ t4100-dvh-partition-limits.sh + + TEST_EXTENSIONS = .sh + SH_LOG_COMPILER = $(SHELL) +@@ -48,7 +49,6 @@ TESTS = \ + t4000-sun-raid-type.sh \ + t4001-sun-vtoc.sh \ + t4100-msdos-partition-limits.sh \ +- t4100-dvh-partition-limits.sh \ + t4100-msdos-starting-sector.sh \ + t4200-partprobe.sh \ + t4300-nilfs2-tiny.sh \ +-- +1.8.4.2 + diff --git a/SOURCES/0024-libparted-make-sure-not-to-treat-percentages-as-exac.patch b/SOURCES/0024-libparted-make-sure-not-to-treat-percentages-as-exac.patch new file mode 100644 index 0000000..98b6490 --- /dev/null +++ b/SOURCES/0024-libparted-make-sure-not-to-treat-percentages-as-exac.patch @@ -0,0 +1,56 @@ +From 911bc52b2609ccb2cc3b123ce383b07c66d54048 Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Mon, 4 Nov 2013 13:10:09 -0500 +Subject: [PATCH] libparted: make sure not to treat percentages as exact + (#1045957) + +If 1% of the drive size worked out ot be an even power of +two, it would trigger the exact placement. Add an exception +for the percent units. +--- + NEWS | 9 +++++++++ + libparted/unit.c | 2 +- + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index e2d01ed..80a62d6 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,13 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release 3.1-16 (2014-01-22) [RHEL7] ++ ++** Bug Fixes ++ ++ If a drive was 100 times an even multiple of two, sizes specified as ++ a percentage would trigger the exact placement rule and refuse to round ++ to the nearest half percent. ++ + * Noteworthy changes in release 3.1-4 (2012-06-08) [Fedora] + + ** Bug Fixes +@@ -8,6 +16,7 @@ GNU parted NEWS -*- outline -*- + libparted: Treat disks without a PMBR as msdos labeled disks + even if they have GPT partition tables. + ++ + * Noteworthy changes in release 3.1 (2012-03-02) [stable] + + ** New features +diff --git a/libparted/unit.c b/libparted/unit.c +index 66f2b6c..265cc68 100644 +--- a/libparted/unit.c ++++ b/libparted/unit.c +@@ -548,7 +548,7 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit, + do not use 4MiB as the range. Rather, presume that they + are specifying precisely the starting or ending number, + and treat "4MiB" just as we would treat "4194304B". */ +- if (is_power_of_2 (unit_size)) ++ if (is_power_of_2 (unit_size) && unit != PED_UNIT_PERCENT) + radius = 0; + + *sector = num * unit_size / dev->sector_size; +-- +1.8.4.2 + diff --git a/SOURCES/0025-tests-Use-mkfs.xfs-to-create-files-1036152.patch b/SOURCES/0025-tests-Use-mkfs.xfs-to-create-files-1036152.patch new file mode 100644 index 0000000..d24c6f8 --- /dev/null +++ b/SOURCES/0025-tests-Use-mkfs.xfs-to-create-files-1036152.patch @@ -0,0 +1,69 @@ +From e6e0f1db4535179f25ebf8f6f0a59eb430d377ff Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 23 Jan 2014 10:09:36 -0800 +Subject: [PATCH] tests: Use mkfs.xfs to create files (#1036152) + +On s390 there is a bug with mkfs.xfs and pre-existing files. Work around +it by creating the file directly with mkfs.xfs. This also works on other +arches. + +* tests/t1700-probe-fs.sh: Check for xfs and use direct file creation +* tests/t4100-dvh-partition-limits.sh: Use mkfs.xfs -dfile +* tests/t4100-msdos-partition-limits.sh: Use mkfs.xfs -dfile +--- + tests/t1700-probe-fs.sh | 9 +++++++-- + tests/t4100-dvh-partition-limits.sh | 3 +-- + tests/t4100-msdos-partition-limits.sh | 3 +-- + 3 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 36e7cdf..575ca24 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -31,8 +31,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do + *) n_sectors=$((257*1024)) force=;; esac + + # create an $type file system +- dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1 +- mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; } ++ if [ "$type" == "xfs" ]; then ++ # Work around a problem with s390 ++ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1 ++ else ++ dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1 ++ mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; } ++ fi + + # probe the $type file system + parted -m -s $dev u s print >out 2>&1 || fail=1 +diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh +index ec6981d..88e452d 100755 +--- a/tests/t4100-dvh-partition-limits.sh ++++ b/tests/t4100-dvh-partition-limits.sh +@@ -37,8 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1 +-mkfs.xfs -f -q $fs || fail=1 ++mkfs.xfs -dfile,name=$fs,size=100m || fail=1 + mkdir "$mp" || fail=1 + + # Unmount upon interrupt, failure, etc., as well as upon normal completion. +diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh +index f03a85e..9350441 100755 +--- a/tests/t4100-msdos-partition-limits.sh ++++ b/tests/t4100-msdos-partition-limits.sh +@@ -37,8 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-dd if=/dev/zero of=$fs bs=1MB count=2 seek=100 || fail=1 +-mkfs.xfs -f -q $fs || fail=1 ++mkfs.xfs -dfile,name=$fs,size=100m || fail=1 + mkdir "$mp" || fail=1 + + # Unmount upon interrupt, failure, etc., as well as upon normal completion. +-- +1.8.4.2 + diff --git a/SOURCES/0026-Update-manpage-NAME-so-whatis-will-work-948424.patch b/SOURCES/0026-Update-manpage-NAME-so-whatis-will-work-948424.patch new file mode 100644 index 0000000..c955289 --- /dev/null +++ b/SOURCES/0026-Update-manpage-NAME-so-whatis-will-work-948424.patch @@ -0,0 +1,25 @@ +From 9dfa4ab406c45abc2f7a7e5e64ce01b4ca9977ed Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 1 Aug 2014 14:48:13 -0700 +Subject: [PATCH] Update manpage NAME so whatis will work (#948424) + +Resolves: rhbz#948424 +--- + doc/C/parted.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 689011c..5304375 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -1,6 +1,6 @@ + .TH PARTED 8 "2007 March 29" parted "GNU Parted Manual" + .SH NAME +-GNU Parted \- a partition manipulation program ++parted \- a partition manipulation program + .SH SYNOPSIS + .B parted + [options] [device [command [options...]...]] +-- +1.9.3 + diff --git a/SOURCES/0027-GPT-add-support-for-PReP-GUID-1108196.patch b/SOURCES/0027-GPT-add-support-for-PReP-GUID-1108196.patch new file mode 100644 index 0000000..163eab8 --- /dev/null +++ b/SOURCES/0027-GPT-add-support-for-PReP-GUID-1108196.patch @@ -0,0 +1,209 @@ +From cfb23fa541ada431b8225760371bb4d5029893b1 Mon Sep 17 00:00:00 2001 +From: Daniel Battaiola Kreling +Date: Mon, 7 Oct 2013 11:51:50 +0530 +Subject: [PATCH] GPT: add support for PReP GUID (#1108196) + +PReP (PowerPC Reference Platform) boot partition is the first partition used in +PowerPC platform for containing the bootable kernel or bootloader. The firmware +searches for this partition and jumps to it for booting. So far no GUID was +specified for this partition type and hence booting from GPT disk was not +supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for +PReP partition is proposed to be included in GPT. + +Resolves: rhbz#1108196 + +Signed-off-by: Brian C. Lane +--- + NEWS | 7 +++++++ + doc/parted.texi | 2 +- + libparted/labels/gpt.c | 37 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 45 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 80a62d6..4d30b1b 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,12 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release 3.1-18 (2014-08-12) [RHEL7.1] ++ ++** New features ++ ++ Add support for prep flag to GPT to select PowerPC Reference Platform ++ boot partition type. ++ + * Noteworthy changes in release 3.1-16 (2014-01-22) [RHEL7] + + ** Bug Fixes +diff --git a/doc/parted.texi b/doc/parted.texi +index 2b1ce64..f10d5e1 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -823,7 +823,7 @@ physical volume. + by the Linux/PA-RISC boot loader, palo. + + @item PREP +-(MS-DOS) - this flag can be enabled so that the partition can be used ++(MS-DOS, GPT) - this flag can be enabled so that the partition can be used + as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware. + + @item DIAG +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 6ca33c8..f9332bd 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -142,6 +142,10 @@ typedef struct + ((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \ + PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \ + { 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }}) ++#define PARTITION_PREP_GUID \ ++ ((efi_guid_t) { PED_CPU_TO_LE32 (0x9e1a2d38), PED_CPU_TO_LE16 (0xc612), \ ++ PED_CPU_TO_LE16 (0x4316), 0xaa, 0x26, \ ++ { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b }}) + + struct __attribute__ ((packed)) _GuidPartitionTableHeader_t + { +@@ -283,6 +287,7 @@ typedef struct _GPTPartitionData + int atvrecv; + int msftrecv; + int legacy_boot; ++ int prep; + } GPTPartitionData; + + static PedDiskType gpt_disk_type; +@@ -782,6 +787,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + = gpt_part_data->hidden = gpt_part_data->msftres + = gpt_part_data->msftrecv + = gpt_part_data->legacy_boot ++ = gpt_part_data->prep + = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; + + if (pte->Attributes.RequiredToFunction & 0x1) +@@ -805,6 +811,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + gpt_part_data->msftrecv = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) + gpt_part_data->atvrecv = 1; ++ else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID)) ++ gpt_part_data->prep = 1; + + return part; + } +@@ -1321,6 +1329,7 @@ gpt_partition_new (const PedDisk *disk, + gpt_part_data->msftrecv = 0; + gpt_part_data->atvrecv = 0; + gpt_part_data->legacy_boot = 0; ++ gpt_part_data->prep = 0; + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); + memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); +@@ -1394,6 +1403,11 @@ gpt_partition_set_system (PedPartition *part, + gpt_part_data->type = PARTITION_RAID_GUID; + return 1; + } ++ if (gpt_part_data->prep) ++ { ++ gpt_part_data->type = PARTITION_PREP_GUID; ++ return 1; ++ } + if (gpt_part_data->boot) + { + gpt_part_data->type = PARTITION_SYSTEM_GUID; +@@ -1564,6 +1578,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_BIOS_GRUB: +@@ -1575,6 +1590,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_RAID: +@@ -1586,6 +1602,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_LVM: +@@ -1597,6 +1614,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HPSERVICE: +@@ -1608,6 +1626,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->bios_grub + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_MSFT_RESERVED: +@@ -1619,6 +1638,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_DIAG: +@@ -1630,6 +1650,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftres ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_APPLE_TV_RECOVERY: +@@ -1641,8 +1662,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftres ++ = gpt_part_data->prep + = gpt_part_data->msftrecv = 0; + return gpt_partition_set_system (part, part->fs_type); ++ case PED_PARTITION_PREP: ++ gpt_part_data->prep = state; ++ if (state) ++ gpt_part_data->boot ++ = gpt_part_data->raid ++ = gpt_part_data->lvm ++ = gpt_part_data->bios_grub ++ = gpt_part_data->hp_service ++ = gpt_part_data->msftres ++ = gpt_part_data->msftrecv ++ = gpt_part_data->atvrecv = 0; ++ return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: + gpt_part_data->hidden = state; + return 1; +@@ -1687,6 +1721,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + return gpt_part_data->hidden; + case PED_PARTITION_LEGACY_BOOT: + return gpt_part_data->legacy_boot; ++ case PED_PARTITION_PREP: ++ return gpt_part_data->prep; + case PED_PARTITION_SWAP: + case PED_PARTITION_LBA: + case PED_PARTITION_ROOT: +@@ -1712,6 +1748,7 @@ gpt_partition_is_flag_available (const PedPartition *part, + case PED_PARTITION_APPLE_TV_RECOVERY: + case PED_PARTITION_HIDDEN: + case PED_PARTITION_LEGACY_BOOT: ++ case PED_PARTITION_PREP: + return 1; + case PED_PARTITION_SWAP: + case PED_PARTITION_ROOT: +-- +1.9.3 + diff --git a/SOURCES/0028-libparted-reread-part-table-with-0-partitions-113846.patch b/SOURCES/0028-libparted-reread-part-table-with-0-partitions-113846.patch new file mode 100644 index 0000000..137e3dc --- /dev/null +++ b/SOURCES/0028-libparted-reread-part-table-with-0-partitions-113846.patch @@ -0,0 +1,31 @@ +From 22f857bb8f57438ec6f34876e1933df01b448044 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 24 Sep 2014 15:59:47 -0700 +Subject: [PATCH] libparted: reread part table with 0 partitions (#1138465) + +After removing the last partition it still needs to be able to rescan +the partition table, otherwise device-mapper (and in this case mpath) is +never told that the last partition was removed. + +Resolves: rhbz#1138465 +--- + libparted/arch/linux.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 4af0d5c..4daa881 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2878,9 +2878,6 @@ static int + _dm_reread_part_table (PedDisk* disk) + { + int largest_partnum = ped_disk_get_last_partition_num (disk); +- if (largest_partnum <= 0) +- return 1; +- + int rc = 1; + int i; + +-- +1.9.3 + diff --git a/SOURCES/0029-tests-Change-minimum-size-to-256MiB.patch b/SOURCES/0029-tests-Change-minimum-size-to-256MiB.patch new file mode 100644 index 0000000..5fd7d06 --- /dev/null +++ b/SOURCES/0029-tests-Change-minimum-size-to-256MiB.patch @@ -0,0 +1,27 @@ +From c4bf408e794c3e2df85539e7d561da51a8ae2cad Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 7 Nov 2014 11:15:55 -0800 +Subject: [PATCH] tests: Change minimum size to 256MiB + +btrfs on ppc64 wants 136MiB so expand the minimum temp filesystem size +for the t1700-probe-fs test. +--- + tests/t1700-probe-fs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 575ca24..83e6be4 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -28,7 +28,7 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do + || { warn_ "$ME: no $type support"; continue; } + + case $type in ext*) n_sectors=8000 force=-F;; +- *) n_sectors=$((257*1024)) force=;; esac ++ *) n_sectors=$((512*1024)) force=;; esac + + # create an $type file system + if [ "$type" == "xfs" ]; then +-- +1.9.3 + diff --git a/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch b/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch new file mode 100644 index 0000000..ab6313e --- /dev/null +++ b/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch @@ -0,0 +1,117 @@ +From 535f60c9ef91cc662d5ccaecb2f7048a3c2241d9 Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Thu, 12 Jan 2012 14:53:56 -0500 +Subject: [PATCH] libparted: handle logical partitions starting immediately + after the EBR + +_blkpg_add_partition() set the length of the extended partition +to 2 sectors to allow LILO to be installed there, beacuse the +linux kernel does this. If a logical partition used that second +sector, adding it would fail beacuse of the overlap. Now +_blkpg_add_partition() will limit the length to only the first +sector if the second is used by a logical partition. + +Previously parted did create the partition table, and after a +reboot, the kernel would recognize the table, and happily create +the extended partition as 2 sectors long, thus overlapping the +logical partition, but when parted tried to recreate the same +table with BLKPG, the kernel rightly rejected it. + +(cherry picked from commit f503870153eda7659b09e52e4adeda3bebf06471) +--- + NEWS | 8 ++++++++ + libparted/arch/linux.c | 17 +++++++++++++++-- + tests/t2310-dos-extended-2-sector-min-offset.sh | 16 ++++------------ + 3 files changed, 27 insertions(+), 14 deletions(-) + +diff --git a/NEWS b/NEWS +index 4d30b1b..d1ab2a6 100644 +--- a/NEWS ++++ b/NEWS +@@ -11,6 +11,14 @@ GNU parted NEWS -*- outline -*- + + ** Bug Fixes + ++ libparted: handle logical partitions starting immediately after ++ the EBR. Creating a logical partition one sector after the EBR ++ used to cause parted to complain that it could not inform the ++ kernel of the changes, but after a reboot, everything was fine. ++ Parted will now correctly inform the kernel of the changes, but ++ only set the length of the extended partition to 1 sector instead ++ of two, which would cause it to overlap the logical partition. ++ + If a drive was 100 times an even multiple of two, sizes specified as + a percentage would trigger the exact placement rule and refuse to round + to the nearest half percent. +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 4daa881..788cdc3 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2371,8 +2371,21 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part) + memset (&linux_part, 0, sizeof (linux_part)); + linux_part.start = part->geom.start * disk->dev->sector_size; + /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ +- if (part->type & PED_PARTITION_EXTENDED) +- linux_part.length = part->geom.length == 1 ? 512 : 1024; ++ if (part->type & PED_PARTITION_EXTENDED) { ++ linux_part.length = 1; ++ if (disk->dev->sector_size == 512) { ++ if (linux_part.length == 1) ++ linux_part.length = 2; ++ PedPartition *walk; ++ /* if the second sector is claimed by a logical partition, ++ then there's just no room for lilo, so don't try to use it */ ++ for (walk = part->part_list; walk; walk = walk->next) { ++ if (walk->geom.start == part->geom.start+1) ++ linux_part.length = 1; ++ } ++ } ++ linux_part.length *= disk->dev->sector_size; ++ } + else + linux_part.length = part->geom.length * disk->dev->sector_size; + linux_part.pno = part->num; +diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh +index 89453ae..bd7defb 100644 +--- a/tests/t2310-dos-extended-2-sector-min-offset.sh ++++ b/tests/t2310-dos-extended-2-sector-min-offset.sh +@@ -1,8 +1,6 @@ + #!/bin/sh +-# Ensure that parted leaves at least 2 sectors between the beginning ++# Ensure that parted allows a single sector between the beginning + # of an extended partition and the first logical partition. +-# Before parted-2.3, it could be made to leave just one, and that +-# would cause trouble with the Linux kernel. + + # Copyright (C) 2010-2012 Free Software Foundation, Inc. + +@@ -35,7 +33,7 @@ cat < exp || framework_failure + BYT; + $scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:; + 1:64s:128s:65s:::lba; +-5:66s:128s:63s:::; ++5:65s:128s:64s:::; + EOF + + cat < err.exp || framework_failure +@@ -49,15 +47,9 @@ parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1 + parted -m -s $scsi_dev u s print + compare /dev/null out || fail=1 + +-# Provoke a failure by trying to create a partition that starts just ++# Trying to create a partition that starts just + # one sector after the start of the extended partition. +-parted --align=min -s $scsi_dev mkpart logical 65s 128s > err 2>&1 && fail=1 +-compare err.exp err || fail=1 +- +-# The above failed, but created the partition nonetheless. Remove it. +-parted -s $scsi_dev rm 5 || fail=1 +- +-parted --align=min -s $scsi_dev mkpart logical 66s 128s > out 2>&1 || fail=1 ++parted --align=min -s $scsi_dev mkpart logical 65s 128s > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + parted -m -s $scsi_dev u s print > out 2>&1 +-- +2.1.0 + diff --git a/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch b/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch new file mode 100644 index 0000000..85f9e40 --- /dev/null +++ b/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch @@ -0,0 +1,106 @@ +From 1c5b0b263f08faa0649bf673a685d93ed9319bef Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Feb 2015 16:31:00 -0800 +Subject: [PATCH 31/32] tests: Add a test for device-mapper partition sizes + (#1188431) + +device-mapper uses 512b sector units, not device specific sector sizes. +This test ensures that the correct partition size is created, no matter +what the device's sector size is. + +Related: rhbz#1188431 +--- + tests/Makefile.am | 1 + + tests/t6004-dm-512b-sectors.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 69 insertions(+) + create mode 100644 tests/t6004-dm-512b-sectors.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index faa0f37..1cf859c 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -57,6 +57,7 @@ TESTS = \ + t6001-psep.sh \ + t6002-dm-many-partitions.sh \ + t6003-dm-uuid.sh \ ++ t6004-dm-512b-sectors.sh \ + t6100-mdraid-partitions.sh \ + t7000-scripting.sh \ + t8000-loop.sh \ +diff --git a/tests/t6004-dm-512b-sectors.sh b/tests/t6004-dm-512b-sectors.sh +new file mode 100644 +index 0000000..31abba9 +--- /dev/null ++++ b/tests/t6004-dm-512b-sectors.sh +@@ -0,0 +1,68 @@ ++#!/bin/sh ++# device-mapper sector sizes are 512b, make sure partitions are the correct ++# size when using larger sector sizes and a linear dm table. ++ ++# Copyright (C) 2015 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++require_scsi_debug_module_ ++ ++grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || ++ skip_ 'this system lacks a new-enough libblkid' ++ ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++# Device maps names - should be random to not conflict with existing ones on ++# the system ++linear_=plinear-$$test ++ ++cleanup_fn_() { ++ i=0 ++ udevadm settle ++ while [ $i -lt 10 ] ; do ++ [ -e "/dev/mapper/${linear_}1" ] && dmsetup remove ${linear_}1 ++ sleep .2 ++ [ -e "/dev/mapper/$linear_" ] && dmsetup remove $linear_ ++ sleep .2 ++ [ -e "/dev/mapper/${linear_}1" -o -e "/dev/mapper/$linear_" ] || i=10 ++ i=$((i + 1)) ++ done ++ udevadm settle ++} ++ ++# Create a 500M device ++ss=$sector_size_ ++scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name || ++ skip_ 'failed to create scsi_debug device' ++scsi_dev=$(cat dev-name) ++ ++# Size of device, in 512b units ++scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure ++ ++dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure ++dev="/dev/mapper/$linear_" ++ ++# Create msdos partition table with a partition from 1MiB to 100MiB ++parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 ++compare /dev/null out || fail=1 ++ ++# The size of the partition should be 100MiB, or 204800 512b sectors ++p1_size=$(blockdev --getsz ${dev}1) || framework_failure ++[ $p1_size == 204800 ] || fail=1 ++ ++Exit $fail +-- +2.1.0 + diff --git a/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch b/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch new file mode 100644 index 0000000..4253f6e --- /dev/null +++ b/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch @@ -0,0 +1,43 @@ +From 07f2604aeeb20d187e7243007fc5ab1a0560a4b7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Feb 2015 16:46:07 -0800 +Subject: [PATCH 32/32] libparted: device mapper uses 512b sectors (#1188431) + +device mapper doesn't use the device's sector size when creating a +table. It always uses 512b units. This causes partitions to be created +8x smaller than expected on devices with 4906b sectors. + +Resolves: rhbz#1188431 +--- + libparted/arch/linux.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 788cdc3..1d11f58 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2849,8 +2849,10 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_destroy (task); + task = NULL; + ++ /* device-mapper uses 512b units, not the device's sector size */ + if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major, +- arch_specific->minor, part->geom.start))) ++ arch_specific->minor, ++ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT)))) + goto err; + + task = dm_task_create (DM_DEVICE_CREATE); +@@ -2860,7 +2862,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_set_name (task, vol_name); + if (vol_uuid) + dm_task_set_uuid (task, vol_uuid); +- dm_task_add_target (task, 0, part->geom.length, ++ /* device-mapper uses 512b units, not the device's sector size */ ++ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), + "linear", params); + if (!dm_task_set_cookie(task, &cookie, 0)) + goto err; +-- +2.1.0 + diff --git a/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch b/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch new file mode 100644 index 0000000..e4e71f2 --- /dev/null +++ b/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch @@ -0,0 +1,218 @@ +From 468d537b07c3c1ad72e1ee1e9651a17c72038837 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Thu, 6 Aug 2015 07:17:14 -0700 +Subject: [PATCH 33/35] libparted: Use read only when probing devices on linux + (#1245144) + +When a device is opened for RW closing it can trigger other actions, +like udev scanning it for partition changes. Use read only for the +init_* methods and RW for actual changes to the device. + +This adds _device_open which takes mode flags as an argument and turns +linux_open into a wrapper for it with RW_MODE. + +_device_open_ro is added to open the device with RD_MODE and increment +the open_counter. This is used in the init_* functions. + +_device_close is a wrapper around linux_close that decrements the +open_counter and is used in the init_* functions. + +All of these changes are self-contained with no external API changes. +The only visible change in behavior is that when a new PedDevice is +created the device is opened in RO_MODE instead of RW_MODE. + +Resolves: rhbz#1245144 +--- + libparted/arch/linux.c | 61 ++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 44 insertions(+), 17 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 1d11f58..341bbbb 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -287,6 +287,9 @@ struct blkdev_ioctl_param { + + static char* _device_get_part_path (PedDevice* dev, int num); + static int _partition_is_mounted_by_path (const char* path); ++static int _device_open (PedDevice* dev, int flags); ++static int _device_open_ro (PedDevice* dev); ++static int _device_close (PedDevice* dev); + + static int + _read_fd (int fd, char **buf) +@@ -830,7 +833,7 @@ init_ide (PedDevice* dev) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) { +@@ -899,11 +902,11 @@ init_ide (PedDevice* dev) + if (!_device_probe_geometry (dev)) + goto error_close_dev; + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1036,7 +1039,7 @@ init_scsi (PedDevice* dev) + char* vendor; + char* product; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + if (ioctl (arch_specific->fd, SCSI_IOCTL_GET_IDLUN, &idlun) < 0) { +@@ -1050,7 +1053,7 @@ init_scsi (PedDevice* dev) + goto error_close_dev; + if (!_device_probe_geometry (dev)) + goto error_close_dev; +- ped_device_close (dev); ++ _device_close (dev); + return 1; + } + +@@ -1072,11 +1075,11 @@ init_scsi (PedDevice* dev) + if (!_device_probe_geometry (dev)) + goto error_close_dev; + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1088,7 +1091,7 @@ init_file (PedDevice* dev) + + if (!_device_stat (dev, &dev_stat)) + goto error; +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + dev->sector_size = PED_SECTOR_SIZE_DEFAULT; +@@ -1115,7 +1118,7 @@ init_file (PedDevice* dev) + goto error_close_dev; + } + +- ped_device_close (dev); ++ _device_close (dev); + + dev->bios_geom.cylinders = dev->length / 4 / 32; + dev->bios_geom.heads = 4; +@@ -1126,7 +1129,7 @@ init_file (PedDevice* dev) + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1142,7 +1145,7 @@ init_dasd (PedDevice* dev, const char* model_name) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); +@@ -1182,11 +1185,11 @@ init_dasd (PedDevice* dev, const char* model_name) + + dev->model = strdup (model_name); + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1201,7 +1204,7 @@ init_generic (PedDevice* dev, const char* model_name) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + ped_exception_fetch_all (); +@@ -1249,11 +1252,11 @@ init_generic (PedDevice* dev, const char* model_name) + + dev->model = strdup (model_name); + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1543,12 +1546,27 @@ retry: + } + + static int ++_device_open_ro (PedDevice* dev) ++{ ++ int rc = _device_open (dev, RD_MODE); ++ if (rc) ++ dev->open_count++; ++ return rc; ++} ++ ++static int + linux_open (PedDevice* dev) + { ++ return _device_open (dev, RW_MODE); ++} ++ ++static int ++_device_open (PedDevice* dev, int flags) ++{ + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); + + retry: +- arch_specific->fd = open (dev->path, RW_MODE); ++ arch_specific->fd = open (dev->path, flags); + + if (arch_specific->fd == -1) { + char* rw_error_msg = strerror (errno); +@@ -1617,6 +1635,15 @@ linux_refresh_close (PedDevice* dev) + return 1; + } + ++static int ++_device_close (PedDevice* dev) ++{ ++ int rc = linux_close (dev); ++ if (dev->open_count > 0) ++ dev->open_count--; ++ return rc; ++} ++ + #if SIZEOF_OFF_T < 8 + + static _syscall5(int,_llseek, +-- +2.4.3 + diff --git a/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch b/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch new file mode 100644 index 0000000..a2e8563 --- /dev/null +++ b/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch @@ -0,0 +1,145 @@ +From 4182428d60496b7fe61f0599156f871e3cd63f89 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 7 Aug 2015 11:43:17 -0700 +Subject: [PATCH 34/35] tests: Use wait_for_dev_to_ functions + +Recent changes to udev have made some long-standing problems appear more +frequently. udev executes various actions when changes are made to +devices. Sometimes this can result in device nodes not appearing +immediately. Other times it can result in EBUSY being returned. This +patch only addresses devices that are slow to appear/disappear. + +It is best to use the wait_for_dev_to_appear_ and +wait_for_dev_to_disappear_ functions than to test for existance. These +will loop and wait for up to 2 seconds for it to appear. + +This also changes t9041 to fail if mkfs doesn't work since using skip +here may hide cases when the device node doesn't appear. + +Related: rhbz#1245144 +--- + tests/t1100-busy-label.sh | 10 ++-------- + tests/t6001-psep.sh | 4 ++-- + tests/t6002-dm-many-partitions.sh | 6 ++---- + tests/t6004-dm-512b-sectors.sh | 1 + + tests/t6100-mdraid-partitions.sh | 5 +++-- + tests/t9041-undetected-in-use-16th-partition.sh | 2 +- + 6 files changed, 11 insertions(+), 17 deletions(-) + +diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh +index 9e371da..93229a7 100755 +--- a/tests/t1100-busy-label.sh ++++ b/tests/t1100-busy-label.sh +@@ -27,22 +27,16 @@ dev=$(cat dev-name) + + parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 +-mkfs.vfat ${dev}1 || skip_ "mkfs.vfat failed" ++wait_for_dev_to_appear_ ${dev}1 || fail=1 ++mkfs.vfat ${dev}1 || fail=1 + + mount_point="`pwd`/mnt" + + # Be sure to unmount upon interrupt, failure, etc. + cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } + +-# There's a race condition here: on udev-based systems, the partition#1 +-# device, ${dev}1 (i.e., /dev/sdd1) is not created immediately, and +-# without some delay, this mount command would fail. Using a flash card +-# as $dev, the loop below typically iterates 7-20 times. +- + # create mount point dir. and mount the just-created partition on it + mkdir $mount_point || fail=1 +-i=0; while :; do test -e "${dev}1" && break; test $i = 90 && break; +- i=$(expr $i + 1); done; + mount "${dev}1" $mount_point || fail=1 + + # now that a partition is mounted, mklabel attempt must fail +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index 0c1ab99..b747732 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -55,7 +55,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +-test -e ${dev}p1 || fail=1 ++wait_for_dev_to_appear_ ${dev}p1 || fail=1 + + #repeat on name not ending in a digit + # setup: create a mapping +@@ -67,7 +67,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +-test -e ${dev}1 || fail=1 ++wait_for_dev_to_appear_ ${dev}1 || fail=1 + + if [ -n "$fail" ]; then + ls /dev/mapper +diff --git a/tests/t6002-dm-many-partitions.sh b/tests/t6002-dm-many-partitions.sh +index 4d08e72..247c9ee 100755 +--- a/tests/t6002-dm-many-partitions.sh ++++ b/tests/t6002-dm-many-partitions.sh +@@ -49,10 +49,8 @@ parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fa + + # Make sure all the partitions appeared under /dev/mapper/ + for ((i=1; i<=$n_partitions; i+=1)); do +- if [ ! -e "/dev/mapper/${dm_name}p$i" ]; then +- fail=1 +- break +- fi ++ wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; } ++ + # remove the partitions as we go, otherwise cleanup won't work. + dmsetup remove /dev/mapper/${dm_name}p$i + done +diff --git a/tests/t6004-dm-512b-sectors.sh b/tests/t6004-dm-512b-sectors.sh +index 31abba9..c3045af 100644 +--- a/tests/t6004-dm-512b-sectors.sh ++++ b/tests/t6004-dm-512b-sectors.sh +@@ -60,6 +60,7 @@ dev="/dev/mapper/$linear_" + # Create msdos partition table with a partition from 1MiB to 100MiB + parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 + compare /dev/null out || fail=1 ++wait_for_dev_to_appear_ ${dev}1 || fail=1 + + # The size of the partition should be 100MiB, or 204800 512b sectors + p1_size=$(blockdev --getsz ${dev}1) || framework_failure +diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh +index aedf69b..d7e7d6a 100755 +--- a/tests/t6100-mdraid-partitions.sh ++++ b/tests/t6100-mdraid-partitions.sh +@@ -54,13 +54,14 @@ parted -s $md_dev mklabel gpt \ + compare /dev/null out || fail=1 + + # Verify that kernel has been informed about the second device. +-grep "${md_name}p2" /proc/partitions || { fail=1; cat /proc/partitions; } ++wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; } + + # Remove partitions from the raid device. + parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + # Verify that kernel has been informed about those removals. +-grep "${md_name}p[12]" /proc/partitions && { fail=1; cat /proc/partitions; } ++wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; } ++wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; } + + Exit $fail +diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh +index 6ddc7d8..0b22b0e 100644 +--- a/tests/t9041-undetected-in-use-16th-partition.sh ++++ b/tests/t9041-undetected-in-use-16th-partition.sh +@@ -72,7 +72,7 @@ wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear + + partitions="${scsi_dev}14 ${scsi_dev}15 ${scsi_dev}16" + for i in $partitions; do +- mkfs.ext3 $i || skip_ mkfs.ext3 $i failed ++ mkfs.ext3 $i || fail=1 + done + + # be sure to unmount upon interrupt, failure, etc. +-- +2.4.3 + diff --git a/SOURCES/0035-tests-Add-udevadm-settle-to-wait_for_-loop-1260664.patch b/SOURCES/0035-tests-Add-udevadm-settle-to-wait_for_-loop-1260664.patch new file mode 100644 index 0000000..1ab2558 --- /dev/null +++ b/SOURCES/0035-tests-Add-udevadm-settle-to-wait_for_-loop-1260664.patch @@ -0,0 +1,119 @@ +From 0d00bd73ba85c18082cbe47dd76e2adeba7e8620 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 1 Mar 2016 10:38:26 -0800 +Subject: [PATCH] tests: Add udevadm settle to wait_for_ loop (#1260664) + +Sometimes the device will vanish after the wait_for_dev_to_appear exits. +Add udevadm settle in an attempt to make sure the udev system is done +flapping around and the device will stay in place. + +Related: rhbz#1260664 +--- + tests/t-lib-helpers.sh | 2 ++ + tests/t-local.sh | 2 ++ + tests/t6001-psep.sh | 2 ++ + tests/t6002-dm-many-partitions.sh | 1 + + tests/t6003-dm-uuid.sh | 2 ++ + tests/t6100-mdraid-partitions.sh | 1 + + 6 files changed, 10 insertions(+) + +diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh +index 4b3c122..b65d675 100644 +--- a/tests/t-lib-helpers.sh ++++ b/tests/t-lib-helpers.sh +@@ -371,6 +371,7 @@ wait_for_dev_to_appear_() + local i=0 + local incr=1 + while :; do ++ udevadm settle + ls "$file" > /dev/null 2>&1 && return 0 + sleep .1 2>/dev/null || { sleep 1; incr=10; } + i=$(expr $i + $incr); test $i = 20 && break +@@ -386,6 +387,7 @@ wait_for_dev_to_disappear_() + local i=0 + local incr=1 + while :; do ++ udevadm settle + ls "$file" > /dev/null 2>&1 || return 0 + sleep .1 2>/dev/null || { sleep 1; incr=10; } + i=$(expr $i + $incr); test $i -ge $(expr $n_sec \* 10) && break +diff --git a/tests/t-local.sh b/tests/t-local.sh +index dde1b8d..5305865 100644 +--- a/tests/t-local.sh ++++ b/tests/t-local.sh +@@ -47,6 +47,7 @@ wait_for_dev_to_appear_() + local i=0 + local incr=1 + while :; do ++ udevadm settle + ls "$file" > /dev/null 2>&1 && return 0 + sleep .1 2>/dev/null || { sleep 1; incr=10; } + i=$(expr $i + $incr); test $i = 20 && break +@@ -110,6 +111,7 @@ scsi_debug_setup_() + local i=0 + local new_dev + while :; do ++ udevadm settle + new_dev=$(new_sdX_) && break + sleep .1 2>/dev/null || { sleep 1; incr=10; } + i=$(expr $i + $incr); test $i = 20 && break +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index b747732..f22c877 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -20,6 +20,8 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + + require_root_ ++require_udevadm_settle_ ++ + (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" + + # Device maps names - should be random to not conflict with existing ones on +diff --git a/tests/t6002-dm-many-partitions.sh b/tests/t6002-dm-many-partitions.sh +index 247c9ee..13894f5 100755 +--- a/tests/t6002-dm-many-partitions.sh ++++ b/tests/t6002-dm-many-partitions.sh +@@ -20,6 +20,7 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + + require_root_ ++require_udevadm_settle_ + (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" + + ss=$sector_size_ +diff --git a/tests/t6003-dm-uuid.sh b/tests/t6003-dm-uuid.sh +index f58cb06..f51e45f 100755 +--- a/tests/t6003-dm-uuid.sh ++++ b/tests/t6003-dm-uuid.sh +@@ -20,6 +20,7 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + + require_root_ ++require_udevadm_settle_ + (dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" + + ss=$sector_size_ +@@ -46,6 +47,7 @@ for ((i=1; i<=$n_partitions; i+=1)); do + cmd="$cmd mkpart p$i ${s}s ${s}s" + done + parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1 ++wait_for_dev_to_appear_ /dev/mapper/${dm_name}p${n_partitions} || fail=1 + + # Make sure all the partitions have UUIDs + for ((i=1; i<=$n_partitions; i+=1)); do +diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh +index d7e7d6a..a74afe0 100755 +--- a/tests/t6100-mdraid-partitions.sh ++++ b/tests/t6100-mdraid-partitions.sh +@@ -38,6 +38,7 @@ parted -s "$scsi_dev" mklabel gpt \ + mkpart p1 ext2 1M 4M \ + mkpart p2 ext2 5M 8M > out 2>&1 || fail=1 + compare /dev/null out || fail=1 ++wait_for_dev_to_appear_ ${scsi_dev}2 || { fail=1; cat /proc/partitions; } + + cleanup_fn_() { + # stop mdraid array +-- +2.5.0 + diff --git a/SOURCES/0036-tests-Add-wait-to-t9042-1257415.patch b/SOURCES/0036-tests-Add-wait-to-t9042-1257415.patch new file mode 100644 index 0000000..be3d0d2 --- /dev/null +++ b/SOURCES/0036-tests-Add-wait-to-t9042-1257415.patch @@ -0,0 +1,31 @@ +From ce7a3fd5e2beeee6b0765decb77ba8ee15867342 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 1 Mar 2016 13:51:54 -0800 +Subject: [PATCH] tests: Add wait to t9042 (#1257415) + +Also make the new disklabel and first partition all in one step to +prevent udev problems. + +Resolves: rhbz#1257415 +--- + tests/t9042-dos-partition-limit.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/t9042-dos-partition-limit.sh b/tests/t9042-dos-partition-limit.sh +index 67ea86d..fb2dd72 100644 +--- a/tests/t9042-dos-partition-limit.sh ++++ b/tests/t9042-dos-partition-limit.sh +@@ -44,8 +44,8 @@ printf '%s\n' "BYT;" \ + "1:$((start-2))s:$((n-1))s:$((n-start+2))s:::lba;" \ + > exp || fail=1 + +-parted -s $scsi_dev mklabel msdos || fail=1 +-parted -s -a min $scsi_dev mkpart extended $((start-2))s 100% || fail=1 ++parted -s -a min $scsi_dev mklabel msdos mkpart extended $((start-2))s 100% || fail=1 ++wait_for_dev_to_appear_ ${scsi_dev}1 || fail=1 + + i=1 + while :; do +-- +2.5.0 + diff --git a/SOURCES/0037-tests-Fix-t1700-failing-on-a-host-with-a-4k-xfs-file.patch b/SOURCES/0037-tests-Fix-t1700-failing-on-a-host-with-a-4k-xfs-file.patch new file mode 100644 index 0000000..4fc293c --- /dev/null +++ b/SOURCES/0037-tests-Fix-t1700-failing-on-a-host-with-a-4k-xfs-file.patch @@ -0,0 +1,57 @@ +From 72ed2ef652be536c6752febf4f03cfc5d343e520 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 29 Feb 2016 14:31:35 -0800 +Subject: [PATCH] tests: Fix t1700 failing on a host with a 4k xfs filesystem + (#1260664) + +The problem is that mkfs.xfs won't work if the file it is trying to +create is on a filesystem with a sector size larger than the passed +-ssize value. So a host with 4k disks (eg. s390) and the xfs filesystem +will fail with the error message: + illegal sector size 512; hw sector is 4096 + +Failures setting up the environment for the test aren't parted bugs. +This stops treating mkfs and dd errors as test failures, skipping the fs +and logging a warning. + +Related: rhbz#1260664 +--- + tests/t1700-probe-fs.sh | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 83e6be4..2b59307 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -30,13 +30,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do + case $type in ext*) n_sectors=8000 force=-F;; + *) n_sectors=$((512*1024)) force=;; esac + +- # create an $type file system +- if [ "$type" == "xfs" ]; then +- # Work around a problem with s390 +- mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1 ++ # create an $type file system, creation failures are not parted bugs, ++ # skip the filesystem instead of failing the test. ++ if [ "$type" = "xfs" ]; then ++ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || { warn_ "$ME: mkfs.$type failed, skipping"; continue; } + else +- dd if=/dev/zero of=$dev bs=$ss count=$n_sectors >/dev/null || fail=1 +- mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; } ++ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; } ++ mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; } + fi + + # probe the $type file system +@@ -48,7 +48,7 @@ done + # Some features should indicate ext4 by themselves. + for feature in uninit_bg flex_bg; do + # create an ext3 file system +- dd if=/dev/zero of=$dev bs=1024 count=4096 >/dev/null || fail=1 ++ dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || skip_ "dd failed" + mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed" + + # set the feature +-- +2.5.0 + diff --git a/SOURCES/0038-libparted-Remove-fdasd-geometry-code-from-alloc_meta.patch b/SOURCES/0038-libparted-Remove-fdasd-geometry-code-from-alloc_meta.patch new file mode 100644 index 0000000..22bc7c3 --- /dev/null +++ b/SOURCES/0038-libparted-Remove-fdasd-geometry-code-from-alloc_meta.patch @@ -0,0 +1,48 @@ +From 9da2f460bebf9a8281fdd52536d3676b0914b8fd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 11 Apr 2016 15:10:51 -0700 +Subject: [PATCH 38/39] libparted: Remove fdasd geometry code from + alloc_metadata (#1244833) + +commit db20944f changed how the trailing_metadata_end is calculated in +dasd_alloc_metadata, removing the need for setting up the anchor struct. +But dasd_alloc_metadata can be called in various contexts, and the +arch_specific->fd may or may not be valid during these calls. This can +result in unpredictable crashes when it uses a stale fd and tries to run +the file image code in fdasd_get_geometry instead of the device code. + +The solution is to just drop the unneeded code, and to remember that +arch_specific->fd should only be used when ped_device_open has first +been called. + +Resolves: rhbz#1244833 +--- + libparted/labels/dasd.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c +index 4d533cf..5bffda7 100644 +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -950,7 +950,6 @@ dasd_alloc_metadata (PedDisk* disk) + PedPartition* part = NULL; /* initialize solely to placate gcc */ + PedPartition* new_part2; + PedSector trailing_meta_start, trailing_meta_end; +- struct fdasd_anchor anchor; + + PED_ASSERT (disk != NULL); + PED_ASSERT (disk->dev != NULL); +@@ -1000,10 +999,7 @@ dasd_alloc_metadata (PedDisk* disk) + backed up, then restored to a larger size disk, etc. + */ + trailing_meta_start = part->geom.end + 1; +- fdasd_initialize_anchor(&anchor); +- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); + trailing_meta_end = (long long) disk->dev->length - 1; +- fdasd_cleanup(&anchor); + if (trailing_meta_end >= trailing_meta_start) { + new_part2 = ped_partition_new (disk,PED_PARTITION_METADATA, + NULL, trailing_meta_start, trailing_meta_end); +-- +2.5.5 + diff --git a/SOURCES/0039-docs-Add-list-of-filesystems-for-fs-type-1311596.patch b/SOURCES/0039-docs-Add-list-of-filesystems-for-fs-type-1311596.patch new file mode 100644 index 0000000..fd629c1 --- /dev/null +++ b/SOURCES/0039-docs-Add-list-of-filesystems-for-fs-type-1311596.patch @@ -0,0 +1,29 @@ +From 8e64cda0151fa70195030d5abc0361bd3cd187bb Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 29 Feb 2016 16:47:18 -0800 +Subject: [PATCH 39/39] docs: Add list of filesystems for fs-type (#1311596) + +Add the most common filesystem types to the parted manpage. + +Resolves: rhbz#1311596 +(cherry picked from commit c9f50a36aee0a4c373b5e1bd3069aeb18fac055d) +--- + doc/C/parted.8 | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 1ea741e..03bb3a5 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -76,6 +76,8 @@ should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac", "msdos", + .B mkpart \fIpart-type\fP \fI[fs-type]\fP \fIstart\fP \fIend\fP + Make a \fIpart-type\fP partition for filesystem \fIfs-type\fP (if specified), + beginning at \fIstart\fP and ending at \fIend\fP (by default in megabytes). ++\fIfs-type\fP can be one of "btrfs", "ext2", "ext3", "ext4", "fat16", "fat32", ++"hfs", "hfs+", "linux-swap", "ntfs", "reiserfs", or "xfs". + \fIpart-type\fP should be one of "primary", "logical", or "extended". + .TP + .B name \fIpartition\fP \fIname\fP +-- +2.5.5 + diff --git a/SOURCES/0040-partprobe-Open-the-device-once-for-probing-1339705.patch b/SOURCES/0040-partprobe-Open-the-device-once-for-probing-1339705.patch new file mode 100644 index 0000000..d470578 --- /dev/null +++ b/SOURCES/0040-partprobe-Open-the-device-once-for-probing-1339705.patch @@ -0,0 +1,45 @@ +From c34f2e31d804d70332b8be9760ea3f285d480070 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 25 May 2016 09:00:04 -0700 +Subject: [PATCH] partprobe: Open the device once for probing (#1339705) + +Previously there were 3 open/close pairs for the device, which may +result in triggering extra udev actions. Instead, open it once at the +start of process_dev and close it at the end. + +Resolves: rhbz#1339705 +--- + partprobe/partprobe.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c +index 8bccc4f..c5260c6 100644 +--- a/partprobe/partprobe.c ++++ b/partprobe/partprobe.c +@@ -108,6 +108,9 @@ process_dev (PedDevice* dev) + PedDiskType* disk_type; + PedDisk* disk; + ++ if (!ped_device_open (dev)) ++ return 0; ++ + disk_type = ped_disk_probe (dev); + if (!disk_type || !strcmp (disk_type->name, "loop")) + return 1; +@@ -122,11 +125,13 @@ process_dev (PedDevice* dev) + if (opt_summary) + summary (disk); + ped_disk_destroy (disk); ++ ped_device_close (dev); + return 1; + + error_destroy_disk: + ped_disk_destroy (disk); + error: ++ ped_device_close (dev); + return 0; + } + +-- +2.5.5 + diff --git a/SOURCES/0041-tests-Stop-timing-t9040-1172675.patch b/SOURCES/0041-tests-Stop-timing-t9040-1172675.patch new file mode 100644 index 0000000..77ea916 --- /dev/null +++ b/SOURCES/0041-tests-Stop-timing-t9040-1172675.patch @@ -0,0 +1,45 @@ +From 4e729dc2d3ab4339181f59dc0a51583ecc14c7ab Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 29 Feb 2016 16:54:05 -0800 +Subject: [PATCH] tests: Stop timing t9040 (#1172675) + +parted doesn't have any control over how long this takes, there is no +reason to consider this a parted bug if it takes longer than expected. + +Resolves: rhbz#1172675 +--- + tests/t9040-many-partitions.sh | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh +index 8949310..1f8e201 100644 +--- a/tests/t9040-many-partitions.sh ++++ b/tests/t9040-many-partitions.sh +@@ -53,9 +53,7 @@ while :; do + done + + # Time the actual command: +-t0=$(date +%s.%N) + parted -m -a min -s $scsi_dev mklabel gpt $cmd u s p > out 2>&1 || fail=1 +-t_final=$(date +%s.%N) + + i=1 + while :; do +@@ -64,14 +62,6 @@ while :; do + printf "$i:${s}s:${e}s:${partition_sectors}s::p$i:;\n" >> exp + test $i = $n_partitions && break; i=$((i+1)) + done +- +-# Fail the test if it takes too long. +-# On Fedora 16, this takes about 10 seconds for me. +-# With Fedora-12-era kernels, it typically took more than 150 seconds. +-$AWK "BEGIN {d = $t_final - $t0; n = $n_partitions; st = 60 < d;"\ +-' printf "created %d partitions in %.2f seconds\n", n, d; exit st }' /dev/null \ +- || fail=1 +- + compare exp out || fail=1 + + Exit $fail +-- +2.5.5 + diff --git a/SOURCES/0042-tests-Set-optimal-blocks-to-64-for-scsi_debug-device.patch b/SOURCES/0042-tests-Set-optimal-blocks-to-64-for-scsi_debug-device.patch new file mode 100644 index 0000000..dead2e5 --- /dev/null +++ b/SOURCES/0042-tests-Set-optimal-blocks-to-64-for-scsi_debug-device.patch @@ -0,0 +1,32 @@ +From f648310fbc24186395e1864a48571982e1588435 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 23 Aug 2016 08:55:18 -0700 +Subject: [PATCH] tests: Set optimal blocks to 64 for scsi_debug devices + (#1359682) + +The Linux kernel 4.5 changed the optimal blocks count from 64 to 1024 +This causes tests using scsi_debug devices to fail because of alignment +issues. Set the opt_blks to 64 so that we have consistent behavior +across kernels. + +Resolves: rhbz#1359682 +--- + tests/t-local.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t-local.sh b/tests/t-local.sh +index 5305865..93ee0f7 100644 +--- a/tests/t-local.sh ++++ b/tests/t-local.sh +@@ -98,7 +98,7 @@ scsi_debug_setup_() + # It is not trivial to determine the name of the device we're creating. + # Record the names of all /sys/block/sd* devices *before* probing: + touch stamp +- modprobe scsi_debug "$@" || { rm -f stamp; return 1; } ++ modprobe scsi_debug opt_blks=64 "$@" || { rm -f stamp; return 1; } + scsi_debug_modprobe_succeeded_=1 + test "$VERBOSE" = yes \ + && warn_ $ME_ modprobe scsi_debug succeeded +-- +2.7.4 + diff --git a/SOURCES/0043-Add-support-for-NVMe-devices.patch b/SOURCES/0043-Add-support-for-NVMe-devices.patch new file mode 100644 index 0000000..e9b4113 --- /dev/null +++ b/SOURCES/0043-Add-support-for-NVMe-devices.patch @@ -0,0 +1,122 @@ +From 62cb6416f112dda0b0b969c1247cbc0f98314182 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Tue, 14 Jun 2016 13:17:00 +0200 +Subject: [PATCH] Add support for NVMe devices + +Recognize NVMe Devices, so "parted -s /dev/nvme0n1" now prints +"NVMe Device (nvme)" instead of "Model: Unknown (unknown)". + +In order for a device to be recognized as NVMe, it has to +have a 'blkext' major number. But since this major can be +used also by other device types, we also check the device +path contains 'nvme' as a substring. + +* NEWS: Mention the change +* include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_NVME +* libparted/arch/linux.c(BLKEXT_MAJOR): New define. +* libparted/arch/linux.c(_is_blkext_major): New function. +* libparted/arch/linux.c(_device_probe_type): Recognize NVMe devices. +* libparted/arch/linux.c(linux_new): Handle NVMe devices. +* parted/parted.c(do_print): Add "nvme" to list of transports. + +Signed-off-by: Brian C. Lane +(cherry picked from commit e4ae4330f3e33201aeeed3b7ca88e15d98d03e13) + +Resolves: rhbz#1316239 +--- + NEWS | 4 ++++ + include/parted/device.in.h | 3 ++- + libparted/arch/linux.c | 14 ++++++++++++++ + parted/parted.c | 2 +- + 4 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/NEWS b/NEWS +index d1ab2a6..d1a6f58 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,9 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release 3.1-29 (2017-04-11) [RHEL7.4] ++ ++ Parted now recognizes NVMe devices ++ + * Noteworthy changes in release 3.1-18 (2014-08-12) [RHEL7.1] + + ** New features +diff --git a/include/parted/device.in.h b/include/parted/device.in.h +index a3d1737..b0aa1f2 100644 +--- a/include/parted/device.in.h ++++ b/include/parted/device.in.h +@@ -49,7 +49,8 @@ typedef enum { + PED_DEVICE_VIRTBLK = 15, + PED_DEVICE_AOE = 16, + PED_DEVICE_MD = 17, +- PED_DEVICE_LOOP = 18 ++ PED_DEVICE_LOOP = 18, ++ PED_DEVICE_NVME = 19 + } PedDeviceType; + + typedef struct _PedDevice PedDevice; +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 341bbbb..fa329f4 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -275,6 +275,7 @@ struct blkdev_ioctl_param { + #define SDMMC_MAJOR 179 + #define LOOP_MAJOR 7 + #define MD_MAJOR 9 ++#define BLKEXT_MAJOR 259 + + #define SCSI_BLK_MAJOR(M) ( \ + (M) == SCSI_DISK0_MAJOR \ +@@ -437,6 +438,12 @@ _is_virtblk_major (int major) + return _major_type_in_devices (major, "virtblk"); + } + ++static int ++_is_blkext_major (int major) ++{ ++ return _major_type_in_devices (major, "blkext"); ++} ++ + #ifdef ENABLE_DEVICE_MAPPER + static int + _is_dm_major (int major) +@@ -600,6 +607,8 @@ _device_probe_type (PedDevice* dev) + dev->type = PED_DEVICE_LOOP; + } else if (dev_major == MD_MAJOR) { + dev->type = PED_DEVICE_MD; ++ } else if (_is_blkext_major(dev_major) && dev->path && strstr(dev->path, "nvme")) { ++ dev->type = PED_DEVICE_NVME; + } else { + dev->type = PED_DEVICE_UNKNOWN; + } +@@ -1372,6 +1381,11 @@ linux_new (const char* path) + goto error_free_arch_specific; + break; + ++ case PED_DEVICE_NVME: ++ if (!init_generic (dev, _("NVMe Device"))) ++ goto error_free_arch_specific; ++ break; ++ + case PED_DEVICE_ATARAID: + if (!init_generic (dev, _("ATARAID Controller"))) + goto error_free_arch_specific; +diff --git a/parted/parted.c b/parted/parted.c +index 789030a..957789a 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -947,7 +947,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk) + "cpqarray", "file", "ataraid", "i2o", + "ubd", "dasd", "viodasd", "sx8", "dm", + "xvd", "sd/mmc", "virtblk", "aoe", +- "md", "loopback"}; ++ "md", "loopback", "nvme"}; + + char* start = ped_unit_format (dev, 0); + PedUnit default_unit = ped_unit_get_default (); +-- +2.9.4 + diff --git a/SOURCES/0044-Document-resizepart-command.patch b/SOURCES/0044-Document-resizepart-command.patch new file mode 100644 index 0000000..80b921f --- /dev/null +++ b/SOURCES/0044-Document-resizepart-command.patch @@ -0,0 +1,65 @@ +From c051e9f7eaae007940a73be1509257bd52c569de Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Sun, 25 May 2014 14:43:39 -0400 +Subject: [PATCH 44/48] Document resizepart command + +(cherry picked from commit 5c793853fe5cb0718d895c3394fb909c73c6fa1e) + +Related: rhbz#1423357 +--- + doc/C/parted.8 | 4 ++++ + doc/parted.texi | 16 ++++++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 03bb3a5..5a24c94 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -95,6 +95,10 @@ Rescue a lost partition that was located somewhere between \fIstart\fP and + \fIend\fP. If a partition is found, \fBparted\fP will ask if you want to + create an entry for it in the partition table. + .TP ++.B resizepart \fIpartition\fP \fIend\fP ++Change the \fIend\fP position of \fIpartition\fP. Note that this does not ++modify any filesystem present in the partition. ++.TP + .B rm \fIpartition\fP + Delete \fIpartition\fP. + .TP +diff --git a/doc/parted.texi b/doc/parted.texi +index f10d5e1..d498367 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -423,6 +423,7 @@ GNU Parted provides the following commands: + * print:: + * quit:: + * rescue:: ++* resizepart:: + * rm:: + * select:: + * set:: +@@ -715,6 +716,21 @@ It's back! :) + + @end deffn + ++@node resizepart ++@subsection resizepart ++@cindex resizepart, command description ++@cindex command description, resizepart ++ ++@deffn Command resizepart @var{number} @var{end} ++ ++Moves the @var{end} position of partition @var{number}. Note that this ++does not modify any filesystem present in the partition. If you wish to ++do this, you will need to use external tools, such as @command{resize2fs}. ++ ++When growing a partition you will want to grow the filesystem afterwards, ++but when shrinking, you need to shrink the filesystem before the partition. ++@end deffn ++ + @node rm + @subsection rm + @cindex rm, command description +-- +2.9.4 + diff --git a/SOURCES/0045-parted-Add-stub-resize-command-for-backward-compatib.patch b/SOURCES/0045-parted-Add-stub-resize-command-for-backward-compatib.patch new file mode 100644 index 0000000..d77d797 --- /dev/null +++ b/SOURCES/0045-parted-Add-stub-resize-command-for-backward-compatib.patch @@ -0,0 +1,62 @@ +From 575b286502bd7338bfeeafbfc5e6ae6718b269f9 Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Tue, 8 Jan 2013 19:40:35 -0500 +Subject: [PATCH 45/48] parted: Add stub resize command for backward + compatibility + +To make sure that older scripts trying to use the resize command do not +accidentally run the new resizepart command by mistake, this undocumented +stub command will throw an error if called. + +(cherry picked from commit 56bfbe21ecca0cb6466c78baed192dc2e5401676) + +Related: rhbz#1423357 +--- + parted/parted.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/parted/parted.c b/parted/parted.c +index 957789a..d4a397b 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1478,6 +1478,16 @@ error: + } + + static int ++do_resize (PedDevice **dev, PedDisk** diskp) ++{ ++ ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_CANCEL, ++ _("The resize command has been removed in parted 3.0")); ++ return 0; ++} ++ ++static int + do_rm (PedDevice** dev) + { + PedDisk* disk; +@@ -1891,6 +1901,20 @@ NULL), + str_list_create (_(start_end_msg), NULL), 1)); + + command_register (commands, command_create ( ++ str_list_create_unique ("resize", _("resize"), NULL), ++ do_resize, ++ NULL, ++ str_list_create (_(N_("The resize command was removed in parted 3.0\n")), NULL), 1)); ++ ++command_register (commands, command_create ( ++ str_list_create_unique ("resizepart", _("resizepart"), NULL), ++ do_resizepart, ++ str_list_create ( ++_("resizepart NUMBER END resize partition NUMBER"), ++NULL), ++ str_list_create (_(number_msg), _(end_msg), NULL), 1)); ++ ++command_register (commands, command_create ( + str_list_create_unique ("rm", _("rm"), NULL), + do_rm, + str_list_create ( +-- +2.9.4 + diff --git a/SOURCES/0046-libparted-Backport-partition-resize-code.patch b/SOURCES/0046-libparted-Backport-partition-resize-code.patch new file mode 100644 index 0000000..5b054ce --- /dev/null +++ b/SOURCES/0046-libparted-Backport-partition-resize-code.patch @@ -0,0 +1,842 @@ +From 31ab97cfe0233191a73a1dd9cb7cd193451491da Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 11 Aug 2017 08:37:11 -0700 +Subject: [PATCH 46/48] libparted: Backport partition resize code + +This adds _blkpg_resize_partition, _dm_resize_partition, and adjust the +current code to support it. Changes are somewhat extensive, since they +also touch _disk_sync_part_table. + +This is based on code from commit f09ca967a0bc443b869a6fad5b5ffe8e95c3fe9a + +Related: rhbz#1423357 +--- + libparted/arch/linux.c | 673 +++++++++++++++++++++++++++++-------------------- + 1 file changed, 403 insertions(+), 270 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index fa329f4..6e78faf 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -288,6 +288,7 @@ struct blkdev_ioctl_param { + + static char* _device_get_part_path (PedDevice* dev, int num); + static int _partition_is_mounted_by_path (const char* path); ++static unsigned int _device_get_partition_range(PedDevice const* dev); + static int _device_open (PedDevice* dev, int flags); + static int _device_open_ro (PedDevice* dev); + static int _device_close (PedDevice* dev); +@@ -446,6 +447,17 @@ _is_blkext_major (int major) + + #ifdef ENABLE_DEVICE_MAPPER + static int ++_dm_task_run_wait (struct dm_task *task, uint32_t cookie) ++{ ++ int rc = 0; ++ ++ rc = dm_task_run (task); ++ dm_udev_wait (cookie); ++ ++ return rc; ++} ++ ++static int + _is_dm_major (int major) + { + return _major_type_in_devices (major, "device-mapper"); +@@ -1521,6 +1533,7 @@ _flush_cache (PedDevice* dev) + { + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); + int i; ++ int lpn = _device_get_partition_range(dev); + + if (dev->read_only) + return; +@@ -1532,7 +1545,7 @@ _flush_cache (PedDevice* dev) + if (_have_kern26()) + return; + +- for (i = 1; i < 16; i++) { ++ for (i = 1; i < lpn; i++) { + char* name; + int fd; + +@@ -2268,28 +2281,63 @@ zasprintf (const char *format, ...) + return r < 0 ? NULL : resultp; + } + ++#ifdef ENABLE_DEVICE_MAPPER ++static char * ++dm_canonical_path (PedDevice const *dev) ++{ ++ LinuxSpecific const *arch_specific = LINUX_SPECIFIC (dev); ++ ++ /* Get map name from devicemapper */ ++ struct dm_task *task = dm_task_create (DM_DEVICE_INFO); ++ if (!task) ++ goto err; ++ if (!dm_task_set_major_minor (task, arch_specific->major, ++ arch_specific->minor, 0)) ++ goto err; ++ if (!dm_task_run(task)) ++ goto err; ++ char *dev_name = zasprintf ("/dev/mapper/%s", dm_task_get_name (task)); ++ if (dev_name == NULL) ++ goto err; ++ dm_task_destroy (task); ++ return dev_name; ++err: ++ return NULL; ++} ++#endif ++ + static char* + _device_get_part_path (PedDevice *dev, int num) + { +- size_t path_len = strlen (dev->path); +- ++ char *devpath; ++ size_t path_len; + char *result; ++#ifdef ENABLE_DEVICE_MAPPER ++ devpath = (dev->type == PED_DEVICE_DM ++ ? dm_canonical_path (dev) : dev->path); ++#else ++ devpath = dev->path; ++#endif ++ path_len = strlen (devpath); + /* Check for devfs-style /disc => /partN transformation + unconditionally; the system might be using udev with devfs rules, + and if not the test is harmless. */ +- if (5 < path_len && !strcmp (dev->path + path_len - 5, "/disc")) { ++ if (5 < path_len && !strcmp (devpath + path_len - 5, "/disc")) { + /* replace /disc with /part%d */ + result = zasprintf ("%.*s/part%d", +- (int) (path_len - 5), dev->path, num); ++ (int) (path_len - 5), devpath, num); + } else { + char const *p = (dev->type == PED_DEVICE_DAC960 + || dev->type == PED_DEVICE_CPQARRAY + || dev->type == PED_DEVICE_ATARAID + || isdigit (dev->path[path_len - 1]) + ? "p" : ""); +- result = zasprintf ("%s%s%d", dev->path, p, num); ++ result = zasprintf ("%s%s%d", devpath, p, num); + } +- ++#ifdef ENABLE_DEVICE_MAPPER ++ if (dev->type == PED_DEVICE_DM) ++ free (devpath); ++#endif + return result; + } + +@@ -2438,6 +2486,62 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part) + + if (!_blkpg_part_command (disk->dev, &linux_part, + BLKPG_ADD_PARTITION)) { ++ return 0; ++ } ++ ++ return 1; ++} ++ ++static int ++_blkpg_remove_partition (PedDisk* disk, int n) ++{ ++ struct blkpg_partition linux_part; ++ ++ memset (&linux_part, 0, sizeof (linux_part)); ++ linux_part.pno = n; ++ return _blkpg_part_command (disk->dev, &linux_part, ++ BLKPG_DEL_PARTITION); ++} ++ ++#ifdef BLKPG_RESIZE_PARTITION ++static int _blkpg_resize_partition (PedDisk* disk, const PedPartition *part) ++{ ++ struct blkpg_partition linux_part; ++ char* dev_name; ++ ++ PED_ASSERT(disk != NULL); ++ PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0); ++ ++ dev_name = _device_get_part_path (disk->dev, part->num); ++ if (!dev_name) ++ return 0; ++ memset (&linux_part, 0, sizeof (linux_part)); ++ linux_part.start = part->geom.start * disk->dev->sector_size; ++ /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ ++ if (part->type & PED_PARTITION_EXTENDED) { ++ if (disk->dev->sector_size == 512) { ++ linux_part.length = 2; ++ PedPartition *walk; ++ /* if the second sector is claimed by a logical partition, ++ then there's just no room for lilo, so don't try to use it */ ++ for (walk = part->part_list; walk; walk = walk->next) { ++ if (walk->geom.start == part->geom.start+1) ++ linux_part.length = 1; ++ } ++ } else { ++ linux_part.length = 1; ++ } ++ linux_part.length *= disk->dev->sector_size; ++ } ++ else ++ linux_part.length = part->geom.length * disk->dev->sector_size; ++ linux_part.pno = part->num; ++ strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH); ++ ++ free (dev_name); ++ ++ if (!_blkpg_part_command (disk->dev, &linux_part, ++ BLKPG_RESIZE_PARTITION)) { + return ped_exception_throw ( + PED_EXCEPTION_ERROR, + PED_EXCEPTION_IGNORE_CANCEL, +@@ -2454,17 +2558,7 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part) + + return 1; + } +- +-static int +-_blkpg_remove_partition (PedDisk* disk, int n) +-{ +- struct blkpg_partition linux_part; +- +- memset (&linux_part, 0, sizeof (linux_part)); +- linux_part.pno = n; +- return _blkpg_part_command (disk->dev, &linux_part, +- BLKPG_DEL_PARTITION); +-} ++#endif + + /* Read the integer from /sys/block/DEV_BASE/ENTRY and set *VAL + to that value, where DEV_BASE is the last component of DEV->path. +@@ -2586,6 +2680,8 @@ static unsigned int + _device_get_partition_range(PedDevice const* dev) + { + int range; ++ if (dev->type == PED_DEVICE_DM) ++ return MAX_NUM_PARTS; + bool ok = _sysfs_int_entry_from_dev(dev, "ext_range", &range); + + if (!ok) +@@ -2594,264 +2690,78 @@ _device_get_partition_range(PedDevice const* dev) + return range > 1 ? range : 0; + } + +-/* +- * Sync the partition table in two step process: +- * 1. Remove all of the partitions from the kernel's tables, but do not attempt +- * removal of any partition for which the corresponding ioctl call fails. +- * 2. Add all the partitions that we hold in disk, throwing a warning +- * if we cannot because step 1 failed to remove it and it is not being +- * added back with the same start and length. +- * +- * To achieve this two step process we must calculate the minimum number of +- * maximum possible partitions between what linux supports and what the label +- * type supports. EX: +- * +- * number=MIN(max_parts_supported_in_linux,max_parts_supported_in_msdos_tables) +- */ +-static int +-_disk_sync_part_table (PedDisk* disk) +-{ +- PED_ASSERT(disk != NULL); +- PED_ASSERT(disk->dev != NULL); +- int lpn; +- +- unsigned int part_range = _device_get_partition_range(disk->dev); +- +- /* lpn = largest partition number. */ +- if (ped_disk_get_max_supported_partition_count(disk, &lpn)) +- lpn = PED_MIN(lpn, part_range); +- else +- lpn = part_range; +- +- /* Its not possible to support largest_partnum < 0. +- * largest_partnum == 0 would mean does not support partitions. +- * */ +- if (lpn < 1) +- return 0; +- int ret = 0; +- int *ok = calloc (lpn, sizeof *ok); +- if (!ok) +- return 0; +- int *errnums = ped_malloc(sizeof(int) * lpn); +- if (!errnums) +- goto cleanup; +- +- /* Attempt to remove each and every partition, retrying for +- up to max_sleep_seconds upon any failure due to EBUSY. */ +- unsigned int sleep_microseconds = 10000; +- unsigned int max_sleep_seconds = 1; +- unsigned int n_sleep = (max_sleep_seconds +- * 1000000 / sleep_microseconds); +- int i; +- for (i = 0; i < n_sleep; i++) { +- if (i) +- usleep (sleep_microseconds); +- bool busy = false; +- int j; +- for (j = 0; j < lpn; j++) { +- if (!ok[j]) { +- ok[j] = _blkpg_remove_partition (disk, j + 1); +- errnums[j] = errno; +- if (!ok[j] && errnums[j] == EBUSY) +- busy = true; +- } +- } +- if (!busy) +- break; +- } +- +- for (i = 1; i <= lpn; i++) { +- PedPartition *part = ped_disk_get_partition (disk, i); +- if (part) { +- if (!ok[i - 1] && errnums[i - 1] == EBUSY) { +- unsigned long long length; +- unsigned long long start; +- /* get start and length of existing partition */ +- if (!_kernel_get_partition_start_and_length(part, +- &start, &length)) +- goto cleanup; +- if (start == part->geom.start +- && length == part->geom.length) +- ok[i - 1] = 1; +- /* If the new partition is unchanged and the +- existing one was not removed because it was +- in use, then reset the error flag and do not +- try to add it since it is already there. */ +- continue; +- } +- +- /* add the (possibly modified or new) partition */ +- if (!_blkpg_add_partition (disk, part)) { +- ped_exception_throw ( +- PED_EXCEPTION_ERROR, +- PED_EXCEPTION_RETRY_CANCEL, +- _("Failed to add partition %d (%s)"), +- i, strerror (errno)); +- goto cleanup; +- } +- } +- } +- +- char *bad_part_list = NULL; +- /* now warn about any errors */ +- for (i = 1; i <= lpn; i++) { +- if (ok[i - 1] || errnums[i - 1] == ENXIO) +- continue; +- if (bad_part_list == NULL) { +- bad_part_list = malloc (lpn * 5); +- if (!bad_part_list) +- goto cleanup; +- bad_part_list[0] = 0; +- } +- sprintf (bad_part_list + strlen (bad_part_list), "%d, ", i); +- } +- if (bad_part_list == NULL) +- ret = 1; +- else { +- bad_part_list[strlen (bad_part_list) - 2] = 0; +- if (ped_exception_throw ( +- PED_EXCEPTION_ERROR, +- PED_EXCEPTION_IGNORE_CANCEL, +- _("Partition(s) %s on %s have been written, but we have " +- "been unable to inform the kernel of the change, " +- "probably because it/they are in use. As a result, " +- "the old partition(s) will remain in use. You " +- "should reboot now before making further changes."), +- bad_part_list, disk->dev->path) == PED_EXCEPTION_IGNORE) +- ret = 1; +- free (bad_part_list); +- } +- cleanup: +- free (errnums); +- free (ok); +- return ret; +-} +- + #ifdef ENABLE_DEVICE_MAPPER + static int +-_dm_remove_map_name(char *name) ++_dm_remove_partition(PedDisk* disk, int partno) + { +- struct dm_task *task = NULL; + int rc = 0; + uint32_t cookie = 0; ++ char *part_name = _device_get_part_path (disk->dev, partno); + +- task = dm_task_create(DM_DEVICE_REMOVE); ++ int fd = open (part_name, O_RDONLY | O_EXCL); ++ if (fd == -1) { ++ if (errno == ENOENT) ++ errno = ENXIO; /* nothing to remove, device already doesn't exist */ ++ goto err; ++ } ++ close (fd); ++ struct dm_task *task = dm_task_create(DM_DEVICE_REMOVE); + if (!task) +- return 1; +- +- dm_task_set_name (task, name); +- if (!dm_task_set_cookie(task, &cookie, 0)) +- goto err; +- +- rc = dm_task_run(task); +- dm_udev_wait(cookie); ++ goto err; ++ dm_task_set_name (task, part_name); ++ if (!dm_task_set_cookie (task, &cookie, 0)) ++ goto err; ++ rc = _dm_task_run_wait (task, cookie); + dm_task_update_nodes(); +-err: + dm_task_destroy(task); +- if (!rc) +- return 1; +- +- return 0; ++err: ++ free (part_name); ++ return rc; + } + +-static int +-_dm_is_part (struct dm_info *this, char *name) ++static bool ++_dm_get_partition_start_and_length(PedPartition const *part, ++ unsigned long long *start, ++ unsigned long long *length) + { + struct dm_task* task = NULL; +- struct dm_info* info = alloca(sizeof *info); +- struct dm_deps* deps = NULL; + int rc = 0; +- unsigned int i; + +- task = dm_task_create(DM_DEVICE_DEPS); +- if (!task) ++ if (!(task = dm_task_create(DM_DEVICE_TABLE))) + return 0; +- +- dm_task_set_name(task, name); +- if (!dm_task_run(task)) ++ char *path = _device_get_part_path (part->disk->dev, part->num); ++ PED_ASSERT(path); ++ /* libdevmapper likes to complain on stderr instead of quietly ++ returning ENOENT or ENXIO, so try to stat first */ ++ struct stat st; ++ if (stat(path, &st)) + goto err; +- +- memset(info, '\0', sizeof *info); +- dm_task_get_info(task, info); +- if (!info->exists) ++ dm_task_set_name(task, path); ++ if (!dm_task_run(task)) + goto err; + +- deps = dm_task_get_deps(task); +- if (!deps) ++ int major, minor; ++ char *params; ++ char *target_type; ++ dm_get_next_target(task, NULL, (uint64_t *)start, (uint64_t *)length, &target_type, ¶ms); ++ if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3) + goto err; ++ rc = 1; + +- for (i = 0; i < deps->count; i++) { +- unsigned int ma = major(deps->device[i]), +- mi = minor(deps->device[i]); +- +- if (ma == this->major && mi == this->minor) +- rc = 1; +- } +- ++ /* device-mapper uses 512b units, make sure we return length and start in terms of the device's ++ * sector size. ++ */ ++ *start /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT); ++ *length /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT); + err: ++ free (path); + dm_task_destroy(task); + return rc; + } + +-static int +-_dm_remove_parts (PedDevice* dev) +-{ +- struct dm_task* task = NULL; +- struct dm_info* info = alloca(sizeof *info); +- struct dm_names* names = NULL; +- unsigned int next = 0; +- int rc; +- LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); +- +- task = dm_task_create(DM_DEVICE_LIST); +- if (!task) +- goto err; +- +- if (!dm_task_set_major_minor (task, arch_specific->major, +- arch_specific->minor, 0)) +- goto err; +- +- if (!dm_task_run(task)) +- goto err; +- +- memset(info, '\0', sizeof *info); +- dm_task_get_info(task, info); +- if (!info->exists) +- goto err; +- +- names = dm_task_get_names(task); +- if (!names) +- goto err; +- +- rc = 0; +- do { +- names = (void *) ((char *) names + next); +- +- if (_dm_is_part(info, names->name)) +- rc += _dm_remove_map_name(names->name); +- +- next = names->next; +- } while (next); +- +- dm_task_update_nodes(); +- dm_task_destroy(task); +- task = NULL; +- +- if (!rc) +- return 1; +-err: +- if (task) +- dm_task_destroy(task); +- ped_exception_throw (PED_EXCEPTION_WARNING, PED_EXCEPTION_IGNORE, +- _("parted was unable to re-read the partition " +- "table on %s (%s). This means Linux won't know " +- "anything about the modifications you made. "), +- dev->path, strerror (errno)); +- return 0; +-} + + static int +-_dm_add_partition (PedDisk* disk, PedPartition* part) ++_dm_add_partition (PedDisk* disk, const PedPartition* part) + { + char* vol_name = NULL; + const char* dev_name = NULL; +@@ -2908,9 +2818,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + "linear", params); + if (!dm_task_set_cookie(task, &cookie, 0)) + goto err; +- if (dm_task_run (task)) { ++ if (_dm_task_run_wait (task, cookie)) { + //printf("0 %ld linear %s\n", part->geom.length, params); +- dm_udev_wait(cookie); + dm_task_update_nodes(); + dm_task_destroy(task); + free(params); +@@ -2918,8 +2827,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + free(vol_name); + return 1; + } else { +- dm_udev_wait(cookie); +- _dm_remove_map_name(vol_name); ++ _dm_remove_partition (disk, part->num); + } + err: + dm_task_update_nodes(); +@@ -2932,30 +2840,259 @@ err: + } + + static int +-_dm_reread_part_table (PedDisk* disk) ++_dm_resize_partition (PedDisk* disk, const PedPartition* part) + { +- int largest_partnum = ped_disk_get_last_partition_num (disk); +- int rc = 1; +- int i; ++ LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); ++ char* params = NULL; ++ char* vol_name = NULL; ++ const char* dev_name = NULL; ++ uint32_t cookie = 0; ++ int rc = 0; + +- sync(); +- if (!_dm_remove_parts(disk->dev)) +- rc = 0; ++ /* Get map name from devicemapper */ ++ struct dm_task *task = dm_task_create (DM_DEVICE_INFO); ++ if (!task) ++ goto err; + +- for (i = 1; i <= largest_partnum; i++) { +- PedPartition* part; ++ if (!dm_task_set_major_minor (task, arch_specific->major, ++ arch_specific->minor, 0)) ++ goto err; + +- part = ped_disk_get_partition (disk, i); +- if (!part) +- continue; ++ if (!dm_task_run(task)) ++ goto err; ++ ++ dev_name = dm_task_get_name (task); ++ size_t name_len = strlen (dev_name); ++ vol_name = zasprintf ("%s%s%d", ++ dev_name, ++ isdigit (dev_name[name_len - 1]) ? "p" : "", ++ part->num); ++ if (vol_name == NULL) ++ goto err; ++ ++ /* Caution: dm_task_destroy frees dev_name. */ ++ dm_task_destroy (task); ++ task = NULL; ++ ++ /* device-mapper uses 512b units, not the device's sector size */ ++ if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major, ++ arch_specific->minor, ++ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT)))) ++ goto err; ++ ++ task = dm_task_create (DM_DEVICE_RELOAD); ++ if (!task) ++ goto err; + +- if (!_dm_add_partition (disk, part)) +- rc = 0; ++ dm_task_set_name (task, vol_name); ++ /* device-mapper uses 512b units, not the device's sector size */ ++ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), ++ "linear", params); ++ /* NOTE: DM_DEVICE_RELOAD doesn't generate udev events, so no cookie is needed (it will freeze). ++ * DM_DEVICE_RESUME does, so get a cookie and synchronize with udev. ++ */ ++ if (dm_task_run (task)) { ++ dm_task_destroy (task); ++ task = dm_task_create (DM_DEVICE_RESUME); ++ if (!task) ++ goto err; ++ dm_task_set_name (task, vol_name); ++ if (!dm_task_set_cookie (task, &cookie, 0)) ++ goto err; ++ if (_dm_task_run_wait (task, cookie)) { ++ rc = 1; ++ } + } ++err: ++ dm_task_update_nodes(); ++ if (task) ++ dm_task_destroy (task); ++ free (params); ++ free (vol_name); + return rc; + } ++ + #endif + ++/* ++ * Sync the partition table in two step process: ++ * 1. Remove all of the partitions from the kernel's tables, but do not attempt ++ * removal of any partition for which the corresponding ioctl call fails. ++ * 2. Add all the partitions that we hold in disk, throwing a warning ++ * if we cannot because step 1 failed to remove it and it is not being ++ * added back with the same start and length. ++ * ++ * To achieve this two step process we must calculate the minimum number of ++ * maximum possible partitions between what linux supports and what the label ++ * type supports. EX: ++ * ++ * number=MIN(max_parts_supported_in_linux,max_parts_supported_in_msdos_tables) ++ */ ++static int ++_disk_sync_part_table (PedDisk* disk) ++{ ++ PED_ASSERT(disk != NULL); ++ PED_ASSERT(disk->dev != NULL); ++ int lpn, lpn2; ++ unsigned int part_range = _device_get_partition_range(disk->dev); ++ int (*add_partition)(PedDisk* disk, const PedPartition *part); ++ int (*resize_partition)(PedDisk* disk, const PedPartition *part); ++ int (*remove_partition)(PedDisk* disk, int partno); ++ bool (*get_partition_start_and_length)(PedPartition const *part, ++ unsigned long long *start, ++ unsigned long long *length); ++ ++ ++#ifdef ENABLE_DEVICE_MAPPER ++ if (disk->dev->type == PED_DEVICE_DM) { ++ add_partition = _dm_add_partition; ++ remove_partition = _dm_remove_partition; ++ resize_partition = _dm_resize_partition; ++ get_partition_start_and_length = _dm_get_partition_start_and_length; ++ } else ++#endif ++ { ++ add_partition = _blkpg_add_partition; ++ remove_partition = _blkpg_remove_partition; ++#ifdef BLKPG_RESIZE_PARTITION ++ resize_partition = _blkpg_resize_partition; ++#else ++ resize_partition = NULL; ++#endif ++ get_partition_start_and_length = _kernel_get_partition_start_and_length; ++ } ++ ++ /* lpn = largest partition number. ++ * for remove pass, use greater of device or label limit */ ++ if (ped_disk_get_max_supported_partition_count(disk, &lpn)) ++ lpn = PED_MAX(lpn, part_range); ++ else ++ lpn = part_range; ++ /* for add pass, use lesser of device or label limit */ ++ if (ped_disk_get_max_supported_partition_count(disk, &lpn2)) ++ lpn2 = PED_MIN(lpn2, part_range); ++ else ++ lpn2 = part_range; ++ /* Its not possible to support largest_partnum < 0. ++ * largest_partnum == 0 would mean does not support partitions. ++ * */ ++ if (lpn < 1) ++ return 0; ++ int ret = 0; ++ int *ok = calloc (lpn, sizeof *ok); ++ if (!ok) ++ return 0; ++ int *errnums = ped_malloc(sizeof(int) * lpn); ++ if (!errnums) ++ goto cleanup; ++ ++ int i; ++ /* remove old partitions first */ ++ for (i = 1; i <= lpn; i++) { ++ PedPartition *part = ped_disk_get_partition (disk, i); ++ if (part) { ++ unsigned long long length; ++ unsigned long long start; ++ /* get start and length of existing partition */ ++ if (get_partition_start_and_length(part, ++ &start, &length) ++ && start == part->geom.start ++ && (length == part->geom.length ++ || (resize_partition && part->num < lpn2))) ++ { ++ /* partition is unchanged, or will be resized so nothing to do */ ++ ok[i - 1] = 1; ++ continue; ++ } ++ } ++ /* Attempt to remove the partition, retrying for ++ up to max_sleep_seconds upon any failure due to EBUSY. */ ++ unsigned int sleep_microseconds = 10000; ++ unsigned int max_sleep_seconds = 1; ++ unsigned int n_sleep = (max_sleep_seconds ++ * 1000000 / sleep_microseconds); ++ do { ++ ok[i - 1] = remove_partition (disk, i); ++ errnums[i - 1] = errno; ++ if (ok[i - 1] || errnums[i - 1] != EBUSY) ++ break; ++ usleep (sleep_microseconds); ++ } while (n_sleep--); ++ if (!ok[i - 1] && errnums[i - 1] == ENXIO) ++ ok[i - 1] = 1; /* it already doesn't exist */ ++ } ++ lpn = lpn2; ++ /* don't actually add partitions for loop */ ++ if (strcmp (disk->type->name, "loop") == 0) ++ lpn = 0; ++ for (i = 1; i <= lpn; i++) { ++ PedPartition *part = ped_disk_get_partition (disk, i); ++ if (!part) ++ continue; ++ unsigned long long length; ++ unsigned long long start; ++ /* get start and length of existing partition */ ++ if (get_partition_start_and_length(part, ++ &start, &length) ++ && start == part->geom.start) ++ { ++ if (length == part->geom.length) { ++ ok[i - 1] = 1; ++ /* partition is unchanged, so nothing to do */ ++ continue; ++ } ++ if (resize_partition ++ && start == part->geom.start) ++ { ++ /* try to resize */ ++ if (resize_partition (disk, part)) { ++ ok[i - 1] = 1; ++ continue; ++ } ++ } ++ } ++ /* add the (possibly modified or new) partition */ ++ if (!add_partition (disk, part)) { ++ ok[i - 1] = 0; ++ errnums[i - 1] = errno; ++ } ++ } ++ ++ char *bad_part_list = NULL; ++ /* now warn about any errors */ ++ for (i = 1; i <= lpn; i++) { ++ if (ok[i - 1] || errnums[i - 1] == ENXIO) ++ continue; ++ if (bad_part_list == NULL) { ++ bad_part_list = malloc (lpn * 5); ++ if (!bad_part_list) ++ goto cleanup; ++ bad_part_list[0] = 0; ++ } ++ sprintf (bad_part_list + strlen (bad_part_list), "%d, ", i); ++ } ++ if (bad_part_list == NULL) ++ ret = 1; ++ else { ++ bad_part_list[strlen (bad_part_list) - 2] = 0; ++ if (ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_IGNORE_CANCEL, ++ _("Partition(s) %s on %s have been written, but we have " ++ "been unable to inform the kernel of the change, " ++ "probably because it/they are in use. As a result, " ++ "the old partition(s) will remain in use. You " ++ "should reboot now before making further changes."), ++ bad_part_list, disk->dev->path) == PED_EXCEPTION_IGNORE) ++ ret = 1; ++ free (bad_part_list); ++ } ++ cleanup: ++ free (errnums); ++ free (ok); ++ return ret; ++} ++ + static int + _have_blkpg () + { +@@ -2973,10 +3110,6 @@ _have_blkpg () + static int + linux_disk_commit (PedDisk* disk) + { +-#ifdef ENABLE_DEVICE_MAPPER +- if (disk->dev->type == PED_DEVICE_DM) +- return _dm_reread_part_table (disk); +-#endif + if (disk->dev->type != PED_DEVICE_FILE) { + + /* We now require BLKPG support. If this assertion fails, +-- +2.9.4 + diff --git a/SOURCES/0047-tests-excersise-resize-command.patch b/SOURCES/0047-tests-excersise-resize-command.patch new file mode 100644 index 0000000..c8e2932 --- /dev/null +++ b/SOURCES/0047-tests-excersise-resize-command.patch @@ -0,0 +1,124 @@ +From f1711f8bd420315a01b2df6d4339646c96169558 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Tue, 27 Sep 2011 09:11:29 +0200 +Subject: [PATCH 47/48] tests: excersise resize command + +a lot of TODOs + +(cherry picked from commit 33fd692cb14045fdc13306cd57cfe2040328daa8) +--- + tests/Makefile.am | 1 + + tests/t3200-resize-partition.sh | 89 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 90 insertions(+) + create mode 100755 tests/t3200-resize-partition.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 1cf859c..29fa280 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -42,6 +42,7 @@ TESTS = \ + t2400-dos-hfs-partition-type.sh \ + t2500-probe-corrupt-hfs.sh \ + t3000-resize-fs.sh \ ++ t3200-resize-partition.sh \ + t3200-type-change.sh \ + t3300-palo-prep.sh \ + t3310-flags.sh \ +diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh +new file mode 100755 +index 0000000..251b545 +--- /dev/null ++++ b/tests/t3200-resize-partition.sh +@@ -0,0 +1,89 @@ ++#!/bin/sh ++# exercise the resize sub-command ++# based on t3000-resize-fs.sh test ++ ++# Copyright (C) 2009-2011 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++require_scsi_debug_module_ ++ ++ss=$sector_size_ ++ ++default_start=1024s ++default_end=2048s ++ ++# create memory-backed device ++scsi_debug_setup_ dev_size_mb=5 > dev-name || ++ skip_ 'failed to create scsi_debug device' ++dev=$(cat dev-name) ++ ++# TODO test simple shrink ++# TODO test expand past end of the disk ++# TODO test expand past begin of next partition ++# TODO test shrink before start ++# TODO test everything with GPT ++# TODO more tests with extended/logical partitions ++ ++parted -s $dev mklabel msdos > out 2> err || fail=1 ++# expect no output ++compare /dev/null out || fail=1 ++compare /dev/null err || fail=1 ++ ++# ensure that the disk is large enough ++dev_n_sectors=$(parted -s $dev u s p|sed -n '2s/.* \([0-9]*\)s$/\1/p') ++device_sectors_required=$(echo $default_end | sed 's/s$//') ++# Ensure that $dev is large enough for this test ++test $device_sectors_required -le $dev_n_sectors || fail=1 ++ ++# create an empty partition ++parted -a minimal -s $dev mkpart primary $default_start $default_end > out 2>&1 || fail=1 ++compare /dev/null out || fail=1 ++ ++# print partition table ++parted -m -s $dev u s p > out 2>&1 || fail=1 ++ ++# FIXME: check expected output ++ ++# wait for new partition device to appear ++wait_for_dev_to_appear_ ${dev}1 || { warn_ "${dev}1 did not appear" fail=1; } ++sleep 1 ++ ++ ++# extend the filesystem to end on sector 4096 ++new_end=4096s ++parted -s $dev resizepart 1 $new_end > out 2> err || fail=1 ++# expect no output ++compare /dev/null out || fail=1 ++compare /dev/null err || fail=1 ++ ++# print partition table ++parted -m -s $dev u s p > out 2>&1 || fail=1 ++ ++sed -n 3p out > k && mv k out || fail=1 ++printf "1:$default_start:$new_end:3073s:::$ms;\n" > exp || fail=1 ++compare exp out || fail=1 ++ ++# Remove the partition explicitly, so that mklabel doesn't evoke a warning. ++parted -s $dev rm 1 || fail=1 ++ ++# Create a clean partition table for the next iteration. ++parted -s $dev mklabel msdos > out 2>&1 || fail=1 ++# expect no output ++compare /dev/null out || fail=1 ++ ++Exit $fail +-- +2.9.4 + diff --git a/SOURCES/0048-parted-add-resizepart-command.patch b/SOURCES/0048-parted-add-resizepart-command.patch new file mode 100644 index 0000000..689111a --- /dev/null +++ b/SOURCES/0048-parted-add-resizepart-command.patch @@ -0,0 +1,140 @@ +From 109a5a35d8482f43c7d779df3b7d10bf16d5f31b Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Mon, 26 Sep 2011 17:21:01 +0200 +Subject: [PATCH 48/48] parted: add resizepart command + +Add resizepart command to resize ( change the end position ) an existing +partition. Note that it does nothing to a filesystem in the partition. + +(cherry picked from commit 21c58e17c473ea8ef31a18d03348eb2381c0f36c) + +Resolves: rhbz#1423357 +--- + NEWS | 1 + + parted/parted.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 77 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index d1a6f58..62d6381 100644 +--- a/NEWS ++++ b/NEWS +@@ -3,6 +3,7 @@ GNU parted NEWS -*- outline -*- + * Noteworthy changes in release 3.1-29 (2017-04-11) [RHEL7.4] + + Parted now recognizes NVMe devices ++ Add resizepart command to resize a partition + + * Noteworthy changes in release 3.1-18 (2014-08-12) [RHEL7.1] + +diff --git a/parted/parted.c b/parted/parted.c +index d4a397b..d64b0b8 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -152,6 +152,9 @@ static const char* fs_type_msg_start = N_("FS-TYPE is one of: "); + static const char* start_end_msg = N_("START and END are disk locations, such as " + "4GB or 10%. Negative values count from the end of the disk. " + "For example, -1s specifies exactly the last sector.\n"); ++static const char* end_msg = N_("END is disk location, such as " ++ "4GB or 10%. Negative value counts from the end of the disk. " ++ "For example, -1s specifies exactly the last sector.\n"); + static const char* state_msg = N_("STATE is one of: on, off\n"); + static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n"); + static const char* name_msg = N_("NAME is any word you want\n"); +@@ -435,6 +438,21 @@ constraint_from_start_end (PedDevice* dev, PedGeometry* range_start, + range_start, range_end, 1, dev->length); + } + ++ ++static PedConstraint* ++constraint_from_start_end_fixed_start (PedDevice* dev, PedSector start_sector, ++ PedGeometry* range_end) ++{ ++ PedGeometry range_start; ++ range_start.dev = dev; ++ range_start.start = start_sector; ++ range_start.end = start_sector; ++ range_start.length = 1; ++ ++ return ped_constraint_new (ped_alignment_any, ped_alignment_any, ++ &range_start, range_end, 1, dev->length); ++} ++ + void + help_on (char* topic) + { +@@ -1478,7 +1496,7 @@ error: + } + + static int +-do_resize (PedDevice **dev, PedDisk** diskp) ++do_resize (PedDevice **dev) + { + ped_exception_throw ( + PED_EXCEPTION_ERROR, +@@ -1488,6 +1506,63 @@ do_resize (PedDevice **dev, PedDisk** diskp) + } + + static int ++do_resizepart (PedDevice** dev) ++{ ++ PedDisk *disk; ++ PedPartition *part = NULL; ++ PedSector start, end, oldend; ++ PedGeometry *range_end = NULL; ++ PedConstraint* constraint; ++ int rc = 0; ++ ++ disk = ped_disk_new (*dev); ++ if (!disk) ++ goto error; ++ ++ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT)) ++ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT, ++ alignment == ALIGNMENT_CYLINDER)) ++ goto error; ++ ++ if (!command_line_get_partition (_("Partition number?"), disk, &part)) ++ goto error; ++ if (!_partition_warn_busy (part)) ++ goto error; ++ ++ start = part->geom.start; ++ end = oldend = part->geom.end; ++ if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL)) ++ goto error; ++ /* Do not move start of the partition */ ++ constraint = constraint_from_start_end_fixed_start (*dev, start, range_end); ++ if (!ped_disk_set_partition_geom (disk, part, constraint, ++ start, end)) ++ goto error_destroy_constraint; ++ /* warn when shrinking partition - might lose data */ ++ if (part->geom.end < oldend) ++ if (ped_exception_throw ( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_YES_NO, ++ _("Shrinking a partition can cause data loss, " \ ++ "are you sure you want to continue?")) != PED_EXCEPTION_YES) ++ goto error_destroy_constraint; ++ ped_disk_commit (disk); ++ ++ if ((*dev)->type != PED_DEVICE_FILE) ++ disk_is_modified = 1; ++ ++ rc = 1; ++ ++error_destroy_constraint: ++ ped_constraint_destroy (constraint); ++error: ++ if (range_end != NULL) ++ ped_geometry_destroy (range_end); ++ return rc; ++} ++ ++ ++static int + do_rm (PedDevice** dev) + { + PedDisk* disk; +-- +2.9.4 + diff --git a/SOURCES/0049-partprobe-always-close-dev-when-probing-disks.patch b/SOURCES/0049-partprobe-always-close-dev-when-probing-disks.patch new file mode 100644 index 0000000..5dd6513 --- /dev/null +++ b/SOURCES/0049-partprobe-always-close-dev-when-probing-disks.patch @@ -0,0 +1,34 @@ +From da41227259c5e301e26a9983b714e521d4599575 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 25 Feb 2019 16:07:39 -0800 +Subject: [PATCH 49/50] partprobe: always close dev when probing disks + +Resolves: rhbz#1551411 +--- + partprobe/partprobe.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/partprobe/partprobe.c b/partprobe/partprobe.c +index c5260c6..ccda141 100644 +--- a/partprobe/partprobe.c ++++ b/partprobe/partprobe.c +@@ -113,7 +113,7 @@ process_dev (PedDevice* dev) + + disk_type = ped_disk_probe (dev); + if (!disk_type || !strcmp (disk_type->name, "loop")) +- return 1; ++ goto skip_dev; + + disk = ped_disk_new (dev); + if (!disk) +@@ -125,6 +125,7 @@ process_dev (PedDevice* dev) + if (opt_summary) + summary (disk); + ped_disk_destroy (disk); ++skip_dev: + ped_device_close (dev); + return 1; + +-- +2.20.1 + diff --git a/SOURCES/0050-tests-Add-t4201-to-test-partprobe-with-1025-devices.patch b/SOURCES/0050-tests-Add-t4201-to-test-partprobe-with-1025-devices.patch new file mode 100644 index 0000000..99e0f70 --- /dev/null +++ b/SOURCES/0050-tests-Add-t4201-to-test-partprobe-with-1025-devices.patch @@ -0,0 +1,86 @@ +From bbe5e56e7c8718f416610b48afadada543e1d58e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 25 Feb 2019 16:20:14 -0800 +Subject: [PATCH 50/50] tests: Add t4201 to test partprobe with 1025 devices + +This makes sure partprobe is closing the device and doesn't run out of +file descriptors. Uses scsi_debug to create 1025 devices (descriptor +limit is 1024). + +Also adds partprobe to the TESTS_ENVIRONMENT PATH, otherwise it will use +the partprobe installed on the system when running the tests. + +Related: rhbz#1551411 +--- + tests/Makefile.am | 3 ++- + tests/t4201-partprobe-1025-disks.sh | 37 +++++++++++++++++++++++++++++ + 2 files changed, 39 insertions(+), 1 deletion(-) + create mode 100755 tests/t4201-partprobe-1025-disks.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 29fa280..f11be8a 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -52,6 +52,7 @@ TESTS = \ + t4100-msdos-partition-limits.sh \ + t4100-msdos-starting-sector.sh \ + t4200-partprobe.sh \ ++ t4201-partprobe-1025-disks.sh \ + t4300-nilfs2-tiny.sh \ + t5000-tags.sh \ + t6000-dm.sh \ +@@ -120,7 +121,7 @@ TESTS_ENVIRONMENT = \ + PERL='$(PERL)' \ + PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \ + REPLACE_GETCWD=$(REPLACE_GETCWD) \ +- PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)'"$$PATH" \ ++ PATH='$(abs_top_builddir)/parted$(PATH_SEPARATOR)$(abs_top_builddir)/partprobe$(PATH_SEPARATOR)'"$$PATH" \ + VERSION=$(VERSION) \ + ; 9>&2 + +diff --git a/tests/t4201-partprobe-1025-disks.sh b/tests/t4201-partprobe-1025-disks.sh +new file mode 100755 +index 0000000..f6cdec5 +--- /dev/null ++++ b/tests/t4201-partprobe-1025-disks.sh +@@ -0,0 +1,37 @@ ++#!/bin/sh ++# Make sure partprobe is closing the devices ++ ++# Copyright (C) 2008-2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_root_ ++require_scsi_debug_module_ ++ss=$sector_size_ ++ ++scsi_debug_acquire_lock_ ++ ++# load scsi_debug directly, using scsi_debug_setup_ fails with all the unexpected devices ++modprobe scsi_debug dev_size_mb=1 num_tgts=1025 > dev-name || ++ skip_ 'failed to create scsi_debug device' ++ ++# So that scsi_debug_cleanup_ will run ++scsi_debug_modprobe_succeeded_=1 ++ ++# ensure that partprobe succeeds and produces no output" ++partprobe > out 2>err || fail=1 ++compare /dev/null err || fail=1 ++ ++Exit $fail +-- +2.20.1 + diff --git a/SOURCES/0051-fdasd-geometry-handling-updated-from-upstream-s390-t.patch b/SOURCES/0051-fdasd-geometry-handling-updated-from-upstream-s390-t.patch new file mode 100644 index 0000000..9f8f3a5 --- /dev/null +++ b/SOURCES/0051-fdasd-geometry-handling-updated-from-upstream-s390-t.patch @@ -0,0 +1,286 @@ +From 42944dd6be000d49d5e1178a576e269aac6f6335 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Thu, 17 Sep 2015 15:33:28 +0200 +Subject: [PATCH 51/54] fdasd: geometry handling updated from upstream + s390-tools + +Remove the necessity for DASD-specific ioctls for partition handling. +This allows to correctly handle DASD-backed virtio block devices. + +Note that this is necessary because virtio is just the transport. +A DASD, even if provided via virtio, still has it's unique +characteristics, which means that only traditional DASD partition +table formats can be used (no MBR, GPT, or similar). + +Use bzero for initialization to make sure all struct members are +properly cleared. Also changed partition list handling code to be +more similar to upstream s390-tools fdasd. + +Further, enhanced error handling capabilities by providing a +return code by fdasd_get_geometry. + +Code is largely backported from s390-tools project. + +Signed-off-by: Viktor Mihajlovski +Acked-by: Stefan Haberland +Signed-off-by: Hendrik Brueckner +Signed-off-by: Brian C. Lane + +(cherry picked from commit 4d480d980a9b69b432b8d60df3c4397ba8cdc965) + +Resolves: rhbz#1676604 +--- + include/parted/fdasd.h | 4 +- + libparted/labels/fdasd.c | 166 +++++++++++++++++++++++++++------------ + 2 files changed, 119 insertions(+), 51 deletions(-) + +diff --git a/include/parted/fdasd.h b/include/parted/fdasd.h +index 6f6a7e0..4e351c4 100644 +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -190,6 +190,8 @@ typedef struct format_data_t { + #define BLKRRPART _IO(0x12,95) + /* get block device sector size */ + #define BLKSSZGET _IO(0x12,104) ++/* device size in bytes (u64 *arg)*/ ++#define BLKGETSIZE64 _IOR(0x12,114,size_t) + /* get device geometry */ + #define HDIO_GETGEO 0x0301 + +@@ -285,7 +287,7 @@ enum fdasd_failure { + + void fdasd_cleanup (fdasd_anchor_t *anchor); + void fdasd_initialize_anchor (fdasd_anchor_t * anc); +-void fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd); ++int fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd); + void fdasd_check_api_version (fdasd_anchor_t *anc, int fd); + int fdasd_check_volume (fdasd_anchor_t *anc, int fd); + int fdasd_write_labels (fdasd_anchor_t *anc, int fd); +diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c +index 1f87937..7e6a77a 100644 +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -210,27 +210,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) + partition_info_t *p = NULL; + partition_info_t *q = NULL; + +- anc->devno = 0; +- anc->dev_type = 0; +- anc->used_partitions = 0; +- +- anc->silent = 0; +- anc->verbose = 0; +- anc->big_disk = 0; +- anc->volid_specified = 0; +- anc->config_specified = 0; +- anc->auto_partition = 0; +- anc->devname_specified = 0; +- anc->print_table = 0; +- +- anc->option_reuse = 0; +- anc->option_recreate = 0; +- +- anc->vlabel_changed = 0; +- anc->vtoc_changed = 0; +- anc->blksize = 0; +- anc->fspace_trk = 0; +- anc->label_pos = 0; ++ bzero(anc, sizeof(fdasd_anchor_t)); + + for (i=0; iused = 0x00; +- p->len_trk = 0; +- p->start_trk = 0; +- p->fspace_trk = 0; +- p->type = 0; ++ bzero(p, sizeof(partition_info_t)); + + /* add p to double pointered list */ + if (i == 1) { +- anc->first = p; +- p->prev = NULL; ++ anc->first = p; + } else if (i == USABLE_PARTITIONS) { +- anc->last = p; +- p->next = NULL; ++ anc->last = p; + p->prev = q; + q->next = p; + } else { +- p->prev = q; +- q->next = p; ++ p->prev = q; ++ q->next = p; + } + + p->f1 = malloc(sizeof(format1_label_t)); +@@ -946,16 +920,78 @@ fdasd_check_api_version (fdasd_anchor_t *anc, int f) + } + } + ++/* ++ * The following two functions match those in the DASD ECKD device driver. ++ * They are used to compute how many records of a given size can be stored ++ * in one track. ++ */ ++static unsigned int ceil_quot(unsigned int d1, unsigned int d2) ++{ ++ return (d1 + (d2 - 1)) / d2; ++} ++ ++/* kl: key length, dl: data length */ ++static unsigned int recs_per_track(unsigned short dev_type, unsigned int kl, ++ unsigned int dl) ++{ ++ unsigned int dn, kn; ++ ++ switch (dev_type) { ++ case DASD_3380_TYPE: ++ if (kl) ++ return 1499 / (15 + 7 + ceil_quot(kl + 12, 32) + ++ ceil_quot(dl + 12, 32)); ++ else ++ return 1499 / (15 + ceil_quot(dl + 12, 32)); ++ case DASD_3390_TYPE: ++ dn = ceil_quot(dl + 6, 232) + 1; ++ if (kl) { ++ kn = ceil_quot(kl + 6, 232) + 1; ++ return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) + ++ 9 + ceil_quot(dl + 6 * dn, 34)); ++ } else ++ return 1729 / (10 + 9 + ceil_quot(dl + 6 * dn, 34)); ++ case DASD_9345_TYPE: ++ dn = ceil_quot(dl + 6, 232) + 1; ++ if (kl) { ++ kn = ceil_quot(kl + 6, 232) + 1; ++ return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) + ++ ceil_quot(dl + 6 * dn, 34)); ++ } else ++ return 1420 / (18 + 7 + ceil_quot(dl + 6 * dn, 34)); ++ } ++ return 0; ++} ++ ++/* ++ * Verify that number of tracks (heads) per cylinder and number of ++ * sectors per track match the expected values for a given device type ++ * and block size. ++ * Returns 1 for a valid match and 0 otherwise. ++ */ ++static int fdasd_verify_geometry(unsigned short dev_type, int blksize, ++ struct fdasd_hd_geometry *geometry) ++{ ++ unsigned int expected_sectors; ++ if (geometry->heads != 15) ++ return 0; ++ expected_sectors = recs_per_track(dev_type, 0, blksize); ++ if (geometry->sectors == expected_sectors) ++ return 1; ++ return 0; ++} ++ + /* + * reads dasd geometry data + */ +-void ++int + fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) + { + PDEBUG + int blksize = 0; + dasd_information_t dasd_info; + struct dasd_eckd_characteristics *characteristics; ++ unsigned long long size_in_bytes; + + /* We can't get geometry from a regular file, + so simulate something usable, for the sake of testing. */ +@@ -979,6 +1015,12 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) + anc->geo.heads; + anc->is_file = 1; + } else { ++ if (ioctl(f, BLKGETSIZE64, &size_in_bytes) != 0) { ++ fdasd_error(anc, unable_to_ioctl, ++ _("Could not retrieve disk size.")); ++ goto error; ++ } ++ + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + fdasd_error(anc, unable_to_ioctl, + _("Could not retrieve disk geometry information.")); +@@ -988,27 +1030,51 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) + _("Could not retrieve blocksize information.")); + + /* get disk type */ +- if (ioctl(f, BIODASDINFO, &dasd_info) != 0) +- fdasd_error(anc, unable_to_ioctl, +- _("Could not retrieve disk information.")); +- +- characteristics = (struct dasd_eckd_characteristics *) +- &dasd_info.characteristics; +- if (characteristics->no_cyl == LV_COMPAT_CYL && +- characteristics->long_no_cyl) +- anc->hw_cylinders = characteristics->long_no_cyl; +- else +- anc->hw_cylinders = characteristics->no_cyl; ++ if (ioctl(f, BIODASDINFO, &dasd_info) != 0) { ++ /* verify that the geometry matches a 3390 DASD */ ++ if (!fdasd_verify_geometry(DASD_3390_TYPE, blksize, ++ &anc->geo)) { ++ fdasd_error(anc, wrong_disk_type, ++ _("Disk geometry does not match a " \ ++ "DASD device of type 3390.")); ++ goto error; ++ } ++ anc->dev_type = DASD_3390_TYPE; ++ anc->hw_cylinders = ++ size_in_bytes / (blksize * anc->geo.heads * anc->geo.sectors); ++ /* The VOL1 label on a CDL formatted ECKD DASD is in block 2 ++ * It will be verified later, if this position actually holds a ++ * valid label record. ++ */ ++ anc->label_pos = 2 * blksize; ++ /* A devno 0 is actually a valid devno, which could exist ++ * in the system. Since we use this number only to create ++ * a default volume serial, there is no serious conflict. ++ */ ++ anc->devno = 0; ++ } else { ++ characteristics = (struct dasd_eckd_characteristics *) ++ &dasd_info.characteristics; ++ if (characteristics->no_cyl == LV_COMPAT_CYL && ++ characteristics->long_no_cyl) ++ anc->hw_cylinders = characteristics->long_no_cyl; ++ else ++ anc->hw_cylinders = characteristics->no_cyl; ++ anc->dev_type = dasd_info.dev_type; ++ anc->label_pos = dasd_info.label_block * blksize; ++ anc->devno = dasd_info.devno; ++ anc->label_block = dasd_info.label_block; ++ anc->FBA_layout = dasd_info.FBA_layout; ++ } + + anc->is_file = 0; + } + +- anc->dev_type = dasd_info.dev_type; +- anc->blksize = blksize; +- anc->label_pos = dasd_info.label_block * blksize; +- anc->devno = dasd_info.devno; +- anc->label_block = dasd_info.label_block; +- anc->FBA_layout = dasd_info.FBA_layout; ++ anc->blksize = blksize; ++ return 1; ++ ++ error: ++ return 0; + } + + /* +-- +2.20.1 + diff --git a/SOURCES/0052-dasd-enhance-device-probing.patch b/SOURCES/0052-dasd-enhance-device-probing.patch new file mode 100644 index 0000000..9f78667 --- /dev/null +++ b/SOURCES/0052-dasd-enhance-device-probing.patch @@ -0,0 +1,242 @@ +From 75958b299ed01eadbbcf1df31dacacfcaf8bc13a Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Thu, 17 Sep 2015 15:33:29 +0200 +Subject: [PATCH 52/54] dasd: enhance device probing + +Probe for all device/transport types as every block device +could be a DASD on s390. + +Since the calculation of the minimum and optimum alignment +is different between DASDs and common fixed block disks +we need a means other than dev->type == PED_DEVICE_DASD. +For that purpose a static function _ped_device_like_dasd() +offering a DASD detection heuristic has been added to +arch/linux.c. + +By always providing arch-specific alignment functions the +need for DASD-specific code could be removed from device.c. + +Observe fdasd_get_geometry return code for proper error +handling. + +Remove the obsolete API check as we no longer require the +DASD-specific IOCTLs. + +Signed-off-by: Viktor Mihajlovski +Acked-by: Stefan Haberland +Signed-off-by: Hendrik Brueckner +Signed-off-by: Brian C. Lane + +(cherry picked from commit 834713b5aee1edc004f863231dd489ee3a79f536) + +Related: rhbz#1676604 +--- + libparted/arch/linux.c | 85 +++++++++++++++++++++++++++++++++-------- + libparted/device.c | 14 ++----- + libparted/labels/dasd.c | 18 ++++----- + 3 files changed, 82 insertions(+), 35 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 6e78faf..56cfe6f 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -727,9 +727,13 @@ _device_set_sector_size (PedDevice* dev) + #endif + + #if defined __s390__ || defined __s390x__ ++ /* The real_sector_size is currently needed for DASD layouts, ++ * so we set it unconditionally. In the long run it should ++ * be considered to use the dev->phys_sector_size in label/dasd.c. ++ */ ++ arch_specific->real_sector_size = dev->sector_size; + /* Return PED_SECTOR_SIZE_DEFAULT for DASDs. */ + if (dev->type == PED_DEVICE_DASD) { +- arch_specific->real_sector_size = dev->sector_size; + dev->sector_size = PED_SECTOR_SIZE_DEFAULT; + } + #endif +@@ -3112,19 +3116,72 @@ linux_disk_commit (PedDisk* disk) + { + if (disk->dev->type != PED_DEVICE_FILE) { + +- /* We now require BLKPG support. If this assertion fails, +- please write to the mailing list describing your system. +- Assuming it's never triggered, ... +- FIXME: remove this assertion in 2012. */ +- assert (_have_blkpg ()); ++ /* We now require BLKPG support. If this assertion fails, ++ please write to the mailing list describing your system. ++ Assuming it's never triggered, ... ++ FIXME: remove this assertion in 2012. */ ++ assert (_have_blkpg ()); + +- if (!_disk_sync_part_table (disk)) +- return 0; ++ if (!_disk_sync_part_table (disk)) ++ return 0; + } + + return 1; + } + ++#if defined __s390__ || defined __s390x__ ++/** ++ * Check whether this device could be a DASD ++ * ++ * The device probing yields PED_DEVICE_DASD for native DASD transport ++ * If the block device uses a different transport (e.g. virtio) ++ * a simplified heuristic (assuming a model 3390 with 4K sectors) ++ * is applied (only) on s390x systems for this check. ++ * ++ * \return 1 if the geometry indicates this could be a DASD ++ * and 0 otherwise ++ */ ++static int ++_ped_device_like_dasd(const PedDevice *dev) ++{ ++ return (dev->type == PED_DEVICE_DASD) ++ || (dev->hw_geom.heads == 15 ++ && dev->hw_geom.sectors == 12 ++ && (dev->hw_geom.cylinders ++ * dev->hw_geom.heads ++ * dev->hw_geom.sectors ++ * dev->phys_sector_size ++ == dev->length * dev->sector_size)); ++} ++ ++ ++ ++static PedAlignment* ++s390_get_minimum_alignment(const PedDevice *dev) ++{ ++#if USE_BLKID ++ return linux_get_minimum_alignment(dev); ++#else ++ return ped_alignment_new(0, ++ dev->phys_sector_size ++ / dev->sector_size); ++#endif ++} ++ ++static PedAlignment* ++s390_get_optimum_alignment(const PedDevice *dev) ++{ ++ /* DASD needs to use minimum alignment */ ++ if (_ped_device_like_dasd(dev)) ++ return s390_get_minimum_alignment(dev); ++#if USE_BLKID ++ return linux_get_optimum_alignment(dev); ++#else ++ return NULL; ++#endif ++} ++#endif ++ + #if USE_BLKID + static PedAlignment* + linux_get_minimum_alignment(const PedDevice *dev) +@@ -3165,15 +3222,10 @@ linux_get_optimum_alignment(const PedDevice *dev) + && PED_DEFAULT_ALIGNMENT % optimal_io == 0) + || (!optimal_io && minimum_io + && PED_DEFAULT_ALIGNMENT % minimum_io == 0) +- ) { +- /* DASD needs to use minimum alignment */ +- if (dev->type == PED_DEVICE_DASD) +- return linux_get_minimum_alignment(dev); +- ++ ) + return ped_alignment_new( + blkid_topology_get_alignment_offset(tp) / dev->sector_size, + PED_DEFAULT_ALIGNMENT / dev->sector_size); +- } + + /* If optimal_io_size is 0 and we don't meet the other criteria + for using the device.c default, return the minimum alignment. */ +@@ -3200,7 +3252,10 @@ static PedDeviceArchOps linux_dev_ops = { + sync: linux_sync, + sync_fast: linux_sync_fast, + probe_all: linux_probe_all, +-#if USE_BLKID ++#if defined __s390__ || defined __s390x__ ++ get_minimum_alignment: s390_get_minimum_alignment, ++ get_optimum_alignment: s390_get_optimum_alignment, ++#elif USE_BLKID + get_minimum_alignment: linux_get_minimum_alignment, + get_optimum_alignment: linux_get_optimum_alignment, + #endif +diff --git a/libparted/device.c b/libparted/device.c +index cdcc117..36fecd2 100644 +--- a/libparted/device.c ++++ b/libparted/device.c +@@ -550,16 +550,10 @@ ped_device_get_optimum_alignment(const PedDevice *dev) + /* If the arch specific code could not give as an alignment + return a default value based on the type of device. */ + if (align == NULL) { +- switch (dev->type) { +- case PED_DEVICE_DASD: +- align = ped_device_get_minimum_alignment(dev); +- break; +- default: +- /* Align to a grain of 1MiB (like vista / win7) */ +- align = ped_alignment_new(0, +- (PED_DEFAULT_ALIGNMENT +- / dev->sector_size)); +- } ++ /* Align to a grain of 1MiB (like vista / win7) */ ++ align = ped_alignment_new(0, ++ (PED_DEFAULT_ALIGNMENT ++ / dev->sector_size)); + } + + return align; +diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c +index 5bffda7..a4be1fd 100644 +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -214,19 +214,13 @@ dasd_probe (const PedDevice *dev) + + PED_ASSERT(dev != NULL); + +- if (!(dev->type == PED_DEVICE_DASD +- || dev->type == PED_DEVICE_VIODASD +- || dev->type == PED_DEVICE_FILE)) +- return 0; +- + arch_specific = LINUX_SPECIFIC(dev); + + /* add partition test here */ + fdasd_initialize_anchor(&anchor); + +- fdasd_get_geometry(dev, &anchor, arch_specific->fd); +- +- fdasd_check_api_version(&anchor, arch_specific->fd); ++ if (fdasd_get_geometry(dev, &anchor, arch_specific->fd) == 0) ++ goto error_cleanup; + + /* Labels are required on CDL formatted DASDs. */ + if (fdasd_check_volume(&anchor, arch_specific->fd) && +@@ -276,7 +270,9 @@ dasd_read (PedDisk* disk) + + fdasd_initialize_anchor(&anchor); + +- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); ++ if (fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd) == 0) ++ goto error_close_dev; ++ + disk_specific->label_block = anchor.label_block; + + if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE) +@@ -630,7 +626,9 @@ dasd_write (const PedDisk* disk) + + /* initialize the anchor */ + fdasd_initialize_anchor(&anchor); +- fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); ++ if (fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd) == 0) ++ goto error; ++ + fdasd_check_volume(&anchor, arch_specific->fd); + memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t)); + anchor.vlabel_changed++; +-- +2.20.1 + diff --git a/SOURCES/0053-parted-fix-build-error-on-s390.patch b/SOURCES/0053-parted-fix-build-error-on-s390.patch new file mode 100644 index 0000000..0cd849b --- /dev/null +++ b/SOURCES/0053-parted-fix-build-error-on-s390.patch @@ -0,0 +1,147 @@ +From f0d72664c7c121bd4f4002356d8a9b75860418d4 Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Thu, 29 Oct 2015 21:12:01 +0100 +Subject: [PATCH 53/54] parted: fix build error on s390 + +The preceding dasd probing patches have introduced a compile error +when building with blkid support. Fixed by reordering function +definitions. + +Signed-off-by: Colin Watson +Signed-off-by: Viktor Mihajlovski +Signed-off-by: Brian C. Lane + +(cherry picked from commit 388bab890a4e09b09d2428c0e773ed083295f91b) + +Related: rhbz#1676604 +--- + libparted/arch/linux.c | 106 ++++++++++++++++++++--------------------- + 1 file changed, 53 insertions(+), 53 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 56cfe6f..cc40a1a 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -3129,59 +3129,6 @@ linux_disk_commit (PedDisk* disk) + return 1; + } + +-#if defined __s390__ || defined __s390x__ +-/** +- * Check whether this device could be a DASD +- * +- * The device probing yields PED_DEVICE_DASD for native DASD transport +- * If the block device uses a different transport (e.g. virtio) +- * a simplified heuristic (assuming a model 3390 with 4K sectors) +- * is applied (only) on s390x systems for this check. +- * +- * \return 1 if the geometry indicates this could be a DASD +- * and 0 otherwise +- */ +-static int +-_ped_device_like_dasd(const PedDevice *dev) +-{ +- return (dev->type == PED_DEVICE_DASD) +- || (dev->hw_geom.heads == 15 +- && dev->hw_geom.sectors == 12 +- && (dev->hw_geom.cylinders +- * dev->hw_geom.heads +- * dev->hw_geom.sectors +- * dev->phys_sector_size +- == dev->length * dev->sector_size)); +-} +- +- +- +-static PedAlignment* +-s390_get_minimum_alignment(const PedDevice *dev) +-{ +-#if USE_BLKID +- return linux_get_minimum_alignment(dev); +-#else +- return ped_alignment_new(0, +- dev->phys_sector_size +- / dev->sector_size); +-#endif +-} +- +-static PedAlignment* +-s390_get_optimum_alignment(const PedDevice *dev) +-{ +- /* DASD needs to use minimum alignment */ +- if (_ped_device_like_dasd(dev)) +- return s390_get_minimum_alignment(dev); +-#if USE_BLKID +- return linux_get_optimum_alignment(dev); +-#else +- return NULL; +-#endif +-} +-#endif +- + #if USE_BLKID + static PedAlignment* + linux_get_minimum_alignment(const PedDevice *dev) +@@ -3238,6 +3185,59 @@ linux_get_optimum_alignment(const PedDevice *dev) + } + #endif + ++#if defined __s390__ || defined __s390x__ ++/** ++ * Check whether this device could be a DASD ++ * ++ * The device probing yields PED_DEVICE_DASD for native DASD transport ++ * If the block device uses a different transport (e.g. virtio) ++ * a simplified heuristic (assuming a model 3390 with 4K sectors) ++ * is applied (only) on s390x systems for this check. ++ * ++ * \return 1 if the geometry indicates this could be a DASD ++ * and 0 otherwise ++ */ ++static int ++_ped_device_like_dasd(const PedDevice *dev) ++{ ++ return (dev->type == PED_DEVICE_DASD) ++ || (dev->hw_geom.heads == 15 ++ && dev->hw_geom.sectors == 12 ++ && (dev->hw_geom.cylinders ++ * dev->hw_geom.heads ++ * dev->hw_geom.sectors ++ * dev->phys_sector_size ++ == dev->length * dev->sector_size)); ++} ++ ++ ++ ++static PedAlignment* ++s390_get_minimum_alignment(const PedDevice *dev) ++{ ++#if USE_BLKID ++ return linux_get_minimum_alignment(dev); ++#else ++ return ped_alignment_new(0, ++ dev->phys_sector_size ++ / dev->sector_size); ++#endif ++} ++ ++static PedAlignment* ++s390_get_optimum_alignment(const PedDevice *dev) ++{ ++ /* DASD needs to use minimum alignment */ ++ if (_ped_device_like_dasd(dev)) ++ return s390_get_minimum_alignment(dev); ++#if USE_BLKID ++ return linux_get_optimum_alignment(dev); ++#else ++ return NULL; ++#endif ++} ++#endif ++ + static PedDeviceArchOps linux_dev_ops = { + _new: linux_new, + destroy: linux_destroy, +-- +2.20.1 + diff --git a/SOURCES/0054-fdasd.c-Safeguard-against-geometry-misprobing.patch b/SOURCES/0054-fdasd.c-Safeguard-against-geometry-misprobing.patch new file mode 100644 index 0000000..e38ffe7 --- /dev/null +++ b/SOURCES/0054-fdasd.c-Safeguard-against-geometry-misprobing.patch @@ -0,0 +1,52 @@ +From ef7c01a23e2cacecbf86c02e7657d8a9d6cc48dd Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 5 Feb 2016 14:47:11 +0100 +Subject: [PATCH 54/54] fdasd.c: Safeguard against geometry misprobing + +Fixes an issue with parted print being run against a logical +volume realised by extents on a physical volume residing on +a DASD. +We must make sure that geometry, device blocksize and DASD +attributes are present before we start format verifications +If any of it is missing this is not a DASD. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: Brian C. Lane + +(cherry picked from commit 8c6de55e4375bd63ae0d0dc7dd7104a7c2290cac) + +Related: rhbz#1676604 +--- + libparted/labels/fdasd.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c +index 7e6a77a..968b332 100644 +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -1021,13 +1021,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) + goto error; + } + +- if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) ++ if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0 || ++ anc->geo.heads == 0 || ++ anc->geo.sectors == 0 || ++ anc->geo.cylinders == 0 ) { + fdasd_error(anc, unable_to_ioctl, + _("Could not retrieve disk geometry information.")); ++ goto error; ++ } + +- if (ioctl(f, BLKSSZGET, &blksize) != 0) ++ if (ioctl(f, BLKSSZGET, &blksize) != 0) { + fdasd_error(anc, unable_to_ioctl, + _("Could not retrieve blocksize information.")); ++ goto error; ++ } + + /* get disk type */ + if (ioctl(f, BIODASDINFO, &dasd_info) != 0) { +-- +2.20.1 + diff --git a/SOURCES/0055-Add-part-label-documentation-to-mkpart-command.patch b/SOURCES/0055-Add-part-label-documentation-to-mkpart-command.patch new file mode 100644 index 0000000..9165347 --- /dev/null +++ b/SOURCES/0055-Add-part-label-documentation-to-mkpart-command.patch @@ -0,0 +1,36 @@ +From 5d2ebcc83aecad33805559f202aeb1a6f36f5ecd Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 27 Mar 2019 09:12:19 -0700 +Subject: [PATCH] Add part-label documentation to mkpart command + +The documentation was not clear that the first field is a partition type +on MBR and a label on GPT. + +Resolves: rhbz#1686659 +--- + doc/C/parted.8 | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 5a24c94..080a8cf 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -73,12 +73,13 @@ Create a new disklabel (partition table) of \fIlabel-type\fP. \fIlabel-type\fP + should be one of "aix", "amiga", "bsd", "dvh", "gpt", "loop", "mac", "msdos", + "pc98", or "sun". + .TP +-.B mkpart \fIpart-type\fP \fI[fs-type]\fP \fIstart\fP \fIend\fP ++.B mkpart \fI[part-type|part-label]\fP \fI[fs-type]\fP \fIstart\fP \fIend\fP + Make a \fIpart-type\fP partition for filesystem \fIfs-type\fP (if specified), + beginning at \fIstart\fP and ending at \fIend\fP (by default in megabytes). + \fIfs-type\fP can be one of "btrfs", "ext2", "ext3", "ext4", "fat16", "fat32", + "hfs", "hfs+", "linux-swap", "ntfs", "reiserfs", or "xfs". +-\fIpart-type\fP should be one of "primary", "logical", or "extended". ++For MBR labeled devices \fIpart-type\fP should be one of "primary", "logical", or "extended". ++For GPT labeled devices \fIpart-label\fP is used instead, and can be any short alphanumeric string. + .TP + .B name \fIpartition\fP \fIname\fP + Set the name of \fIpartition\fP to \fIname\fP. This option works only on Mac, +-- +2.20.1 + diff --git a/SOURCES/parted-2.1-libparted-use-dm_udev_wait-698121.patch b/SOURCES/parted-2.1-libparted-use-dm_udev_wait-698121.patch new file mode 100644 index 0000000..e60a7a2 --- /dev/null +++ b/SOURCES/parted-2.1-libparted-use-dm_udev_wait-698121.patch @@ -0,0 +1,86 @@ +From e3f74af78b774b235123b9d5fa40fead3b003bb2 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Jan 2012 15:31:43 -0800 +Subject: [PATCH] libparted: use dm_udev_wait (#698121) + +This applies Peter Rajnoha's patch to use dm_udev_wait to +synchronize with udev. + +This requires libdevmapper v1.02.39 and higher. + +Patch is from: +https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html + +Resolves: rhbz#698121 +--- + libparted/arch/linux.c | 16 +++++++++++++++- + 1 files changed, 15 insertions(+), 1 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index e2c4139..1fcbcad 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -1319,6 +1319,10 @@ linux_new (const char* path) + dev->dirty = 0; + dev->boot_dirty = 0; + ++#ifdef ENABLE_DEVICE_MAPPER ++ dm_udev_set_sync_support(1); ++#endif ++ + if (!_device_probe_type (dev)) + goto error_free_arch_specific; + +@@ -2676,16 +2680,21 @@ static int + _dm_remove_map_name(char *name) + { + struct dm_task *task = NULL; +- int rc; ++ int rc = 0; ++ uint32_t cookie = 0; + + task = dm_task_create(DM_DEVICE_REMOVE); + if (!task) + return 1; + + dm_task_set_name (task, name); ++ if (!dm_task_set_cookie(task, &cookie, 0)) ++ goto err; + + rc = dm_task_run(task); ++ dm_udev_wait(cookie); + dm_task_update_nodes(); ++err: + dm_task_destroy(task); + if (!rc) + return 1; +@@ -2796,6 +2805,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + const char* dev_name = NULL; + char* params = NULL; + LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); ++ uint32_t cookie = 0; + + /* Get map name from devicemapper */ + struct dm_task *task = dm_task_create (DM_DEVICE_INFO); +@@ -2832,14 +2842,18 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_set_name (task, vol_name); + dm_task_add_target (task, 0, part->geom.length, + "linear", params); ++ if (!dm_task_set_cookie(task, &cookie, 0)) ++ goto err; + if (dm_task_run (task)) { + //printf("0 %ld linear %s\n", part->geom.length, params); ++ dm_udev_wait(cookie); + dm_task_update_nodes(); + dm_task_destroy(task); + free(params); + free(vol_name); + return 1; + } else { ++ dm_udev_wait(cookie); + _dm_remove_map_name(vol_name); + } + err: +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch b/SOURCES/parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch new file mode 100644 index 0000000..4183f7e --- /dev/null +++ b/SOURCES/parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch @@ -0,0 +1,25 @@ +From 43663f1226da0a6284b5f52f6e2f741473c077b6 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 3 Feb 2012 13:03:27 -0800 +Subject: [PATCH] libparted: copy pmbr_boot when duplicating GPT disk + +* libparted/labels/gpt.c (gpt_duplicate): copy pmbr_boot flag +--- + libparted/labels/gpt.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index bad9ed4..0f07250 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -562,6 +562,7 @@ gpt_duplicate (const PedDisk *disk) + old_disk_data->data_area.length); + new_disk_data->entry_count = old_disk_data->entry_count; + new_disk_data->uuid = old_disk_data->uuid; ++ new_disk_data->pmbr_boot = old_disk_data->pmbr_boot; + return new_disk; + } + +-- +1.7.6.5 + diff --git a/SOURCES/parted-3.1-avoid-dasd-as-default-file-image-type.patch b/SOURCES/parted-3.1-avoid-dasd-as-default-file-image-type.patch new file mode 100644 index 0000000..f380792 --- /dev/null +++ b/SOURCES/parted-3.1-avoid-dasd-as-default-file-image-type.patch @@ -0,0 +1,59 @@ +Subject: [PATCH] libparted: Avoid dasd as default disk type while probe + +From: Nageswara R Sastry + +This patch avoids setting 'dasd' as a default disk type for +'disk image file' at the time of probe. + +Signed-off-by: Nageswara R Sastry +--- + include/parted/fdasd.h | 1 + + libparted/labels/fdasd.c | 6 +++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -261,6 +261,7 @@ typedef struct fdasd_anchor { + struct fdasd_hd_geometry geo; + unsigned int label_block; + unsigned int FBA_layout; ++ bool is_file; + } fdasd_anchor_t; + + enum offset {lower, upper}; +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t + } + anc->hw_cylinders = 0; + anc->formatted_cylinders = 0; ++ anc->is_file = 0; + } + + /* +@@ -892,7 +893,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, + /* Some times LDL formatted disks does not + contain any volume label */ + return 1; +- } else { ++ } else if (! anc->is_file) { + /* didn't find VOL1 volume label */ + anc->formatted_cylinders = anc->hw_cylinders; + anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads +@@ -976,6 +977,7 @@ fdasd_get_geometry (const PedDevice *dev + dasd_info.FBA_layout = 0; + anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / + anc->geo.heads; ++ anc->is_file = 1; + } else { + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + fdasd_error(anc, unable_to_ioctl, +@@ -997,6 +999,8 @@ fdasd_get_geometry (const PedDevice *dev + anc->hw_cylinders = characteristics->long_no_cyl; + else + anc->hw_cylinders = characteristics->no_cyl; ++ ++ anc->is_file = 0; + } + + anc->dev_type = dasd_info.dev_type; diff --git a/SOURCES/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch b/SOURCES/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch new file mode 100644 index 0000000..f9365d2 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch @@ -0,0 +1,54 @@ +From 1190dc5b214ce6ba4cbeadbdd599ab3ebb2cbb13 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Fri, 8 Jun 2012 14:42:45 -0700 +Subject: [PATCH] libparted: Fix endian error with FirstUsableLBA (#829960) + +On big-endial systems (eg. ppc64) this would cause parted to +crash. + +* NEWS: add new bugfix +* libparted/labels/gpt.c (gpt_get_max_supported_partition_count): + fix endian issues with pth->FirstUsableLBA +--- + NEWS | 3 ++- + libparted/labels/gpt.c | 4 ++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/NEWS b/NEWS +index b0a0657..596ab37 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,9 +1,10 @@ + GNU parted NEWS -*- outline -*- + +-* Noteworthy changes in release 3.1-2 (2012-03-21) [Fedora] ++* Noteworthy changes in release 3.1-4 (2012-06-08) [Fedora] + + ** Bug Fixes + ++ libparted: Don't crash on big-endian systems when using GPT + libparted: Treat disks without a PMBR as msdos labeled disks + even if they have GPT partition tables. + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index ab2145e..6ca33c8 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -1787,12 +1787,12 @@ gpt_get_max_supported_partition_count (const PedDisk *disk, int *max_n) + + if (!_header_is_valid (disk, pth, 1)) + { +- pth->FirstUsableLBA = 34; ++ pth->FirstUsableLBA = PED_CPU_TO_LE64 (34); + pth->SizeOfPartitionEntry + = PED_CPU_TO_LE32 (sizeof (GuidPartitionEntry_t)); + } + +- *max_n = (disk->dev->sector_size * (pth->FirstUsableLBA - 2) ++ *max_n = (disk->dev->sector_size * (PED_LE64_TO_CPU (pth->FirstUsableLBA)-2) + / PED_LE32_TO_CPU (pth->SizeOfPartitionEntry)); + pth_free (pth); + return true; +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-libparted-Flush-parent-device-on-open-962611.patch b/SOURCES/parted-3.1-libparted-Flush-parent-device-on-open-962611.patch new file mode 100644 index 0000000..b229f9b --- /dev/null +++ b/SOURCES/parted-3.1-libparted-Flush-parent-device-on-open-962611.patch @@ -0,0 +1,35 @@ +From dc213bf52d640c0219541afb002f71b49a888c7f Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Sep 2013 11:45:44 -0700 +Subject: [PATCH] libparted: Flush parent device on open (#962611) + +Parted probes for filesystems using geometry offsets into the parent +device, not the partition device itself. This means it may get stale +information if a partition has just been formatted. + +On kernels before 2.6 this will also flush all partition devices. On 2.6 +and newer kernels it will only flush the parent device. + +* libparted/arch/linux.c (linux_open): Always call _flush_cache +--- + libparted/arch/linux.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 2c410a0..4af0d5c 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -1579,9 +1579,7 @@ retry: + dev->read_only = 0; + } + +- /* With kernels < 2.6 flush cache for cache coherence issues */ +- if (!_have_kern26()) +- _flush_cache (dev); ++ _flush_cache (dev); + + return 1; + } +-- +1.8.3.1 + diff --git a/SOURCES/parted-3.1-libparted-Recognize-btrfs-filesystem.patch b/SOURCES/parted-3.1-libparted-Recognize-btrfs-filesystem.patch new file mode 100644 index 0000000..50f5e2f --- /dev/null +++ b/SOURCES/parted-3.1-libparted-Recognize-btrfs-filesystem.patch @@ -0,0 +1,184 @@ +From 242217de0268d6036a6e6a3f196abd79bfcb98b8 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 27 Aug 2013 17:27:07 -0700 +Subject: [PATCH 1/2] libparted: Recognize btrfs filesystem + +Add support for showing 'btrfs' in the 'file system' column. Also +allows the used to enter btrfs as the fs type. It doesn't really do +anything -- just sets the partition type to linux. + +* NEWS (Changes in behavior): Mention it. +* doc/parted.texti: Document btrfs fs. +* (libparted/fs/Makefile.am): Add btrfs.c +* (libparted/fs/btrfs/btrfs.c): Probe for btrfs +* (libparted/libparted.c): Register btrfs +--- + NEWS | 3 ++ + doc/parted.texi | 1 + + libparted/fs/Makefile.am | 1 + + libparted/fs/btrfs/btrfs.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ + libparted/libparted.c | 4 +++ + 5 files changed, 87 insertions(+) + create mode 100644 libparted/fs/btrfs/btrfs.c + +diff --git a/NEWS b/NEWS +index 596ab37..e2d01ed 100644 +--- a/NEWS ++++ b/NEWS +@@ -84,6 +84,9 @@ GNU parted NEWS -*- outline -*- + + ** Changes in behavior + ++ Added support for recognizing btrfs filesystem. This simply displays ++ btrfs in the 'file system' column of the parted output. ++ + Floppy drives are no longer scanned on linux: they cannot be partitioned + anyhow, and some users have a misconfigured BIOS that claims to have a + floppy when they don't, and scanning gets hung up. +diff --git a/doc/parted.texi b/doc/parted.texi +index 6561d0e..2b1ce64 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -575,6 +575,7 @@ partition table. + @item NTFS + @item reiserfs + @item ufs ++@item btrfs + @end itemize + + Example: +diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am +index 8d48ea1..a8fb313 100644 +--- a/libparted/fs/Makefile.am ++++ b/libparted/fs/Makefile.am +@@ -25,6 +25,7 @@ libfs_la_SOURCES = \ + amiga/asfs.c \ + amiga/asfs.h \ + amiga/a-interface.c \ ++ btrfs/btrfs.c \ + ext2/ext2.h \ + ext2/ext2_fs.h \ + ext2/interface.c \ +diff --git a/libparted/fs/btrfs/btrfs.c b/libparted/fs/btrfs/btrfs.c +new file mode 100644 +index 0000000..e5abed6 +--- /dev/null ++++ b/libparted/fs/btrfs/btrfs.c +@@ -0,0 +1,78 @@ ++/* ++ libparted - a library for manipulating disk partitions ++ Copyright (C) 2013 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++*/ ++ ++#include ++ ++#include ++#include ++ ++/* Located 64k inside the partition (start of the first btrfs superblock) */ ++#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */ ++#define BTRFS_CSUM_SIZE 32 ++#define BTRFS_FSID_SIZE 16 ++ ++ ++static PedGeometry* ++btrfs_probe (PedGeometry* geom) ++{ ++ union { ++ struct { ++ /* Just enough of the btrfs_super_block to get the magic */ ++ uint8_t csum[BTRFS_CSUM_SIZE]; ++ uint8_t fsid[BTRFS_FSID_SIZE]; ++ uint64_t bytenr; ++ uint64_t flags; ++ uint64_t magic; ++ } sb; ++ int8_t sector[8192]; ++ } buf; ++ PedSector offset = (64*1024)/geom->dev->sector_size; ++ ++ if (geom->length < offset+1) ++ return 0; ++ if (!ped_geometry_read (geom, &buf, offset, 1)) ++ return 0; ++ ++ if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) { ++ return ped_geometry_new (geom->dev, geom->start, geom->length); ++ } ++ return NULL; ++} ++ ++static PedFileSystemOps btrfs_ops = { ++ probe: btrfs_probe, ++}; ++ ++static PedFileSystemType btrfs_type = { ++ next: NULL, ++ ops: &btrfs_ops, ++ name: "btrfs", ++ block_sizes: ((int[2]){512, 0}) ++}; ++ ++void ++ped_file_system_btrfs_init () ++{ ++ ped_file_system_type_register (&btrfs_type); ++} ++ ++void ++ped_file_system_btrfs_done () ++{ ++ ped_file_system_type_unregister (&btrfs_type); ++} +diff --git a/libparted/libparted.c b/libparted/libparted.c +index a6d86f0..3c3b337 100644 +--- a/libparted/libparted.c ++++ b/libparted/libparted.c +@@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (void); + extern void ped_file_system_fat_init (void); + extern void ped_file_system_ext2_init (void); + extern void ped_file_system_nilfs2_init (void); ++extern void ped_file_system_btrfs_init (void); + + static void + init_file_system_types () +@@ -124,6 +125,7 @@ init_file_system_types () + ped_file_system_fat_init (); + ped_file_system_ext2_init (); + ped_file_system_nilfs2_init (); ++ ped_file_system_btrfs_init (); + } + + extern void ped_disk_aix_done (); +@@ -186,6 +188,7 @@ extern void ped_file_system_reiserfs_done (void); + extern void ped_file_system_ufs_done (void); + extern void ped_file_system_xfs_done (void); + extern void ped_file_system_amiga_done (void); ++extern void ped_file_system_btrfs_done (void); + + static void + done_file_system_types () +@@ -201,6 +204,7 @@ done_file_system_types () + ped_file_system_ufs_done (); + ped_file_system_xfs_done (); + ped_file_system_amiga_done (); ++ ped_file_system_btrfs_done (); + } + + static void _done() __attribute__ ((destructor)); +-- +1.8.3.1 + diff --git a/SOURCES/parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch b/SOURCES/parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch new file mode 100644 index 0000000..81f73a8 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch @@ -0,0 +1,1058 @@ +Subject: [PATCH] libparted: add support for EAV DASD partitions + +From: Nageswara R Sastry + +Extended Address Volume (EAV) DASDs are ECKD DASDs with more than +65520 cylinders. This patch adds support for recognizing and +modifying partitions on EAV DASDs to Parted. The changes are +based on the EAV support added to version 1.8.1 [1] of the +s390-tools package. + +[1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html + +Signed-off-by: Nageswara R Sastry +Signed-off-by: Peter Oberparleiter + +--- + include/parted/fdasd.h | 89 ++++++++++++++++-- + include/parted/vtoc.h | 58 ++++++++++-- + libparted/labels/dasd.c | 1 + libparted/labels/fdasd.c | 226 ++++++++++++++++++++++++++++++++--------------- + libparted/labels/vtoc.c | 173 ++++++++++++++++++++++++++++++----- + 5 files changed, 435 insertions(+), 112 deletions(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -74,6 +74,80 @@ typedef struct dasd_information_t { + char configuration_data[256]; /* from read_configuration_data */ + } dasd_information_t; + ++struct dasd_eckd_characteristics { ++ unsigned short cu_type; ++ struct { ++ unsigned char support:2; ++ unsigned char async:1; ++ unsigned char reserved:1; ++ unsigned char cache_info:1; ++ unsigned char model:3; ++ } __attribute__ ((packed)) cu_model; ++ unsigned short dev_type; ++ unsigned char dev_model; ++ struct { ++ unsigned char mult_burst:1; ++ unsigned char RT_in_LR:1; ++ unsigned char reserved1:1; ++ unsigned char RD_IN_LR:1; ++ unsigned char reserved2:4; ++ unsigned char reserved3:8; ++ unsigned char defect_wr:1; ++ unsigned char XRC_supported:1; ++ unsigned char reserved4:1; ++ unsigned char striping:1; ++ unsigned char reserved5:4; ++ unsigned char cfw:1; ++ unsigned char reserved6:2; ++ unsigned char cache:1; ++ unsigned char dual_copy:1; ++ unsigned char dfw:1; ++ unsigned char reset_alleg:1; ++ unsigned char sense_down:1; ++ } __attribute__ ((packed)) facilities; ++ unsigned char dev_class; ++ unsigned char unit_type; ++ unsigned short no_cyl; ++ unsigned short trk_per_cyl; ++ unsigned char sec_per_trk; ++ unsigned char byte_per_track[3]; ++ unsigned short home_bytes; ++ unsigned char formula; ++ union { ++ struct { ++ unsigned char f1; ++ unsigned short f2; ++ unsigned short f3; ++ } __attribute__ ((packed)) f_0x01; ++ struct { ++ unsigned char f1; ++ unsigned char f2; ++ unsigned char f3; ++ unsigned char f4; ++ unsigned char f5; ++ } __attribute__ ((packed)) f_0x02; ++ } __attribute__ ((packed)) factors; ++ unsigned short first_alt_trk; ++ unsigned short no_alt_trk; ++ unsigned short first_dia_trk; ++ unsigned short no_dia_trk; ++ unsigned short first_sup_trk; ++ unsigned short no_sup_trk; ++ unsigned char MDR_ID; ++ unsigned char OBR_ID; ++ unsigned char director; ++ unsigned char rd_trk_set; ++ unsigned short max_rec_zero; ++ unsigned char reserved1; ++ unsigned char RWANY_in_LR; ++ unsigned char factor6; ++ unsigned char factor7; ++ unsigned char factor8; ++ unsigned char reserved2[3]; ++ unsigned char reserved3[6]; ++ unsigned int long_no_cyl; ++} __attribute__ ((packed)); ++ + /* + * struct format_data_t + * represents all data necessary to format a dasd +@@ -116,18 +190,6 @@ typedef struct format_data_t { + #define BLKRRPART _IO(0x12,95) + /* get block device sector size */ + #define BLKSSZGET _IO(0x12,104) +- +-/***************************************************************************** +- * SECTION: Definition from hdreq.h * +- *****************************************************************************/ +- +-struct fdasd_hd_geometry { +- unsigned char heads; +- unsigned char sectors; +- unsigned short cylinders; +- unsigned long start; +-}; +- + /* get device geometry */ + #define HDIO_GETGEO 0x0301 + +@@ -189,10 +251,13 @@ typedef struct fdasd_anchor { + format4_label_t *f4; + format5_label_t *f5; + format7_label_t *f7; ++ format9_label_t *f9; /* template for all f9 labels */ + partition_info_t *first; + partition_info_t *last; + volume_label_t *vlabel; + config_data_t confdata[USABLE_PARTITIONS]; ++ u_int32_t hw_cylinders; ++ u_int32_t formatted_cylinders; + struct fdasd_hd_geometry geo; + unsigned int label_block; + unsigned int FBA_layout; +--- a/include/parted/vtoc.h ++++ b/include/parted/vtoc.h +@@ -42,7 +42,18 @@ + + #define VOLSER_LENGTH 6 + #define BIG_DISK_SIZE 0x10000 ++#define LV_COMPAT_CYL 0xFFFE + ++/***************************************************************************** ++ * SECTION: Definition from hdreq.h * ++ *****************************************************************************/ ++ ++struct fdasd_hd_geometry { ++ unsigned char heads; ++ unsigned char sectors; ++ unsigned short cylinders; ++ unsigned long start; ++}; + + typedef struct ttr ttr_t; + typedef struct cchhb cchhb_t; +@@ -59,6 +70,7 @@ typedef struct ds5ext ds5ext_t + typedef struct format5_label format5_label_t; + typedef struct ds7ext ds7ext_t; + typedef struct format7_label format7_label_t; ++typedef struct format9_label format9_label_t; + + struct __attribute__ ((packed)) ttr { + u_int16_t tt; +@@ -169,6 +181,10 @@ struct __attribute__ ((packed)) dev_cons + u_int8_t DS4DEVDB; /* number of directory blocks per track */ + }; + ++/* ++ * format 1 and format 8 label have the same layout so we use the following ++ * structure for both. ++ */ + struct __attribute__ ((packed)) format1_label { + char DS1DSNAM[44]; /* data set name */ + u_int8_t DS1FMTID; /* format identifier */ +@@ -229,7 +245,11 @@ struct __attribute__ ((packed)) format4_ + char res2[10]; /* reserved */ + u_int8_t DS4EFLVL; /* extended free-space management level */ + cchhb_t DS4EFPTR; /* pointer to extended free-space info */ +- char res3[9]; /* reserved */ ++ char res3; /* reserved */ ++ u_int32_t DS4DCYL; /* number of logical cyls */ ++ char res4[2]; /* reserved */ ++ u_int8_t DS4DEVF2; /* device flags */ ++ char res5; /* reserved */ + }; + + struct __attribute__ ((packed)) ds5ext { +@@ -261,12 +281,28 @@ struct __attribute__ ((packed)) format7_ + cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ + }; + ++struct __attribute__ ((packed)) format9_label { ++ u_int8_t DS9KEYID; /* key code for format 9 labels (0x09) */ ++ u_int8_t DS9SUBTY; /* subtype (0x01) */ ++ u_int8_t DS9NUMF9; /* number of F9 datasets */ ++ u_int8_t res1[41]; /* reserved */ ++ u_int8_t DS9FMTID; /* format identifier */ ++ u_int8_t res2[95]; /* reserved */ ++}; ++ + char *vtoc_ebcdic_enc (char const *source, char *target, int l); + char *vtoc_ebcdic_dec (char const *source, char *target, int l); + void vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, + cchh_t *lower, cchh_t *upper); +-void vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh); +-void vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b); ++void vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh); ++u_int32_t vtoc_get_cyl_from_cchh(cchh_t *addr); ++u_int16_t vtoc_get_head_from_cchh(cchh_t *addr); ++void vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b); ++u_int32_t vtoc_get_cyl_from_cchhb(cchhb_t *addr); ++u_int16_t vtoc_get_head_from_cchhb(cchhb_t *addr); ++u_int64_t cchhb2blk(cchhb_t *p, struct fdasd_hd_geometry *geo); ++u_int64_t cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo); ++u_int32_t cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo); + void vtoc_set_date (labeldate_t *d, u_int8_t year, u_int16_t day); + + void vtoc_volume_label_init (volume_label_t *vlabel); +@@ -295,14 +331,16 @@ void vtoc_write_label (int fd, unsigned + format1_label_t const *f1, + format4_label_t const *f4, + format5_label_t const *f5, +- format7_label_t const *f7); ++ format7_label_t const *f7, ++ format9_label_t const *f9); + + void vtoc_init_format1_label (char *volid, unsigned int blksize, + extent_t *part_extent, format1_label_t *f1); + + void vtoc_init_format4_label (format4_label_t *f4lbl, + unsigned int usable_partitions, +- unsigned int cylinders, ++ unsigned int compat_cylinders, ++ unsigned int real_cylinders, + unsigned int tracks, + unsigned int blocks, + unsigned int blksize, +@@ -329,8 +367,16 @@ void vtoc_update_format7_label_add (form + void vtoc_update_format7_label_del (format7_label_t *f7, int verbose, + u_int32_t a, u_int32_t b); + ++void vtoc_init_format8_label (char *volid, unsigned int blksize, ++ extent_t *part_extent, format1_label_t *f1); ++ ++void vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8); ++ ++void vtoc_init_format9_label (format9_label_t *f9); ++ + void vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, + format7_label_t *f7, char ch, int verbose, +- u_int32_t start, u_int32_t stop, int cyl, int trk); ++ u_int32_t start, u_int32_t stop, u_int32_t cyl, ++ u_int32_t trk); + + #endif /* VTOC_H */ +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -631,6 +631,7 @@ dasd_write (const PedDisk* disk) + /* initialize the anchor */ + fdasd_initialize_anchor(&anchor); + fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); ++ fdasd_check_volume(&anchor, arch_specific->fd); + memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t)); + anchor.vlabel_changed++; + +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -59,6 +59,48 @@ setpos (fdasd_anchor_t *anc, int dsn, in + anc->partno[dsn] = pos; + } + ++static u_int32_t ++get_usable_cylinders (fdasd_anchor_t *anc) ++{ ++ u_int32_t cyl; ++ ++ /* large volume */ ++ if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && ++ anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) ++ return anc->f4->DS4DCYL; ++ /* normal volume */ ++ if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) ++ cyl = anc->f4->DS4DEVCT.DS4DSCYL - ++ (u_int16_t) anc->f4->DS4DEVAC; ++ else ++ cyl = anc->f4->DS4DEVCT.DS4DSCYL; ++ return cyl; ++} ++ ++static void ++get_addr_of_highest_f1_f8_label (fdasd_anchor_t *anc, cchhb_t *addr) ++{ ++ ++ u_int8_t record; ++ /* We have to count the follwing labels: ++ * one format 4 ++ * one format 5 ++ * format 7 only if we have moren then BIG_DISK_SIZE tracks ++ * one for each format 1 or format 8 label == one for each partition ++ * one for each format 9 label before the last format 8 ++ * We assume that all partitions use format 8 labels when ++ * anc->formatted_cylinders > LV_COMPAT_CYL ++ * Note: Record zero is special, so block 0 on our disk is record 1! ++ */ ++ ++ record = anc->used_partitions + 2; ++ if (anc->big_disk) ++ record++; ++ if (anc->formatted_cylinders > LV_COMPAT_CYL) ++ record += anc->used_partitions - 1; ++ vtoc_set_cchhb(addr, VTOC_START_CC, VTOC_START_HH, record); ++} ++ + void + fdasd_cleanup (fdasd_anchor_t *anchor) + { +@@ -72,6 +114,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) + free(anchor->f4); + free(anchor->f5); + free(anchor->f7); ++ free(anchor->f9); + free(anchor->vlabel); + + p = anchor->first; +@@ -82,6 +125,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) + if (p == NULL) + return; + q = p->next; ++ free(p->f1); + free(p); + p = q; + } +@@ -154,17 +198,6 @@ fdasd_error (fdasd_anchor_t *anc, enum f + } + + /* +- * converts cyl-cyl-head-head-blk to blk +- */ +-static unsigned long +-cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) +-{ +- PDEBUG +- return (unsigned long) (p->cc * geo->heads * geo->sectors +- + p->hh * geo->sectors + p->b); +-} +- +-/* + * initializes the anchor structure and allocates some + * memory for the labels + */ +@@ -216,9 +249,16 @@ fdasd_initialize_anchor (fdasd_anchor_t + if (anc->f7 == NULL) + fdasd_error(anc, malloc_failed, "FMT7 DSCB."); + ++ /* template for all format 9 labels */ ++ anc->f9 = malloc(sizeof(format9_label_t)); ++ if (anc->f9 == NULL) ++ fdasd_error(anc, malloc_failed, "FMT9 DSCB."); ++ + bzero(anc->f4, sizeof(format4_label_t)); + bzero(anc->f5, sizeof(format5_label_t)); + bzero(anc->f7, sizeof(format7_label_t)); ++ bzero(anc->f9, sizeof(format9_label_t)); ++ vtoc_init_format9_label(anc->f9); + + v = malloc(sizeof(volume_label_t)); + if (v == NULL) +@@ -259,6 +299,8 @@ fdasd_initialize_anchor (fdasd_anchor_t + + q = p; + } ++ anc->hw_cylinders = 0; ++ anc->formatted_cylinders = 0; + } + + /* +@@ -269,44 +311,46 @@ fdasd_write_vtoc_labels (fdasd_anchor_t + { + PDEBUG + partition_info_t *p; +- unsigned long b; ++ unsigned long b, maxblk; + char dsno[6], s1[7], s2[45], *c1, *c2, *ch; + int i = 0, k = 0; ++ cchhb_t f9addr; ++ format1_label_t emptyf1; + + b = (cchhb2blk (&anc->vlabel->vtoc, &anc->geo) - 1) * anc->blksize; + if (b <= 0) + fdasd_error (anc, vlabel_corrupted, ""); ++ maxblk = b + anc->blksize * 9; /* f4+f5+f7+3*f8+3*f9 */ + + /* write FMT4 DSCB */ +- vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL); ++ vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL, NULL); ++ b += anc->blksize; + + /* write FMT5 DSCB */ ++ vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL, NULL); + b += anc->blksize; +- vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL); + + /* write FMT7 DSCB */ + if (anc->big_disk) { ++ vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7, NULL); + b += anc->blksize; +- vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7); + } + +- /* loop over all FMT1 DSCBs */ +- p = anc->first; +- for (i = 0; i < USABLE_PARTITIONS; i++) { +- b += anc->blksize; ++ /* loop over all partitions (format 1 or format 8 DCB) */ ++ for (p = anc->first; p != NULL; p = p->next) { + + if (p->used != 0x01) { +- vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); + continue; + } + ++ i++; + strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); + + ch = p->f1->DS1DSNAM; + vtoc_ebcdic_dec (ch, ch, 44); + c1 = ch + 7; + +- if (getdsn (anc, i) > -1) { ++ if (getdsn (anc, i-1) > -1) { + /* re-use the existing data set name */ + c2 = strchr (c1, '.'); + if (c2 != NULL) +@@ -325,11 +369,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t + while (getpos (anc, k) > -1) + k++; + +- setpos (anc, k, i); +- +- strncpy (s2, ch, 44); +- s2[44] = 0; +- vtoc_ebcdic_dec (s2, s2, 44); ++ setpos (anc, k, i-1); + + strncpy (ch, "LINUX.V " " ", 44); + +@@ -366,8 +406,32 @@ fdasd_write_vtoc_labels (fdasd_anchor_t + + vtoc_ebcdic_enc (ch, ch, 44); + +- vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); +- p = p->next; ++ if (p->f1->DS1FMTID == 0xf8 ) { ++ /* Now as we know where which label will be written, we ++ * can add the address of the format 9 label to the ++ * format 8 label. The f9 record will be written to the ++ * block after the current blk. Remember: records are of ++ * by one, so we have to add 2 and not just one. ++ */ ++ vtoc_set_cchhb(&f9addr, VTOC_START_CC, VTOC_START_HH, ++ ((b / anc->blksize) % anc->geo.sectors) + 2); ++ vtoc_update_format8_label(&f9addr, p->f1); ++ vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); ++ b += anc->blksize; ++ vtoc_write_label(fd, b, NULL, NULL, NULL, NULL, ++ anc->f9); ++ b += anc->blksize; ++ } else { ++ vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); ++ b += anc->blksize; ++ } ++ } ++ ++ /* write empty labels to the rest of the blocks */ ++ bzero(&emptyf1, sizeof(emptyf1)); ++ while (b < maxblk) { ++ vtoc_write_label(fd, b, &emptyf1, NULL, NULL, NULL, NULL); ++ b += anc->blksize; + } + } + +@@ -394,20 +458,25 @@ int + fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) + { + PDEBUG +- partition_info_t *p = anc->first; ++ partition_info_t *p; + char dsno[6], s1[7], s2[45], *c1, *c2, *ch; + int i = 0, k = 0; + +- /* loop over all FMT1 DSCBs */ +- p = anc->first; +- for (i = 0; i < USABLE_PARTITIONS; i++) { ++ /* loop over all partitions (format 1 or format 8 DCB) */ ++ for (p = anc->first; p != NULL; p = p->next) { ++ ++ if (p->used != 0x01) { ++ continue; ++ } ++ ++ i++; + strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); + + ch = p->f1->DS1DSNAM; + vtoc_ebcdic_dec (ch, ch, 44); + c1 = ch + 7; + +- if (getdsn (anc, i) > -1) { ++ if (getdsn (anc, i-1) > -1) { + /* re-use the existing data set name */ + c2 = strchr (c1, '.'); + if (c2 != NULL) +@@ -426,11 +495,7 @@ fdasd_prepare_labels (fdasd_anchor_t *an + while (getpos (anc, k) > -1) + k++; + +- setpos (anc, k, i); +- +- strncpy (s2, ch, 44); +- s2[44] = 0; +- vtoc_ebcdic_dec (s2, s2, 44); ++ setpos (anc, k, i-1); + + strncpy (ch, "LINUX.V " " ", 44); + +@@ -466,7 +531,6 @@ fdasd_prepare_labels (fdasd_anchor_t *an + } + + vtoc_ebcdic_enc (ch, ch, 44); +- p = p->next; + } + + return 1; +@@ -482,6 +546,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc + vtoc_init_format4_label(anc->f4, + USABLE_PARTITIONS, + anc->geo.cylinders, ++ anc->formatted_cylinders, + anc->geo.heads, + anc->geo.sectors, + anc->blksize, +@@ -492,8 +557,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc + vtoc_set_freespace(anc->f4, anc->f5, anc->f7, + '+', anc->verbose, + FIRST_USABLE_TRK, +- anc->geo.cylinders * anc->geo.heads - 1, +- anc->geo.cylinders, anc->geo.heads); ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); + + for (i = 0; i < USABLE_PARTITIONS; i++) { + bzero(p->f1, sizeof(format1_label_t)); +@@ -507,7 +572,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc + } + + anc->used_partitions = 0; +- anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - ++ FIRST_USABLE_TRK; + + for (i=0; ifirst; +- unsigned int h = anc->geo.heads; +- unsigned long max = anc->geo.cylinders * h - 1; ++ unsigned long max = anc->formatted_cylinders * anc->geo.heads - 1; + int i; + char *ch; + + anc->used_partitions = anc->geo.sectors - 2 - anc->f4->DS4DSREC; + + for (i = 1; i <= USABLE_PARTITIONS; i++) { +- if (p->f1->DS1FMTID != 0xf1) { ++ if (p->f1->DS1FMTID != 0xf1 && ++ p->f1->DS1FMTID != 0xf8) { + if (i == 1) + /* there is no partition at all */ + anc->fspace_trk = max - FIRST_USABLE_TRK + 1; +@@ -546,8 +612,8 @@ fdasd_update_partition_info (fdasd_ancho + + /* this is a valid format 1 label */ + p->used = 0x01; +- p->start_trk = p->f1->DS1EXT1.llimit.cc * h + p->f1->DS1EXT1.llimit.hh; +- p->end_trk = p->f1->DS1EXT1.ulimit.cc * h + p->f1->DS1EXT1.ulimit.hh; ++ p->start_trk = cchh2trk(&p->f1->DS1EXT1.llimit, &anc->geo); ++ p->end_trk = cchh2trk(&p->f1->DS1EXT1.ulimit, &anc->geo); + p->len_trk = p->end_trk - p->start_trk + 1; + + if (i == 1) { +@@ -618,14 +684,22 @@ fdasd_process_valid_vtoc (fdasd_anchor_t + format1_label_t q; + char s[5], *ch; + ++ if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && ++ anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) ++ anc->formatted_cylinders = anc->f4->DS4DCYL; ++ else ++ anc->formatted_cylinders = anc->f4->DS4DEVCT.DS4DSCYL; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - ++ FIRST_USABLE_TRK; + b += anc->blksize; + +- for (i = 1; i <= anc->geo.sectors; i++) { ++ for (i = 1; i < anc->geo.sectors; i++) { + bzero (&q, f1size); + vtoc_read_label (fd, b, &q, NULL, NULL, NULL); + + switch (q.DS1FMTID) { + case 0xf1: ++ case 0xf8: + if (p == NULL) + break; + memcpy (p->f1, &q, f1size); +@@ -669,6 +743,12 @@ fdasd_process_valid_vtoc (fdasd_anchor_t + memcpy (anc->f7, &q, f1size); + f7_counter++; + break; ++ case 0xf9: ++ /* each format 8 lable has an associated ++ * format 9 lable, but they are of no further ++ * use to us. ++ */ ++ break; + } + + b += anc->blksize; +@@ -718,7 +798,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, + { + PDEBUG + volume_label_t *v = anc->vlabel; +- unsigned long b = -1; ++ long long b = -1; + char str[LINE_LENGTH]; + + memset(v, 0, sizeof(volume_label_t)); +@@ -784,6 +864,7 @@ fdasd_get_geometry (const PedDevice *dev + PDEBUG + int blksize = 0; + dasd_information_t dasd_info; ++ struct dasd_eckd_characteristics *characteristics; + + /* We can't get geometry from a regular file, + so simulate something usable, for the sake of testing. */ +@@ -803,6 +884,8 @@ fdasd_get_geometry (const PedDevice *dev + dasd_info.devno = 513; + dasd_info.label_block = 2; + dasd_info.FBA_layout = 0; ++ anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / ++ anc->geo.heads; + } else { + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + fdasd_error(anc, unable_to_ioctl, +@@ -816,13 +899,20 @@ fdasd_get_geometry (const PedDevice *dev + if (ioctl(f, BIODASDINFO, &dasd_info) != 0) + fdasd_error(anc, unable_to_ioctl, + _("Could not retrieve disk information.")); ++ ++ characteristics = (struct dasd_eckd_characteristics *) ++ &dasd_info.characteristics; ++ if (characteristics->no_cyl == LV_COMPAT_CYL && ++ characteristics->long_no_cyl) ++ anc->hw_cylinders = characteristics->long_no_cyl; ++ else ++ anc->hw_cylinders = characteristics->no_cyl; + } + + anc->dev_type = dasd_info.dev_type; + anc->blksize = blksize; + anc->label_pos = dasd_info.label_block * blksize; + anc->devno = dasd_info.devno; +- anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; + anc->label_block = dasd_info.label_block; + anc->FBA_layout = dasd_info.FBA_layout; + } +@@ -850,20 +940,17 @@ fdasd_get_partition_data (fdasd_anchor_t + unsigned int *stop_ptr) + { + PDEBUG +- unsigned int limit, cc, hh; ++ unsigned int limit; ++ u_int32_t cc, c; ++ u_int16_t hh, h; + cchh_t llimit, ulimit; + partition_info_t *q; + u_int8_t b1, b2; +- u_int16_t c, h; + unsigned int start = *start_ptr, stop = *stop_ptr; + int i; + char *ch; + +- if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) +- c = anc->f4->DS4DEVCT.DS4DSCYL - (u_int16_t) anc->f4->DS4DEVAC; +- else +- c = anc->f4->DS4DEVCT.DS4DSCYL; +- ++ c = get_usable_cylinders(anc); + h = anc->f4->DS4DEVCT.DS4DSTRK; + limit = (h * c - 1); + +@@ -1019,7 +1106,6 @@ fdasd_add_partition (fdasd_anchor_t *anc + cchhb_t hf1; + partition_info_t *p; + extent_t ext; +- int i; + + PDEBUG; + +@@ -1032,8 +1118,14 @@ fdasd_add_partition (fdasd_anchor_t *anc + if (fdasd_get_partition_data(anc, &ext, p, &start, &stop) != 0) + return 0; + +- PDEBUG; +- vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, p->f1); ++ if (anc->formatted_cylinders > LV_COMPAT_CYL) { ++ vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext, ++ p->f1); ++ } else { ++ PDEBUG; ++ vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, ++ p->f1); ++ } + + PDEBUG; + fdasd_enqueue_new_partition(anc); +@@ -1041,23 +1133,17 @@ fdasd_add_partition (fdasd_anchor_t *anc + PDEBUG; + anc->used_partitions += 1; + +- i = anc->used_partitions + 2; +- if (anc->big_disk) +- i++; +- PDEBUG; +- +- vtoc_set_cchhb(&hf1, VTOC_START_CC, VTOC_START_HH, i); +- ++ get_addr_of_highest_f1_f8_label(anc, &hf1); + vtoc_update_format4_label(anc->f4, &hf1, anc->f4->DS4DSREC - 1); + + PDEBUG; + +- start = ext.llimit.cc * anc->geo.heads + ext.llimit.hh; +- stop = ext.ulimit.cc * anc->geo.heads + ext.ulimit.hh; ++ start = cchh2trk(&ext.llimit, &anc->geo); ++ stop = cchh2trk(&ext.ulimit, &anc->geo); + + PDEBUG; + vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '-', anc->verbose, +- start, stop, anc->geo.cylinders, anc->geo.heads); ++ start, stop, anc->formatted_cylinders, anc->geo.heads); + + anc->vtoc_changed++; + +--- a/libparted/labels/vtoc.c ++++ b/libparted/labels/vtoc.c +@@ -218,11 +218,32 @@ vtoc_set_extent (extent_t *ext, u_int8_t + } + + void +-vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh) ++vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh) + { + PDEBUG +- addr->cc = cc; +- addr->hh = hh; ++ addr->cc = (u_int16_t) cc; ++ addr->hh = cc >> 16; ++ addr->hh <<= 4; ++ addr->hh |= hh; ++} ++ ++u_int32_t ++vtoc_get_cyl_from_cchh (cchh_t *addr) ++{ ++ u_int32_t cyl; ++ ++ /*decode cylinder for large volumes */ ++ cyl = addr->hh & 0xFFF0; ++ cyl <<= 12; ++ cyl |= addr->cc; ++ return cyl; ++} ++ ++u_int16_t ++vtoc_get_head_from_cchh (cchh_t *addr) ++{ ++ /* decode heads for large volumes */ ++ return addr->hh & 0x000F; + } + + static void +@@ -234,12 +255,63 @@ vtoc_set_ttr (ttr_t *addr, u_int16_t tt, + } + + void +-vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) ++vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b) + { + PDEBUG +- addr->cc = cc; +- addr->hh = hh; +- addr->b = b; ++ addr->cc = (u_int16_t) cc; ++ addr->hh = cc >> 16; ++ addr->hh <<= 4; ++ addr->hh |= hh; ++ addr->b = b; ++} ++ ++u_int32_t ++vtoc_get_cyl_from_cchhb(cchhb_t *addr) ++{ ++ u_int32_t cyl; ++ ++ /* decode cylinder for large volumes */ ++ cyl = addr->hh & 0xFFF0; ++ cyl <<= 12; ++ cyl |= addr->cc; ++ return cyl; ++} ++ ++u_int16_t ++vtoc_get_head_from_cchhb(cchhb_t *addr) ++{ ++ /* decode heads for large volumes */ ++ return addr->hh & 0x000F; ++} ++ ++/* ++ * some functions to convert cyl-cyl-head-head addresses to ++ * block or track numbers ++ * Note: Record zero is special, so first block on a track is ++ * in record 1! ++ */ ++u_int64_t ++cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) ++{ ++ return (u_int64_t) vtoc_get_cyl_from_cchhb(p) * ++ geo->heads * geo->sectors + ++ vtoc_get_head_from_cchhb(p) * geo->sectors + ++ p->b; ++} ++ ++u_int64_t ++cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo) ++{ ++ return (u_int64_t) vtoc_get_cyl_from_cchh(p) * ++ geo->heads * geo->sectors + ++ vtoc_get_head_from_cchh(p) * geo->sectors; ++} ++ ++u_int32_t ++cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo) ++{ ++ return vtoc_get_cyl_from_cchh(p) * geo->heads + ++ vtoc_get_head_from_cchh(p); + } + + void +@@ -506,7 +578,8 @@ vtoc_write_label (int f, unsigned long p + format1_label_t const *f1, + format4_label_t const *f4, + format5_label_t const *f5, +- format7_label_t const *f7) ++ format7_label_t const *f7, ++ format9_label_t const *f9) + { + PDEBUG + int t; +@@ -542,6 +615,17 @@ vtoc_write_label (int f, unsigned long p + vtoc_error(unable_to_write, "vtoc_write_label", + _("Could not write VTOC FMT7 DSCB.")); + } ++ ++ if (f9 != NULL) ++ { ++ t = sizeof(format9_label_t); ++ if (write(f, f9, t) != t) ++ { ++ close(f); ++ vtoc_error(unable_to_write, "vtoc_write_label", ++ _("Could not write VTOC FMT9 DSCB.")); ++ } ++ } + } + + /* +@@ -549,7 +633,8 @@ vtoc_write_label (int f, unsigned long p + */ + void + vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, +- unsigned int cylinders, unsigned int tracks, ++ unsigned int compat_cylinders, ++ unsigned int real_cylinders, unsigned int tracks, + unsigned int blocks, unsigned int blksize, + u_int16_t dev_type) + { +@@ -574,7 +659,7 @@ vtoc_init_format4_label (format4_label_t + f4->DS4DEVAC = 0x00; + + /* -- begin f4->DS4DEVCT -- */ +- f4->DS4DEVCT.DS4DSCYL = cylinders; ++ f4->DS4DEVCT.DS4DSCYL = compat_cylinders; + f4->DS4DEVCT.DS4DSTRK = tracks; + + switch (dev_type) { +@@ -613,7 +698,11 @@ vtoc_init_format4_label (format4_label_t + bzero(f4->res2, sizeof(f4->res2)); + f4->DS4EFLVL = 0x00; + bzero(&f4->DS4EFPTR, sizeof(f4->DS4EFPTR)); +- bzero(f4->res3, sizeof(f4->res3)); ++ bzero(&f4->res3, sizeof(f4->res3)); ++ f4->DS4DCYL = real_cylinders; ++ bzero(f4->res4, sizeof(f4->res4)); ++ f4->DS4DEVF2 = 0x40; /* allow format 8 and 9 labels */ ++ bzero(&f4->res5, sizeof(f4->res5)); + } + + /* +@@ -647,11 +736,12 @@ vtoc_init_format7_label (format7_label_t + } + + /* +- * initializes a format1 label ++ * helper function that initializes a most parts of a ++ * format1 or format 8 label, all but the field DS1FMTID + */ + void +-vtoc_init_format1_label (char *volid, unsigned int blksize, +- extent_t *part_extent, format1_label_t *f1) ++vtoc_init_format_1_8_label (char *volid, unsigned int blksize, ++ extent_t *part_extent, format1_label_t *f1) + { + PDEBUG + struct tm * creatime; +@@ -666,7 +756,6 @@ vtoc_init_format1_label (char *volid, un + sprintf(str, "PART .NEW "); + vtoc_ebcdic_enc(str, str, 44); + strncpy(f1->DS1DSNAM, str, 44); +- f1->DS1FMTID = 0xf1; + strncpy(f1->DS1DSSN, " ", 6); + f1->DS1VOLSQ = 0x0001; + +@@ -704,6 +793,37 @@ vtoc_init_format1_label (char *volid, un + vtoc_set_cchhb(&f1->DS1PTRDS, 0x0000, 0x0000, 0x00); + } + ++void ++vtoc_init_format1_label (char *volid, unsigned int blksize, ++ extent_t *part_extent, format1_label_t *f1) ++{ ++ vtoc_init_format_1_8_label(volid, blksize, part_extent, f1); ++ f1->DS1FMTID = 0xf1; ++} ++ ++void ++vtoc_init_format8_label (char *volid, unsigned int blksize, ++ extent_t *part_extent, format1_label_t *f8) ++{ ++ vtoc_init_format_1_8_label(volid, blksize, part_extent, f8); ++ f8->DS1FMTID = 0xf8; ++} ++ ++void ++vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8) ++{ ++ memcpy(&f8->DS1PTRDS, associated_f9, sizeof(*associated_f9)); ++} ++ ++void ++vtoc_init_format9_label (format9_label_t *f9) ++{ ++ f9->DS9KEYID = 0x09; ++ f9->DS9SUBTY = 0x01; ++ f9->DS9NUMF9 = 1; ++ f9->DS9FMTID = 0xf9; ++} ++ + /* + * do some updates to the VTOC format4 label + */ +@@ -1060,7 +1180,7 @@ vtoc_update_format7_label_add (format7_l + if ((ext->a + ext->b) == 0x00000000) + continue; + +- if ((ext->b + 1) == tmp->a) { ++ if (ext->b == tmp->a) { + /* this extent precedes the new one */ + ext->b = tmp->b; + bzero(tmp, sizeof(ds7ext_t)); +@@ -1074,7 +1194,7 @@ vtoc_update_format7_label_add (format7_l + continue; + } + +- if (ext->a == (tmp->b + 1)) { ++ if (ext->a == tmp->b) { + /* this extent succeeds the new one */ + ext->a = tmp->a; + bzero(tmp, sizeof(ds7ext_t)); +@@ -1119,7 +1239,7 @@ vtoc_update_format7_label_del (format7_l + + if ((a == ext->a) && (b < ext->b)) { + /* left-bounded in free space gap */ +- ext->a = b + 1; ++ ext->a = b; + + if (verbose) + puts ("FMT7 add extent: left-bounded"); +@@ -1130,7 +1250,7 @@ vtoc_update_format7_label_del (format7_l + + if ((a > ext->a) && (b == ext->b)) { + /* right-bounded in free space gap */ +- ext->b = a - 1; ++ ext->b = a; + + if (verbose) + puts ("FMT7 add extent: right-bounded"); +@@ -1141,8 +1261,8 @@ vtoc_update_format7_label_del (format7_l + + if ((a > ext->a) && (b < ext->b)) { + /* partition devides free space into 2 pieces */ +- vtoc_update_format7_label_add(f7, verbose, b+1, ext->b); +- ext->b = a - 1; ++ vtoc_update_format7_label_add(f7, verbose, b, ext->b); ++ ext->b = a; + + if (verbose) + puts ("FMT7 add extent: 2 pieces"); +@@ -1172,14 +1292,19 @@ vtoc_update_format7_label_del (format7_l + void + vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, + format7_label_t *f7, char ch, int verbose, +- u_int32_t start, u_int32_t stop, int cyl, int trk) ++ u_int32_t start, u_int32_t stop, u_int32_t cyl, ++ u_int32_t trk) + { + PDEBUG + if ((cyl * trk) > BIG_DISK_SIZE) { + if (ch == '+') +- vtoc_update_format7_label_add(f7, verbose, start, stop); ++ vtoc_update_format7_label_add(f7, verbose, start, ++ /* ds7ext RTA + 1 */ ++ stop + 1); + else if (ch == '-') +- vtoc_update_format7_label_del(f7, verbose, start, stop); ++ vtoc_update_format7_label_del(f7, verbose, start, ++ /* ds7ext RTA + 1 */ ++ stop + 1); + else + puts ("BUG: syntax error in vtoc_set_freespace call"); + diff --git a/SOURCES/parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch b/SOURCES/parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch new file mode 100644 index 0000000..95d2551 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch @@ -0,0 +1,187 @@ +Subject: [PATCH] libparted: add support for implicit FBA DASD partitions + +From: Nageswara R Sastry + +Fixed Block Access (FBA) DASDs are mainframe-specific disk devices +which are layed out as a sequence of 512-byte sectors. In contrast +to ECKD DASDs, these disks do not require formatting and resemble +the LBA layout of non-mainframe disks. Despite this resemblance, +the Linux kernel applies special handling during partition detection +for FBA DASDs, resulting in a single, immutable partition being +reported. + +While actual FBA DASD hardware is no longer available, the z/VM +hypervisor can simulate FBA DASD disks, backed by either ECKD or +SCSI devices. + +This patch adds support for recognizing FBA DASD partitions +to parted. + +Signed-off-by: Nageswara R Sastry +Signed-off-by: Peter Oberparleiter + +--- + include/parted/fdasd.h | 2 + + libparted/labels/dasd.c | 63 ++++++++++++++++++++++++++++++++++++++++------- + libparted/labels/fdasd.c | 5 +++ + 3 files changed, 61 insertions(+), 9 deletions(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -194,6 +194,8 @@ typedef struct fdasd_anchor { + volume_label_t *vlabel; + config_data_t confdata[USABLE_PARTITIONS]; + struct fdasd_hd_geometry geo; ++ unsigned int label_block; ++ unsigned int FBA_layout; + } fdasd_anchor_t; + + enum offset {lower, upper}; +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -71,6 +71,7 @@ typedef struct { + + typedef struct { + unsigned int format_type; ++ unsigned int label_block; + volume_label_t vlabel; + } DasdDiskSpecific; + +@@ -151,6 +152,7 @@ dasd_alloc (const PedDevice* dev) + + /* CDL format, newer */ + disk_specific->format_type = 2; ++ disk_specific->label_block = 2; + + /* Setup volume label (for fresh disks) */ + snprintf(volser, sizeof(volser), "0X%04X", arch_specific->devno); +@@ -226,7 +228,9 @@ dasd_probe (const PedDevice *dev) + + fdasd_check_api_version(&anchor, arch_specific->fd); + +- if (fdasd_check_volume(&anchor, arch_specific->fd)) ++ /* Labels are required on CDL formatted DASDs. */ ++ if (fdasd_check_volume(&anchor, arch_specific->fd) && ++ anchor.FBA_layout == 0) + goto error_cleanup; + + fdasd_cleanup(&anchor); +@@ -273,17 +277,53 @@ dasd_read (PedDisk* disk) + fdasd_initialize_anchor(&anchor); + + fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); ++ disk_specific->label_block = anchor.label_block; ++ ++ if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE) ++ anchor.big_disk++; + + /* check dasd for labels and vtoc */ +- if (fdasd_check_volume(&anchor, arch_specific->fd)) +- goto error_close_dev; ++ if (fdasd_check_volume(&anchor, arch_specific->fd)) { ++ DasdPartitionData* dasd_data; ++ ++ /* Kernel partitioning code will report 'implicit' partitions ++ * for non-CDL format DASDs even when there is no ++ * label/VTOC. */ ++ if (anchor.FBA_layout == 0) ++ goto error_close_dev; ++ ++ disk_specific->format_type = 1; ++ ++ /* Register implicit partition */ ++ ped_disk_delete_all (disk); ++ ++ start = (PedSector) arch_specific->real_sector_size / ++ (PedSector) disk->dev->sector_size * ++ (PedSector) (anchor.label_block + 1); ++ end = disk->dev->length - 1; ++ part = ped_partition_new (disk, PED_PARTITION_NORMAL, NULL, ++ start, end); ++ if (!part) ++ goto error_close_dev; ++ ++ part->num = 1; ++ part->fs_type = ped_file_system_probe (&part->geom); ++ dasd_data = part->disk_specific; ++ dasd_data->raid = 0; ++ dasd_data->lvm = 0; ++ dasd_data->type = 0; ++ ++ if (!ped_disk_add_partition (disk, part, NULL)) ++ goto error_close_dev; ++ ++ fdasd_cleanup(&anchor); ++ ++ return 1; ++ } + + /* Save volume label (read by fdasd_check_volume) for writing */ + memcpy(&disk_specific->vlabel, anchor.vlabel, sizeof(volume_label_t)); + +- if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE) +- anchor.big_disk++; +- + ped_disk_delete_all (disk); + + bool is_ldl = strncmp(anchor.vlabel->volkey, +@@ -348,7 +388,7 @@ dasd_read (PedDisk* disk) + / (long long) disk->dev->sector_size + * (long long) (cms_ptr->block_count - 1) - 1; + +- part = ped_partition_new (disk, PED_PARTITION_PROTECTED, NULL, start, end); ++ part = ped_partition_new (disk, PED_PARTITION_NORMAL, NULL, start, end); + if (!part) + goto error_close_dev; + +@@ -923,7 +963,12 @@ dasd_alloc_metadata (PedDisk* disk) + the start of the first partition */ + if (disk_specific->format_type == 1) { + part = ped_disk_get_partition(disk, 1); +- vtoc_end = part->geom.start - 1; ++ if (part) ++ vtoc_end = part->geom.start - 1; ++ else ++ vtoc_end = (PedSector) arch_specific->real_sector_size / ++ (PedSector) disk->dev->sector_size * ++ (PedSector) disk_specific->label_block; + } + else { + if (disk->dev->type == PED_DEVICE_FILE) +@@ -943,7 +988,7 @@ dasd_alloc_metadata (PedDisk* disk) + goto error; + } + +- if (disk_specific->format_type == 1) { ++ if (disk_specific->format_type == 1 && part) { + /* + For LDL or CMS there may be trailing metadata as well. + For example: the last block of a CMS reserved file, +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -721,6 +721,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, + unsigned long b = -1; + char str[LINE_LENGTH]; + ++ memset(v, 0, sizeof(volume_label_t)); + vtoc_read_volume_label (fd, anc->label_pos, v); + + if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) { +@@ -800,6 +801,8 @@ fdasd_get_geometry (const PedDevice *dev + dasd_info.dev_type = 13200; + dasd_info.label_block = 2; + dasd_info.devno = 513; ++ dasd_info.label_block = 2; ++ dasd_info.FBA_layout = 0; + } else { + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + fdasd_error(anc, unable_to_ioctl, +@@ -820,6 +823,8 @@ fdasd_get_geometry (const PedDevice *dev + anc->label_pos = dasd_info.label_block * blksize; + anc->devno = dasd_info.devno; + anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; ++ anc->label_block = dasd_info.label_block; ++ anc->FBA_layout = dasd_info.FBA_layout; + } + + /* diff --git a/SOURCES/parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch b/SOURCES/parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch new file mode 100644 index 0000000..11687b3 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch @@ -0,0 +1,91 @@ +From 9343e79fee796a142a4bd12674aa3fdb56526eb6 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 20 Mar 2012 16:08:25 -0700 +Subject: [PATCH 1/2] libparted: check PMBR before GPT partition table + (#805272) + +The UEFI spec requires that a valid GPT disk label have a PMBR +partition. This moves the PMBR check to before the GPT check, +exiting gpt_probe with a 0 if the PMBR is not valid. + +The previous behavior would cause problems in the following situation: + 1. format a disk as GPT + 2. re-format it as MSDOS using tools that don't understand GPT + +Subsequent operations with parted would then complain about the invlid +PMBR, but would not allow the disk to be used as a msdos disk. This +change causes parted to tread the disk as a msdos disk. + +* libparted/labels/gpt.c (gpt_probe): Move _pmbr_is_valid test +--- + libparted/labels/gpt.c | 44 +++++++++++++------------------------------- + 1 files changed, 13 insertions(+), 31 deletions(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 84bdc12..e57b3a2 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -465,6 +465,17 @@ gpt_probe (const PedDevice *dev) + if (dev->length <= 1) + return 0; + ++ void *label; ++ if (!ptt_read_sector (dev, 0, &label)) ++ return 0; ++ ++ if (!_pmbr_is_valid ((const LegacyMBR_t *) label)) ++ { ++ free (label); ++ return 0; ++ } ++ free (label); ++ + void *pth_raw = ped_malloc (pth_get_size (dev)); + if (ped_device_read (dev, pth_raw, 1, GPT_HEADER_SECTORS) + || ped_device_read (dev, pth_raw, dev->length - 1, GPT_HEADER_SECTORS)) +@@ -472,40 +483,11 @@ gpt_probe (const PedDevice *dev) + gpt = pth_new_from_raw (dev, pth_raw); + if (gpt->Signature == PED_CPU_TO_LE64 (GPT_HEADER_SIGNATURE)) + gpt_sig_found = 1; ++ pth_free (gpt); + } +- + free (pth_raw); + +- pth_free (gpt); +- +- if (!gpt_sig_found) +- return 0; +- +- void *label; +- if (!ptt_read_sector (dev, 0, &label)) +- return 0; +- +- int ok = 1; +- if (!_pmbr_is_valid ((const LegacyMBR_t *) label)) +- { +- int ex_status = ped_exception_throw +- (PED_EXCEPTION_WARNING, +- PED_EXCEPTION_YES_NO, +- _("%s contains GPT signatures, indicating that it has " +- "a GPT table. However, it does not have a valid " +- "fake msdos partition table, as it should. Perhaps " +- "it was corrupted -- possibly by a program that " +- "doesn't understand GPT partition tables. Or " +- "perhaps you deleted the GPT table, and are now " +- "using an msdos partition table. Is this a GPT " +- "partition table?"), +- dev->path); +- if (ex_status == PED_EXCEPTION_NO) +- ok = 0; +- } +- +- free (label); +- return ok; ++ return gpt_sig_found; + } + + static PedDisk * +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch b/SOURCES/parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch new file mode 100644 index 0000000..2390881 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch @@ -0,0 +1,37 @@ +From c17f0c2e68960969789427eca20ddab1b8e4fcc6 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 1 Nov 2012 16:22:42 -0700 +Subject: [PATCH] libparted: don't canonicalize /dev/md/ paths (#872361) + +This is the same issue we have with /dev/mapper/ paths that was fixed in +commit c1eb485b9fd8919e18f192d678bc52b0488e6ee0. When libparted +is used to setup the device the symlink should be used to reference it, +not the backing device name which could change. + +* libparted/device.c (ped_device_get): Don't canonicalize names + that start with "/dev/md/". +--- + libparted/device.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libparted/device.c b/libparted/device.c +index 738b320..cdcc117 100644 +--- a/libparted/device.c ++++ b/libparted/device.c +@@ -152,8 +152,11 @@ ped_device_get (const char* path) + char* normal_path = NULL; + + PED_ASSERT (path != NULL); +- /* Don't canonicalize /dev/mapper paths, see tests/symlink.c */ +- if (strncmp (path, "/dev/mapper/", 12)) ++ /* Don't canonicalize /dev/mapper or /dev/md/ paths, see ++ tests/symlink.c ++ */ ++ if (strncmp (path, "/dev/mapper/", 12) && ++ strncmp (path, "/dev/md/", 8)) + normal_path = canonicalize_file_name (path); + if (!normal_path) + /* Well, maybe it is just that the file does not exist. +-- +1.7.11.7 + diff --git a/SOURCES/parted-3.1-libparted-mklabel-eav.patch b/SOURCES/parted-3.1-libparted-mklabel-eav.patch new file mode 100644 index 0000000..a8bc228 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-mklabel-eav.patch @@ -0,0 +1,151 @@ +Subject: [PATCH] libparted: mklabel to support EAV DASD + +From: Nageswara R Sastry + +Extended Address Volume (EAV) DASDs are ECKD DASDs with more than +65520 cylinders. This patch adds support for mklabel to properly +handle unformatted EAV DASDs. + +Signed-off-by: Nageswara R Sastry +--- + include/parted/fdasd.h | 1 + libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 90 insertions(+), 3 deletions(-) + +--- a/include/parted/fdasd.h ++++ b/include/parted/fdasd.h +@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice + void fdasd_check_api_version (fdasd_anchor_t *anc, int fd); + int fdasd_check_volume (fdasd_anchor_t *anc, int fd); + int fdasd_write_labels (fdasd_anchor_t *anc, int fd); +-int fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc); + void fdasd_recreate_vtoc(fdasd_anchor_t *anc); + partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc, + unsigned int start, unsigned int stop); +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc + anc->vtoc_changed++; + } + ++ /* ++ * initialize the VOL1 volume label ++ */ ++static void ++fdasd_init_volume_label(fdasd_anchor_t *anc, int fd) ++{ ++ volume_label_t *vlabel = anc->vlabel; ++ ++ vtoc_volume_label_init(vlabel); ++ vtoc_volume_label_set_key(vlabel, "VOL1"); ++ vtoc_volume_label_set_label(vlabel, "VOL1"); ++ ++ vtoc_set_cchhb(&vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); ++} ++ ++ + /* + * sets some important partition data + * (like used, start_trk, end_trk, len_trk) +@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t + fdasd_update_partition_info (anc); + } + ++static void ++fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc) ++{ ++ PDEBUG ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, ++ FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++ ++ vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); ++} ++ ++/* ++ * we have a invalid FMT4 DSCB and therefore we will re-create the VTOC ++ */ ++static void ++fdasd_process_invalid_vtoc(fdasd_anchor_t *anc) ++{ ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, ++ FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++} ++ ++ + static int + fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) + { +@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t + if (anc->f4->DS4IDFMT == 0xf4) { + fdasd_process_valid_vtoc (anc, b, fd); + return 0; ++ } else { ++ fdasd_process_invalid_vtoc(anc); + } + if (strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("LNX1",str,4),4) == 0 || + strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("CMS1",str,4),4) == 0) +@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc, + else + return 0; + } else { +- return 1; ++ fdasd_invalid_vtoc_pointer(anc); + } + } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || + strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { + return 0; ++ } else if (anc->FBA_layout == 1) { ++ /* Some times LDL formatted disks does not ++ contain any volume label */ ++ return 1; ++ } else { ++ /* didn't find VOL1 volume label */ ++ anc->formatted_cylinders = anc->hw_cylinders; ++ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads ++ - FIRST_USABLE_TRK; ++ ++ fdasd_init_volume_label(anc, fd); ++ ++ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, ++ anc->geo.cylinders, anc->formatted_cylinders, ++ anc->geo.heads, anc->geo.sectors, ++ anc->blksize, anc->dev_type); ++ ++ vtoc_init_format5_label(anc->f5); ++ vtoc_init_format7_label(anc->f7); ++ ++ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', ++ anc->verbose, FIRST_USABLE_TRK, ++ anc->formatted_cylinders * anc->geo.heads - 1, ++ anc->formatted_cylinders, anc->geo.heads); ++ return 0; + } +- + return 1; + } + diff --git a/SOURCES/parted-3.1-libparted-mklabel-edev.patch b/SOURCES/parted-3.1-libparted-mklabel-edev.patch new file mode 100644 index 0000000..c2f869c --- /dev/null +++ b/SOURCES/parted-3.1-libparted-mklabel-edev.patch @@ -0,0 +1,48 @@ +Subject: [PATCH] libparted: mklabel to support EDEV DASD + +From: Nageswara R Sastry + +Fixed Block Access (FBA) DASDs are mainframe-specific disk devices +which are layed out as a sequence of 512-byte sectors. This patch adds +support for mklabel to properly handle FBA devices. + +Signed-off-by: Nageswara R Sastry +--- + libparted/labels/fdasd.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +--- a/libparted/labels/fdasd.c ++++ b/libparted/labels/fdasd.c +@@ -869,19 +869,21 @@ fdasd_check_volume (fdasd_anchor_t *anc, + vtoc_read_volume_label (fd, anc->label_pos, v); + + if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) { +- /* found VOL1 volume label */ +- b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; ++ if (anc->FBA_layout != 1 ) { ++ /* found VOL1 volume label */ ++ b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; + +- if (b > 0) { +- int rc; +- rc = fdasd_valid_vtoc_pointer (anc, b, fd); ++ if (b > 0) { ++ int rc; ++ rc = fdasd_valid_vtoc_pointer (anc, b, fd); + +- if (rc < 0) +- return 1; +- else +- return 0; +- } else { +- fdasd_invalid_vtoc_pointer(anc); ++ if (rc < 0) ++ return 1; ++ else ++ return 0; ++ } else { ++ fdasd_invalid_vtoc_pointer(anc); ++ } + } + } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || + strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { diff --git a/SOURCES/parted-3.1-libparted-preserve-the-uuid-on-dm-partitions.patch b/SOURCES/parted-3.1-libparted-preserve-the-uuid-on-dm-partitions.patch new file mode 100644 index 0000000..d33a272 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-preserve-the-uuid-on-dm-partitions.patch @@ -0,0 +1,71 @@ +From e2b9f9051c8d9905b15af0f7fa79c85502370b25 Mon Sep 17 00:00:00 2001 +From: Brian C. Lane +Date: Fri, 3 Aug 2012 17:03:50 -0700 +Subject: [PATCH] libparted: preserve the uuid on dm partitions (#832145) + +* libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was + one. +--- + libparted/arch/linux.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 37ddb5f..2c410a0 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2803,6 +2803,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + { + char* vol_name = NULL; + const char* dev_name = NULL; ++ char* vol_uuid = NULL; ++ const char* dev_uuid = NULL; + char* params = NULL; + LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); + uint32_t cookie = 0; +@@ -2820,6 +2822,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + goto err; + + dev_name = dm_task_get_name (task); ++ dev_uuid = dm_task_get_uuid (task); + + if (isdigit (dev_name[strlen (dev_name) - 1])) { + if ( ! (vol_name = zasprintf ("%sp%d", dev_name, part->num))) +@@ -2827,6 +2830,10 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + } else if ( ! (vol_name = zasprintf ("%s%d", dev_name, part->num))) + goto err; + ++ if ( dev_uuid && (strlen(dev_uuid) > 0) \ ++ && ! (vol_uuid = zasprintf ("part%d-%s", part->num, dev_uuid))) ++ goto err; ++ + /* Caution: dm_task_destroy frees dev_name. */ + dm_task_destroy (task); + task = NULL; +@@ -2840,6 +2847,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + goto err; + + dm_task_set_name (task, vol_name); ++ if (vol_uuid) ++ dm_task_set_uuid (task, vol_uuid); + dm_task_add_target (task, 0, part->geom.length, + "linear", params); + if (!dm_task_set_cookie(task, &cookie, 0)) +@@ -2850,6 +2859,7 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_update_nodes(); + dm_task_destroy(task); + free(params); ++ free(vol_uuid); + free(vol_name); + return 1; + } else { +@@ -2861,6 +2871,7 @@ err: + if (task) + dm_task_destroy (task); + free (params); ++ free (vol_uuid); + free (vol_name); + return 0; + } +-- +1.7.11.4 + diff --git a/SOURCES/parted-3.1-libparted-reallocate-buf-after-_disk_analyse_block_s.patch b/SOURCES/parted-3.1-libparted-reallocate-buf-after-_disk_analyse_block_s.patch new file mode 100644 index 0000000..48f66bc --- /dev/null +++ b/SOURCES/parted-3.1-libparted-reallocate-buf-after-_disk_analyse_block_s.patch @@ -0,0 +1,36 @@ +From 4ee2a7d03f6720c5f97eef93c4df4b9c52e79b5e Mon Sep 17 00:00:00 2001 +From: Brian C. Lane +Date: Tue, 4 Sep 2012 15:56:47 -0700 +Subject: [PATCH] libparted: reallocate buf after _disk_analyse_block_size + call + +The call to _disk_analyse_block_size may change the +disk->dev->sector_size, if this happens buf may be too small for +subsequent reads. + +libparted/labels/mac.c (mac_read): reallocate buf +--- + libparted/labels/mac.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c +index 1f59a1a..5fa8283 100644 +--- a/libparted/labels/mac.c ++++ b/libparted/labels/mac.c +@@ -759,6 +759,13 @@ mac_read (PedDisk* disk) + mac_disk_data->block_size = raw_disk->block_size; + } + ++ /* re-allocate buf in case _disk_analyse_block_size changed ++ * the sector_size */ ++ free (buf); ++ buf = ped_malloc (disk->dev->sector_size); ++ if (!buf) ++ goto error; ++ + for (num=1; num==1 || num <= last_part_entry_num; num++) { + void *raw_part = buf; + if (!ped_device_read (disk->dev, raw_part, +-- +1.7.11.4 + diff --git a/SOURCES/parted-3.1-libparted-use-largest_partnum-in-dm_reread_part_tabl.patch b/SOURCES/parted-3.1-libparted-use-largest_partnum-in-dm_reread_part_tabl.patch new file mode 100644 index 0000000..2302751 --- /dev/null +++ b/SOURCES/parted-3.1-libparted-use-largest_partnum-in-dm_reread_part_tabl.patch @@ -0,0 +1,41 @@ +From 26fbffe8389e732be29225bd649adfdd5588b131 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 21 Mar 2012 15:34:20 -0700 +Subject: [PATCH] libparted: use largest_partnum in dm_reread_part_table + (#803108) + +DM devices can have more than 16 partitions, notify the kernel about +all of them. + +Resolves: rhbz#803108 + +* libparted/arch/linux.c (dm_reread_part_table): Use largest_partnum + +fixup +--- + libparted/arch/linux.c | 3 +-- + 1 files changed, 1 insertions(+), 2 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 7dd664e..ed14f50 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2516,14 +2516,13 @@ _dm_reread_part_table (PedDisk* disk) + return 1; + + int rc = 1; +- int last = PED_MIN (largest_partnum, 16); + int i; + + sync(); + if (!_dm_remove_parts(disk->dev)) + rc = 0; + +- for (i = 1; i <= last; i++) { ++ for (i = 1; i <= largest_partnum; i++) { + PedPartition* part; + + part = ped_disk_get_partition (disk, i); +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-test-creating-20-device-mapper-partitions.patch b/SOURCES/parted-3.1-test-creating-20-device-mapper-partitions.patch new file mode 100644 index 0000000..8a860e7 --- /dev/null +++ b/SOURCES/parted-3.1-test-creating-20-device-mapper-partitions.patch @@ -0,0 +1,94 @@ +From 166491bd870df6877e04831c9da593e2f8e77ca8 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 19 Apr 2012 17:11:09 -0700 +Subject: [PATCH] tests: test creating 20 device-mapper partitions (#803108) + +* tests/t6002-dm-many-partitions.sh: Make sure > 17 partitions appear in + device mapper. +--- + tests/Makefile.am | 1 + + tests/t6002-dm-many-partitions.sh | 60 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 61 insertions(+), 0 deletions(-) + create mode 100755 tests/t6002-dm-many-partitions.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 1b37fd9..57771be 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -55,6 +55,7 @@ TESTS = \ + t5000-tags.sh \ + t6000-dm.sh \ + t6001-psep.sh \ ++ t6002-dm-many-partitions.sh \ + t6100-mdraid-partitions.sh \ + t7000-scripting.sh \ + t8000-loop.sh \ +diff --git a/tests/t6002-dm-many-partitions.sh b/tests/t6002-dm-many-partitions.sh +new file mode 100755 +index 0000000..4d08e72 +--- /dev/null ++++ b/tests/t6002-dm-many-partitions.sh +@@ -0,0 +1,60 @@ ++#!/bin/sh ++# device-mapper: create many partitions ++# This would not create partitions > 16 when using device-mapper ++ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++ss=$sector_size_ ++ns=300 ++n_partitions=20 ++start_sector=34 ++loop_file=loop-file-$$ ++dm_name=dm-test-$$ ++ ++cleanup_() { ++ dmsetup remove $dm_name ++ test -n "$dev" && losetup -d "$dev" ++ rm -f $loop_file; ++} ++ ++# create a file large enough to hold a GPT partition table ++dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure ++dev=$(losetup --show -f $loop_file) || framework_failure ++dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure ++ ++cmd= ++for ((i=1; i<=$n_partitions; i+=1)); do ++ s=$((start_sector + i - 1)) ++ cmd="$cmd mkpart p$i ${s}s ${s}s" ++done ++parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1 ++ ++# Make sure all the partitions appeared under /dev/mapper/ ++for ((i=1; i<=$n_partitions; i+=1)); do ++ if [ ! -e "/dev/mapper/${dm_name}p$i" ]; then ++ fail=1 ++ break ++ fi ++ # remove the partitions as we go, otherwise cleanup won't work. ++ dmsetup remove /dev/mapper/${dm_name}p$i ++done ++ ++Exit $fail +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch b/SOURCES/parted-3.1-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch new file mode 100644 index 0000000..7aa5449 --- /dev/null +++ b/SOURCES/parted-3.1-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch @@ -0,0 +1,26 @@ +From 17027da1eda39d20b2d6dca0a59ac4afc5409318 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 28 Aug 2013 08:47:26 -0700 +Subject: [PATCH 69/69] tests: Add btrfs and xfs to the fs probe test + +* tests/tests/t1700-probe-fs.sh: Add btrfs and xfs +--- + tests/t1700-probe-fs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 7ce53d0..0418e73 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -22,7 +22,7 @@ require_512_byte_sector_size_ + dev=loop-file + ss=$sector_size_ + +-for type in ext2 ext3 ext4 nilfs2; do ++for type in ext2 ext3 ext4 btrfs xfs nilfs2; do + + ( mkfs.$type -V ) >/dev/null 2>&1 \ + || { warn_ "$ME: no $type support"; continue; } +-- +1.8.3.1 + diff --git a/SOURCES/parted-3.1-tests-Make-sure-dm-UUIDs-are-not-erased.patch b/SOURCES/parted-3.1-tests-Make-sure-dm-UUIDs-are-not-erased.patch new file mode 100644 index 0000000..c24bfaf --- /dev/null +++ b/SOURCES/parted-3.1-tests-Make-sure-dm-UUIDs-are-not-erased.patch @@ -0,0 +1,92 @@ +From cc96f793bb4fb088123a40fb9d802e7db1fdbffb Mon Sep 17 00:00:00 2001 +From: Brian C. Lane +Date: Tue, 7 Aug 2012 10:14:03 -0700 +Subject: [PATCH] tests: Make sure dm UUIDs are not erased + +* tests/t6003-dm-uuid.sh: Make sure dm UUIDs are not erased +--- + tests/Makefile.am | 1 + + tests/t6003-dm-uuid.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 60 insertions(+), 0 deletions(-) + create mode 100755 tests/t6003-dm-uuid.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 57771be..98310f2 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -56,6 +56,7 @@ TESTS = \ + t6000-dm.sh \ + t6001-psep.sh \ + t6002-dm-many-partitions.sh \ ++ t6003-dm-uuid.sh \ + t6100-mdraid-partitions.sh \ + t7000-scripting.sh \ + t8000-loop.sh \ +diff --git a/tests/t6003-dm-uuid.sh b/tests/t6003-dm-uuid.sh +new file mode 100755 +index 0000000..1751cb4 +--- /dev/null ++++ b/tests/t6003-dm-uuid.sh +@@ -0,0 +1,59 @@ ++#!/bin/sh ++# device-mapper: preserve uuid ++# The dm's partitions uuid would be removed when creating new partitions ++ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++ss=$sector_size_ ++ns=300 ++n_partitions=3 ++start_sector=34 ++loop_file=loop-file-$$ ++dm_name=dm-test-$$ ++ ++cleanup_() { ++ dmsetup remove $dm_name ++ test -n "$dev" && losetup -d "$dev" ++ rm -f $loop_file; ++} ++ ++# create a file large enough to hold a GPT partition table ++dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure ++dev=$(losetup --show -f $loop_file) || framework_failure ++dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure ++dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure ++ ++cmd= ++for ((i=1; i<=$n_partitions; i+=1)); do ++ s=$((start_sector + i - 1)) ++ cmd="$cmd mkpart p$i ${s}s ${s}s" ++done ++parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fail=1 ++ ++# Make sure all the partitions have UUIDs ++for ((i=1; i<=$n_partitions; i+=1)); do ++ dmsetup info /dev/mapper/${dm_name}p$i | grep UUID || fail=1 ++ ++ # remove the partitions as we go, otherwise cleanup won't work. ++ dmsetup remove /dev/mapper/${dm_name}p$i ++done ++ ++Exit $fail +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch b/SOURCES/parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch new file mode 100644 index 0000000..99b6602 --- /dev/null +++ b/SOURCES/parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch @@ -0,0 +1,34 @@ +From 98f1556d8a134f54d62ebdac27e9d16aa7884983 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 20 Mar 2012 17:17:10 -0700 +Subject: [PATCH 2/2] tests: add t0301-overwrite-gpt-pmbr.sh + +Make sure parted checks the PMBR before the GPT partition table. + +* NEWS: Update with new GPT behavior +* tests/Makefile.am: Add new test +* tests/overwrite-gpt-pmbr.sh: new test +--- + NEWS | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +diff --git a/NEWS b/NEWS +index fe0fcdd..b0a0657 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,12 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release 3.1-2 (2012-03-21) [Fedora] ++ ++** Bug Fixes ++ ++ libparted: Treat disks without a PMBR as msdos labeled disks ++ even if they have GPT partition tables. ++ + * Noteworthy changes in release 3.1 (2012-03-02) [stable] + + ** New features +-- +1.7.7.6 + diff --git a/SOURCES/parted-3.1-tests-cleanup-losetup-usage.patch b/SOURCES/parted-3.1-tests-cleanup-losetup-usage.patch new file mode 100644 index 0000000..06f13c8 --- /dev/null +++ b/SOURCES/parted-3.1-tests-cleanup-losetup-usage.patch @@ -0,0 +1,137 @@ +From a1aa9eb26f357bb1a5111eb332594dfb7b39ace0 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 15 Oct 2012 17:27:18 -0700 +Subject: [PATCH 1/2] tests: cleanup losetup usage + +The unsafe_losetup_ function was failing because losetup didn't +recognize that the 'private' /dev/loopX devices were the same as +/dev/loopX, it would fail even if one was in use. Switch to using +losetup --show which is a cleaner solution. +Also use sparse file for loop_setup to save space. +--- + tests/lvm-utils.sh | 24 ++---------------------- + tests/t-lvm.sh | 24 ++---------------------- + tests/t6001-psep.sh | 8 ++------ + tests/t6003-dm-uuid.sh | 3 +-- + 4 files changed, 7 insertions(+), 52 deletions(-) + +diff --git a/tests/lvm-utils.sh b/tests/lvm-utils.sh +index 456d265..a204b08 100644 +--- a/tests/lvm-utils.sh ++++ b/tests/lvm-utils.sh +@@ -16,34 +16,14 @@ export LVM_SUPPRESS_FD_WARNINGS=1 + ME=$(basename "$0") + warn() { echo >&2 "$ME: $@"; } + +-unsafe_losetup_() +-{ +- f=$1 +- +- test -n "$G_dev_" \ +- || fail_ "Internal error: unsafe_losetup_ called before init_root_dir_" +- +- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9} +- for slash in '' /; do +- for i in 0 1 2 3 4 5 6 7 8 9; do +- dev=$G_dev_/loop$slash$i +- losetup $dev > /dev/null 2>&1 && continue; +- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; } +- break +- done +- done +- +- return 1 +-} +- + loop_setup_() + { + file=$1 +- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \ ++ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \ + || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; } + + # NOTE: this requires a new enough version of losetup +- dev=$(unsafe_losetup_ "$file") \ ++ dev=$(losetup --show -f "$file") 2>/dev/null \ + || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; } + + echo "$dev" +diff --git a/tests/t-lvm.sh b/tests/t-lvm.sh +index b08f934..3c7657b 100644 +--- a/tests/t-lvm.sh ++++ b/tests/t-lvm.sh +@@ -16,34 +16,14 @@ export LVM_SUPPRESS_FD_WARNINGS=1 + ME=$(basename "$0") + warn() { echo >&2 "$ME: $@"; } + +-unsafe_losetup_() +-{ +- f=$1 +- +- test -n "$G_dev_" \ +- || error "Internal error: unsafe_losetup_ called before init_root_dir_" +- +- # Iterate through $G_dev_/loop{,/}{0,1,2,3,4,5,6,7,8,9} +- for slash in '' /; do +- for i in 0 1 2 3 4 5 6 7 8 9; do +- dev=$G_dev_/loop$slash$i +- losetup $dev > /dev/null 2>&1 && continue; +- losetup "$dev" "$f" > /dev/null && { echo "$dev"; return 0; } +- break +- done +- done +- +- return 1 +-} +- + loop_setup_() + { + file=$1 +- dd if=/dev/zero of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \ ++ dd if=/dev/null of="$file" bs=1M count=1 seek=1000 > /dev/null 2>&1 \ + || { warn "loop_setup_ failed: Unable to create tmp file $file"; return 1; } + + # NOTE: this requires a new enough version of losetup +- dev=$(unsafe_losetup_ "$file" 2>/dev/null) \ ++ dev=$(losetup --show -f "$file") 2>/dev/null \ + || { warn "loop_setup_ failed: Unable to create loopback device"; return 1; } + + echo "$dev" +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index 490c6d2..1859ac9 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -44,14 +44,10 @@ cleanup_fn_() { + # create a file of size N bytes + N=10M + +-# create the test file +-f1=$(pwd)/1; dd if=/dev/null of=$f1 bs=1 seek=$N 2> /dev/null || fail=1 +-f2=$(pwd)/2; dd if=/dev/null of=$f2 bs=1 seek=$N 2> /dev/null || fail=1 +- +-d1=$(loop_setup_ "$f1") \ ++f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \ + || skip_ "is this partition mounted with 'nodev'?" + +-d2=$(loop_setup_ "$f2") \ ++f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \ + || skip_ "is this partition mounted with 'nodev'?" + + dmsetup_cmd="0 `blockdev --getsz $d1` linear $d1 0" +diff --git a/tests/t6003-dm-uuid.sh b/tests/t6003-dm-uuid.sh +index 1751cb4..f58cb06 100755 +--- a/tests/t6003-dm-uuid.sh ++++ b/tests/t6003-dm-uuid.sh +@@ -36,8 +36,7 @@ cleanup_() { + } + + # create a file large enough to hold a GPT partition table +-dd if=/dev/null of=$loop_file bs=$ss seek=$ns || framework_failure +-dev=$(losetup --show -f $loop_file) || framework_failure ++dev=$(loop_setup_ $loop_file) || framework_failure + dmsetup create $dm_name --table "0 $ns linear $dev 0" || framework_failure + dmsetup rename $dm_name --setuuid f139317b-f98a-45d7-ab3b-9b4e0a336872 || framework_failure + +-- +1.7.11.4 + diff --git a/SOURCES/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch b/SOURCES/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch new file mode 100644 index 0000000..0e7884d --- /dev/null +++ b/SOURCES/parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch @@ -0,0 +1,98 @@ +From 7d4947fd094f1dda491473a57a9275971405684e Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 17 Apr 2013 14:59:36 -0700 +Subject: [PATCH] tests: rewrite t6001 to use /dev/mapper + +This test begain failing because using a private copy of /dev/mapper +confuses the system. This fixes that and generally cleans up the test. + +tests/t6001.sh: update to use /dev/mapper directly +--- + tests/t6001-psep.sh | 43 ++++++++++++++++++------------------------- + 1 file changed, 18 insertions(+), 25 deletions(-) + +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index 1859ac9..0c1ab99 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -1,4 +1,5 @@ + #!/bin/sh ++ + # ensure that parted names partitions on dm disks correctly + + # Copyright (C) 2011-2012 Free Software Foundation, Inc. +@@ -19,10 +20,7 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + + require_root_ +-lvm_init_root_dir_ +- +-test "x$ENABLE_DEVICE_MAPPER" = xyes \ +- || skip_ "no device-mapper support" ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" + + # Device maps names - should be random to not conflict with existing ones on + # the system +@@ -41,25 +39,19 @@ cleanup_fn_() { + rm -f "$f1 $f2"; + } + +-# create a file of size N bytes +-N=10M ++loop_file_1=loop-file-1-$$ ++loop_file_2=loop-file-2-$$ + +-f1=$(pwd)/1; d1=$(loop_setup_ "$f1") \ +- || skip_ "is this partition mounted with 'nodev'?" ++d1=$(loop_setup_ $loop_file_1) || framework_failure ++d1_size=$(blockdev --getsz $d1) ++d2=$(loop_setup_ $loop_file_2) || framework_failure ++d2_size=$(blockdev --getsz $d2) + +-f2=$(pwd)/2 ;d2=$(loop_setup_ "$f2") \ +- || skip_ "is this partition mounted with 'nodev'?" +- +-dmsetup_cmd="0 `blockdev --getsz $d1` linear $d1 0" +-# setup: create a mapping +-echo "$dmsetup_cmd" | dmsetup create "$linear_" || fail=1 +-dev="$DM_DEV_DIR/mapper/$linear_" ++dmsetup create $linear_ --table "0 $d1_size linear $d1 0" || framework_failure ++dev="/dev/mapper/$linear_" + + # Create msdos partition table +-parted -s $dev mklabel msdos > out 2>&1 || fail=1 +-compare /dev/null out || fail=1 +- +-parted -s $dev mkpart primary fat32 1m 5m > out 2>&1 || fail=1 ++parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +@@ -67,17 +59,18 @@ test -e ${dev}p1 || fail=1 + + #repeat on name not ending in a digit + # setup: create a mapping +-echo "$dmsetup_cmd" | dmsetup create "$linear2_" || fail=1 +-dev="$DM_DEV_DIR/mapper/$linear2_" ++dmsetup create $linear2_ --table "0 $d2_size linear $d2 0" || framework_failure ++dev="/dev/mapper/$linear2_" + + # Create msdos partition table +-parted -s $dev mklabel msdos > out 2>&1 || fail=1 +-compare /dev/null out || fail=1 +- +-parted -s $dev mkpart primary fat32 1m 5m > out 2>&1 || fail=1 ++parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct + test -e ${dev}1 || fail=1 + ++if [ -n "$fail" ]; then ++ ls /dev/mapper ++fi ++ + Exit $fail +-- +1.8.1.4 + diff --git a/SOURCES/parted-3.1.tar.xz.sig b/SOURCES/parted-3.1.tar.xz.sig new file mode 100644 index 0000000..96f5b86 --- /dev/null +++ b/SOURCES/parted-3.1.tar.xz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iQIcBAABCAAGBQJPUQeUAAoJEH/Z/MsAC+7uwS0P/iplXKYgLCZ7PXhAy2QWSEgC +yEDNUN2hdK5RqXPzmyzTEObflRRkVQV8nWLBg9r5jCXKBKl0OEiBDSd9jwbdUSwI +6ueSsbrLLpwnQkqBsh7F9zwIJ2xDsPYmhOqxTbXpITn8fv9MAMPFm0+pGYgIPC4o +JITcP+8ufjjQpdecv/EmiM+3rrcMxgVi7/F158uj+ih4mxl7L4APG2hIib+Xdd8x +lqzVogAQoW6n5uoQo/F2zcGv/NPMH7LqwH435VEzc3FTEKQ4ArZ6o/hYasMALW2F +iXyjxQKDPBmiXOkKwmhRCBQtFVk1rpy6JSw07ljL2sZlScnKvq3AA9ufomdlgtIR +vBDRjkJeB1W12sk75eQRiP1RS3+TT1rpo9kvE4a1iZkMWrHPvaCDKM48MdN/Nvb6 +nLafTM2FsHPEZ9HJCmEY4LRH0zmTJQy8KW5XSHFJgEhk22Jk5S951uTkM1sEbvHL +RRZHIGs/RZwetIUvFFEE87hZJ6OWO0XVStUnA+ik255XgN8Ik5o4K50hI3qU0/e3 +3faMq6MpBYfQn5z1SO99/TE70hjyi8Q5E+SpuF3qn4cfhYi3zn8e6OaGNLVOXcWU +5/9WI5v9a5br/74RmIElsieetnMvlpbe9feAvsziQooNPe584qlQq7SXVegcXGNu +MUrTB6SjxheBtLqH0PlX +=0NA7 +-----END PGP SIGNATURE----- diff --git a/SPECS/parted.spec b/SPECS/parted.spec new file mode 100644 index 0000000..43d206f --- /dev/null +++ b/SPECS/parted.spec @@ -0,0 +1,1261 @@ +%define _sbindir /sbin +%define _libdir /%{_lib} + +Summary: The GNU disk partition manipulation program +Name: parted +Version: 3.1 +Release: 31%{?dist} +License: GPLv3+ +Group: Applications/System +URL: http://www.gnu.org/software/parted + +Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Source1: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig +Source2: pubkey.jim.meyering + +Patch0: parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch +Patch1: parted-3.1-libparted-check-PMBR-before-GPT-partition-table-8052.patch +Patch2: parted-3.1-tests-add-t0301-overwrite-gpt-pmbr.sh.patch +Patch3: parted-3.1-libparted-Fix-endian-error-with-FirstUsableLBA.patch +Patch4: parted-2.1-libparted-use-dm_udev_wait-698121.patch +Patch5: parted-3.1-libparted-use-largest_partnum-in-dm_reread_part_tabl.patch +patch6: parted-3.1-test-creating-20-device-mapper-partitions.patch +Patch7: parted-3.1-libparted-preserve-the-uuid-on-dm-partitions.patch +Patch8: parted-3.1-tests-Make-sure-dm-UUIDs-are-not-erased.patch +Patch9: parted-3.1-libparted-reallocate-buf-after-_disk_analyse_block_s.patch +Patch10: parted-3.1-tests-cleanup-losetup-usage.patch +Patch11: parted-3.1-libparted-add-support-for-implicit-FBA-DASD-partitions.patch +Patch12: parted-3.1-libparted-add-support-for-EAV-DASD-partitions.patch +Patch13: parted-3.1-libparted-don-t-canonicalize-dev-md-paths.patch +Patch14: parted-3.1-libparted-mklabel-eav.patch +Patch15: parted-3.1-avoid-dasd-as-default-file-image-type.patch +Patch16: parted-3.1-libparted-mklabel-edev.patch +Patch17: parted-3.1-tests-rewrite-t6001-to-use-dev-mapper.patch +Patch18: parted-3.1-libparted-Recognize-btrfs-filesystem.patch +Patch19: parted-3.1-tests-Add-btrfs-and-xfs-to-the-fs-probe-test.patch +Patch20: parted-3.1-libparted-Flush-parent-device-on-open-962611.patch + +# NOTE: Started numbering patches to their order is obvious +Patch21: 0021-tests-Remove-rmmod-loop-from-t8001-1040504.patch +Patch22: 0022-tests-Increase-size-of-container-filesystem-in-t4100.patch +Patch23: 0023-tests-Disable-t4100-dvh-test-for-now-1036093.patch +Patch24: 0024-libparted-make-sure-not-to-treat-percentages-as-exac.patch +Patch25: 0025-tests-Use-mkfs.xfs-to-create-files-1036152.patch +Patch26: 0026-Update-manpage-NAME-so-whatis-will-work-948424.patch +Patch27: 0027-GPT-add-support-for-PReP-GUID-1108196.patch +Patch28: 0028-libparted-reread-part-table-with-0-partitions-113846.patch +Patch29: 0029-tests-Change-minimum-size-to-256MiB.patch +Patch30: 0030-libparted-handle-logical-partitions-starting-immedia.patch +Patch31: 0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch +Patch32: 0032-libparted-device-mapper-uses-512b-sectors-1188431.patch +Patch33: 0033-libparted-Use-read-only-when-probing-devices-on-linu.patch +Patch34: 0034-tests-Use-wait_for_dev_to_-functions.patch +Patch35: 0035-tests-Add-udevadm-settle-to-wait_for_-loop-1260664.patch +Patch36: 0036-tests-Add-wait-to-t9042-1257415.patch +Patch37: 0037-tests-Fix-t1700-failing-on-a-host-with-a-4k-xfs-file.patch +Patch38: 0038-libparted-Remove-fdasd-geometry-code-from-alloc_meta.patch +Patch39: 0039-docs-Add-list-of-filesystems-for-fs-type-1311596.patch +Patch40: 0040-partprobe-Open-the-device-once-for-probing-1339705.patch +Patch41: 0041-tests-Stop-timing-t9040-1172675.patch +Patch42: 0042-tests-Set-optimal-blocks-to-64-for-scsi_debug-device.patch +Patch43: 0043-Add-support-for-NVMe-devices.patch +Patch44: 0044-Document-resizepart-command.patch +Patch45: 0045-parted-Add-stub-resize-command-for-backward-compatib.patch +Patch46: 0046-libparted-Backport-partition-resize-code.patch +Patch47: 0047-tests-excersise-resize-command.patch +Patch48: 0048-parted-add-resizepart-command.patch +Patch49: 0049-partprobe-always-close-dev-when-probing-disks.patch +Patch50: 0050-tests-Add-t4201-to-test-partprobe-with-1025-devices.patch +Patch51: 0051-fdasd-geometry-handling-updated-from-upstream-s390-t.patch +Patch52: 0052-dasd-enhance-device-probing.patch +Patch53: 0053-parted-fix-build-error-on-s390.patch +Patch54: 0054-fdasd.c-Safeguard-against-geometry-misprobing.patch +Patch55: 0055-Add-part-label-documentation-to-mkpart-command.patch + +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: e2fsprogs-devel +BuildRequires: readline-devel +BuildRequires: ncurses-devel +BuildRequires: gettext-devel +BuildRequires: texinfo +BuildRequires: device-mapper-devel +BuildRequires: libselinux-devel +BuildRequires: libuuid-devel +BuildRequires: libblkid-devel >= 2.17 +BuildRequires: gnupg +BuildRequires: git +BuildRequires: autoconf automake +BuildRequires: e2fsprogs +BuildRequires: dosfstools +BuildRequires: bc + +Requires(post): /sbin/ldconfig +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info +Requires(postun): /sbin/ldconfig + +# bundled gnulib library exception, as per packaging guidelines +# https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries +Provides: bundled(gnulib) + +%description +The GNU Parted program allows you to create, destroy, resize, move, +and copy hard disk partitions. Parted can be used for creating space +for new operating systems, reorganizing disk usage, and copying data +to new hard disks. + + +%package devel +Summary: Files for developing apps which will manipulate disk partitions +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The GNU Parted library is a set of routines for hard disk partition +manipulation. If you want to develop programs that manipulate disk +partitions and filesystems using the routines provided by the GNU +Parted library, you need to install this package. + + +%prep +%setup -q +gpg --import %{SOURCE2} +gpg --verify %{SOURCE1} %{SOURCE0} +git init +git config user.email "parted-owner@fedoraproject.org" +git config user.name "Fedora Ninjas" +git add . +git commit -a -q -m "%{version} baseline." +git am %{patches} +iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS +git commit -a -m "run iconv" + +%build +autoreconf +autoconf +CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS +%configure --enable-selinux --disable-static +# Don't use rpath! +%{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +%{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +V=1 %{__make} %{?_smp_mflags} + + +%install +%{__rm} -rf %{buildroot} +%{__make} install DESTDIR=%{buildroot} + +# Move devel package components in to the correct location +%{__mkdir} -p %{buildroot}%{_exec_prefix}/%{_lib} +%{__mv} %{buildroot}%{_libdir}/libparted.so %{buildroot}%{_exec_prefix}/%{_lib} +%{__mv} %{buildroot}%{_libdir}/pkgconfig %{buildroot}%{_exec_prefix}/%{_lib} +pushd %{buildroot}%{_exec_prefix}/%{_lib} +reallibrary="$(readlink libparted.so)" +%{__rm} -f libparted.so +ln -sf ../../%{_lib}/${reallibrary} libparted.so +popd + +# Remove components we do not ship +%{__rm} -rf %{buildroot}%{_libdir}/*.la +%{__rm} -rf %{buildroot}%{_infodir}/dir +%{__rm} -rf %{buildroot}%{_bindir}/label +%{__rm} -rf %{buildroot}%{_bindir}/disk + +%find_lang %{name} + + +%check +export LD_LIBRARY_PATH=$(pwd)/libparted/.libs +make check + + +%clean +%{__rm} -rf %{buildroot} + + +%post +/sbin/ldconfig +if [ -f %{_infodir}/parted.info.gz ]; then + /sbin/install-info %{_infodir}/parted.info.gz %{_infodir}/dir || : +fi + +%preun +if [ $1 = 0 ]; then + /sbin/install-info --delete %{_infodir}/parted.info.gz %{_infodir}/dir >/dev/null 2>&1 || : +fi + +%postun -p /sbin/ldconfig + + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc AUTHORS BUGS COPYING ChangeLog NEWS README THANKS TODO doc/API doc/FAT +%{_sbindir}/parted +%{_sbindir}/partprobe +%{_mandir}/man8/parted.8.gz +%{_mandir}/man8/partprobe.8.gz +%{_libdir}/libparted.so.* +%{_libdir}/libparted-fs-resize.so* +%{_infodir}/parted.info.gz + +%files devel +%defattr(-,root,root,-) +%{_includedir}/parted +%{_exec_prefix}/%{_lib}/libparted.so +%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc + + +%changelog +* Wed Mar 27 2019 Brian C. Lane - 3.1-31 +- Backport patches for dasd on virtio + fdasd: geometry handling updated from upstream s390-tools + dasd: enhance device probing + parted: fix build error on s390 + fdasd.c: Safeguard against geometry misprobing + Resolves: rhbz#1676604 +- Add part-label documentation to mkpart command + Resolves: rhbz#1686659 + +* Tue Feb 26 2019 Brian C. Lane - 3.1-30 +- partprobe: always close dev when probing disks + Resolves: rhbz#1551411 +- tests: Add t4201 to test partprobe with 1025 devices + Related: rhbz#1551411 + +* Thu Aug 10 2017 Brian C. Lane - 3.1-29 +- Add support for NVMe devices + Resolves: rhbz#1316239 +- Backport partition resize command + Resolves: rhbz#1423357 + +* Fri Aug 26 2016 Brian C. Lane - 3.1-28 +- tests: Set optimal blocks to 64 for scsi_debug devices + Resolves: rhbz#1359682 + +* Mon Jul 18 2016 Brian C. Lane - 3.1-27 +- tests: Stop timing t9040 + Resolves: rhbz#1172675 + +* Thu May 26 2016 Brian C. Lane - 3.1-26 +- partprobe: Open the device once for probing + Resolves: rhbz#1339705 + +* Tue Apr 12 2016 Brian C. Lane 3.1-25 +- docs: Add list of filesystems for fs-type + Resolves: rhbz#1311596 +- libparted: Remove fdasd geometry code from alloc_metadata + Resolves: rhbz#1244833 + +* Tue Mar 01 2016 Brian C. Lane 3.1-24 +- tests: Add udevadm settle to wait_for_ loop + Related: rhbz#1260664 +- tests: Add-wait-to-t9042 + Resolves: rhbz#1257415 +- tests: Fix t1700 failing on a host with a 4k xfs file + Related: rhbz#1260664 + +* Wed Aug 05 2015 Brian C. Lane 3.1-23 +- libparted: Use read only when probing devices on linux + Resolves: rhbz#1245144 +- tests: Use wait_for_dev_to_ functions + Related: rhbz#1245144 + +* Wed May 20 2015 Brian C. Lane 3.1-22 +- Use 512b sector size when communicating with device-mapper + Resolves: rhbz#1188431 +- Add a test to make sure partitions are the correct size on device-mapper + Related: rhbz#1188431 + +* Thu Apr 16 2015 Brian C. Lane 3.1-21 +- Backport fix for 1 sector logical partition separation from start of extended + Resolves: rhbz#1212323 + +* Tue Nov 25 2014 Brian C. Lane 3.1-20 +- t1700-fs test: Change minimum size to 256MiB + Resolves: rhbz#1167785 + +* Wed Sep 24 2014 Brian C. Lane 3.1-19 +- Remove dm device when last partition is removed + Resolves: rhbz#1138465 + +* Tue Aug 12 2014 Brian C. Lane 3.1-18 +- Fix manpage NAME so whatis works with parted + Resolves: rhbz#948424 +- GPT add support for PReP GUID + Resolves: rhbz#1108196 + +* Fri Jan 24 2014 Daniel Mach - 3.1-17 +- Mass rebuild 2014-01-24 + +* Wed Jan 22 2014 Brian C. Lane 3.1-16 +- tests: Remove rmmod loop from t8001 + Resolves: rhbz#1040504 +- tests: Increase size of container filesystem in t4100 + Resolves: rhbz#1036149 +- tests: Disable t4100 dvh test for now + Resolves: rhbz#1036093 +- libparted: Make sure not to treat percentages as exact + Resolves: rhbz#1045957 +- tests: Use mkfs.xfs to create files + Resolves: rhbz#1036152 + +* Fri Dec 27 2013 Daniel Mach - 3.1-15 +- Mass rebuild 2013-12-27 + +* Wed Sep 04 2013 Brian C. Lane 3.1-14 +- libparted: Flush parent device on open (#962611) + +* Wed Aug 28 2013 Brian C. Lane 3.1-13 +- libparted: Recognize btrfs filesystem (#857101) +- tests: Add btrfs and xfs to the fs probe test (#857101) + +* Wed Apr 17 2013 Brian C. Lane 3.1-12 +- libparted: mklabel to support EDEV DASD (#953146) +- tests: rewrite t6001 to use /dev/mapper + +* Thu Feb 14 2013 Fedora Release Engineering - 3.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Dec 12 2012 Brian C. Lane 3.1-10 +- libparted: mklabel to support EAV DASD (#707032) +- libparted: Avoid dasd as default disk type while probe (#707032) + +* Thu Nov 01 2012 Brian C. Lane 3.1-9 +- don't canonicalize /dev/md/ paths (#872361) + +* Tue Oct 16 2012 Brian C. Lane 3.1-8 +- change partition UUID to use partX-UUID (#858704) +- fixup losetup usage in tests +- add support for implicit FBA DASD partitions (#707027) +- add support for EAV DASD partitions (#707032) + +* Tue Sep 04 2012 Brian C. Lane 3.1-7 +- reallocate buf after _disk_analyse_block_size (#835601) + +* Fri Aug 03 2012 Brian C. Lane 3.1-6 +- Use dm_udev_wait for dm operations (#844257) (bcl) +- use largest_partnum in _dm_reread_part_table (bcl) +- set uuid on dm partitions (#832145) (bcl) + +* Fri Jul 20 2012 Fedora Release Engineering - 3.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jun 08 2012 Brian C. Lane 3.1-4 +- Fix crash on ppc64 with GPT (#829960) (rwmj) + +* Tue May 15 2012 Brian C. Lane 3.1-3 +- Added Provides: bundled(gnulib) (#821782) + +* Wed Mar 21 2012 Brian C. Lane 3.1-2 +- libparted: check PMBR before GPT partition table (#805272) +- tests: add a test for the new behavior + +* Tue Mar 13 2012 Brian C. Lane 3.1-1 +- Rebase to upstream parted v3.1 +- removed merged patches +- add new libparted-fs-resize library + +* Fri Feb 03 2012 Brian C. Lane - 3.0-7 +- Update patch for copying flags so that it is generic +- Copy pmbr_boot flag in gpt_duplicate + +* Thu Feb 02 2012 Brian C. Lane - 3.0-6 +- gpt: add commands to manipulate pMBR boot flag (#754850) +- parted: when printing, also print the new disk flags +- tests: update tests for new disk flags output +- tests: add test for GPT PMBR pmbr_boot flag +- doc: update parted documentation + +* Fri Jan 13 2012 Fedora Release Engineering - 3.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Oct 31 2011 Brian C. Lane - 3.0-4 +- Fix ped_disk_duplicate on GPT so that it copies the partition flags (#747947) +- Add new test to check ped_disk_duplicate on msdos, gpt, bsd disk labels +- Add e2fsprogs and dosfstools so that skipped tests will be run + +* Fri Oct 07 2011 Brian C. Lane - 3.0-3 +- Fix handling of zero-length gpt partitions (#728949) +- Fix bug in nilfs2 probe with short partitions (#728949) +- Fix bug in hfs probe code (#714758) +- Make pc98 detection depend on specific signatures (#646053) + +* Wed Jun 29 2011 Richard W.M. Jones - 3.0-2 +- (Re-)apply patch to fix Linux "3.0" problem. + +* Tue Jun 28 2011 Brian C. Lane - 3.0-1 +- Update to parted v3.0 +- Run autoreconf so that patches to .am files will work +- Add patch to Fix snap radius and don't allow values < 1 (#665496) +- Add tests for the snap radius fix. +- Drop patches included in upstream release + +* Sun Jun 5 2011 Richard W.M. Jones - 2.4-2 +- Apply patch which may fix Linux "3.0" problem. + +* Thu May 26 2011 Brian C. Lane - 2.4-1 +- Updating to latest upstream v2.4 +- Drop patches included in upstream + +* Fri Mar 11 2011 Brian C. Lane - 2.3-8 +- Add support for legacy_boot flag for GPT partitions (680562) +- Remove PED_ASSERT for dos geometry calculations (585468) + +* Wed Feb 09 2011 Brian C. Lane - 2.3-7 +- Tell GCC to stop treating unused variable warnings as errors + +* Tue Feb 08 2011 Fedora Release Engineering - 2.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Dec 20 2010 Brian C. Lanr - 2.3-5 +- Document the align-check command + Resolves: #642476 +- Default to 1MiB partition alignment + Resolves: #618255 + +* Fri Dec 17 2010 Peter Jones - 2.3-4 +- Handle mac labels with differing physical/logical sector sizes better + +* Wed Sep 29 2010 jkeating - 2.3-3 +- Rebuilt for gcc bug 634757 + +* Fri Sep 17 2010 Brian C. Lane 2.3-2 +- Add patch to handle syncing partition changes when using blkext majors +- Resolves rhbz#634980 +- Related rhbz#629719 + +* Tue Jul 20 2010 Hans de Goede 2.3-1 +- Rebase to new upstream 2.3 release +- Drop all patches (all upstreamed) +- Recognize scsi disks with a high major as such (#611691) + +* Thu May 6 2010 Hans de Goede 2.2-5 +- Also recognize recovery partitions with id 27 / on gpt (#589451) + +* Fri Apr 23 2010 Hans de Goede 2.2-4 +- Properly check dm_task_run return value (#585158) +- Fix mkpartfs (ext2) on partitions >2TB (#585159) + +* Mon Apr 19 2010 Hans de Goede 2.2-3 +- Add a flag for detecting diagnostics / recovery partitions (#583626) + +* Tue Apr 6 2010 Hans de Goede 2.2-2 +- Parted should not canonicalize symlinks under /dev/mapper (#577824) + +* Tue Mar 30 2010 Hans de Goede 2.2-1 +- New upstream version 2.2 (#577478) +- Drop all our patches (all upstreamed) + +* Thu Feb 18 2010 Hans de Goede 2.1-5 +- Copy needs_clobber value in ped_disk_duplicate() (#561976) + +* Wed Feb 10 2010 Hans de Goede 2.1-4 +- Don't crash when reading a DASD disk with PV's on there (#563419) +- Don't overwrite the pmbr when merely printing a gpt table (#563211) + +* Sun Jan 31 2010 Hans de Goede 2.1-3 +- If a drive does not have alignment information available default + to an alignment of 1MiB (#559639) + +* Sun Jan 17 2010 Hans de Goede 2.1-2 +- Fix various memory leaks in error paths (#556012) +- Add %%check section to the specfile, invoking make check + +* Mon Jan 11 2010 Hans de Goede 2.1-1 +- New upstream release 2.1 +- Drop all our patches (all merged upstream) + +* Sun Dec 20 2009 Hans de Goede 1.9.0-25 +- Fix crash when partitioning loopback devices (#546622) +- Drop no-cylinder-align patch: + - its functionality is superseeded by the per disk flags + - its only user (pyparted) has been updated to use those + - this is not upstream so we don't want other programs to start using it + +* Fri Dec 18 2009 Hans de Goede 1.9.0-24 +- Allow partitioning of loopback devices (#546622) +- Add libparted function to query maximum partition length and start + addresses for a given disk (#533417) +- Add per disk flags functions from upstream, this is the way upstream + has implemented the disable cylinder alignment functionality +- Add --align cmdline option to specify how to align new partitions + see the parted man page for details (#361951) +- Make the default alignment for new partitions optimal (#361951) +- When cylinder alignment is disabled, allow use of the last (incomplete) + cylinder of the disk (#533328) +- Don't crash when printing partition tables in Russian (#543029) +- Make parted work correctly with new lvm (#525095) + +* Wed Nov 11 2009 Hans de Goede 1.9.0-23 +- Fix parted not building on s390 + +* Mon Nov 9 2009 Hans de Goede 1.9.0-22 +- Fix error when creating a fresh dasd disk on a dasd device + with a corrupted dasd label (#533808) + +* Fri Nov 6 2009 Hans de Goede 1.9.0-21 +- Fix a compiler warning which is causing build errors (#532425) + +* Tue Nov 3 2009 Hans de Goede 1.9.0-20 +- Fix error when creating a fresh dasd disk (#532425) +- Rewrite dasd disk duplication patches, as the old old ones conflicted + with fixing creating a fresh dasd disk + +* Fri Oct 30 2009 Hans de Goede 1.9.0-19 +- Fix a segfault introduced by -18 when operating on plain files + +* Thu Oct 29 2009 Hans de Goede 1.9.0-18 +- Add functions to query device / partition table alignments (#528030) + +* Thu Oct 8 2009 Hans de Goede 1.9.0-17 +- Only change the partition type to 82 when setting the swap flag on dos + labels, not when resetting it + +* Tue Oct 6 2009 Hans de Goede 1.9.0-16 +- Correctly handle GPT labels on big endian machines + +* Tue Oct 6 2009 Hans de Goede 1.9.0-15 +- ped_partition_is_busy() should not throw exceptions (#527035) +- msdos_partition_is_flag_available() should return 1 for swap flag (#513729) + +* Mon Aug 31 2009 Joel Granados 1.9.0-14 +- Patchs for 'commit to os' for linux. Thx to hansg. + +* Fri Aug 28 2009 Karsten Hopp 1.9.0-13 +- volkey is only 4 chars, don't overflow destination buffer with 84 chars + +* Fri Aug 21 2009 Joel Granados - 1.9.0-12 +- libuuid-devel is now valid for s390 builds. + +* Wed Aug 12 2009 Ville Skyttä - 1.9.0-11 +- Use xz compressed upstream tarball. + +* Wed Aug 12 2009 Joel Granados - 1.9.0-10 +- Make install with exclude docs work without an error message. + +* Wed Jul 29 2009 Joel Granados - 1.9.0-9 +- Add parenthesis where needed (#511907) + +* Mon Jul 27 2009 Joel Granados - 1.9.0-8 +- Add the swap flag to the dos type labels + +* Sat Jul 25 2009 Fedora Release Engineering - 1.9.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Jul 23 2009 Joel Granados - 1.9.0-6 +- Rebuild usiing the official tar.gz at http://ftp.gnu.org/gnu/parted/parted-1.9.0.tar.gz + +* Wed Jul 22 2009 Joel Granados - 1.9.0-5.20090721git980c +- Better handle a duplicate error. + +* Tue Jul 21 2009 Joel Granados - 1.9.0-4.20090721git980c +- New snapshot. +- Add patches to make dasd duplicate disk work. + +* Sat Jul 18 2009 Lubomir Rintel - 1.9.0-3.20090610git32dc +- Fix a typo in the errno patch + +* Mon Jul 13 2009 Joel Granados - 1.9.0-2.20090610git32dc +- Correctly number the snapshot. + +* Fri Jul 10 2009 Joel Granados - 1.9.0-1 +- New version. + +* Thu Mar 26 2009 Joel Granados - 1.8.8-15 +- Begin to identify virtio devices. +- Actually change the partition type in msdos lables (dcantrell). + +* Mon Mar 23 2009 Joel Granados - 1.8.8-14 +- Correct the behavior of upated_mode functions when the ASSERT fails (thx to hansg). + +* Thu Feb 26 2009 Joel Granados - 1.8.8-13 +- Fix parted build for gcc-4.4 + +* Thu Feb 26 2009 Fedora Release Engineering - 1.8.8-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Jan 22 2009 Joel Granados - 1.8.8-12 +- Avoid the calling of stat for strings that don't begin with the "/" char (#353191). + +* Sat Dec 13 2008 Tom "spot" Callaway - 1.8.8-11 +- fix typo in last patch + +* Sat Dec 13 2008 Tom "spot" Callaway - 1.8.8-10 +- enable RAID partition types on sun disklabels for sparc + +* Thu Nov 06 2008 Joel Granados - 1.8.8-9 +- Fix the build for the s390(x) archs (#470211). + +* Thu Jun 05 2008 Peter Jones - 1.8.8-8 +- Fix some of the atvrecv code (and the msftres code) so that the flags + actually stick. + +* Thu Jun 05 2008 Peter Jones - 1.8.8-7 +- Added "atvrecv" flag patch from atv-bootloader project. + +* Thu May 29 2008 Joel Granados - 1.8.8-6 +- Do a better job at recognizing the dos partition. (#246423) + +* Thu Apr 10 2008 David Cantrell - 1.8.8-5 +- Allow RAID or LVM partition types on BSD disklabels. + (jay.estabrook AT hp.com, #427114) + +* Thu Apr 10 2008 Peter Jones - 1.8.8-4 +- Don't interactively ask to fix an AlternateGPT's location when not + at the end of the disk; this is so that disk images written to a + usb-key can work reasonably. + +* Mon Feb 04 2008 David Cantrell - 1.8.8-3 +- Fixes so parted compiles with gcc-4.3 (#431397) + +* Sun Jan 13 2008 David Cantrell - 1.8.8-2 +- Move libparted libraries to /lib (#428420) + +* Wed Jan 02 2008 David Cantrell - 1.8.8-1 +- Upgraded to GNU parted-1.8.8 +- License for GNU parted is now GPLv3+ + +* Thu Dec 13 2007 David Cantrell - 1.8.6-13 +- Modify parted man page to indicate which flags are valid for which + disk labels (#242711) + +* Mon Nov 05 2007 David Cantrell - 1.8.6-12 +- Add KNOWN ISSUES section to parted(8) man page explaining that we cannot + currently do ext3 resizing inside parted (#367101) +- Update the xvd patch to include 'xvd' in the string table that parted + uses when printing device types (#366971) +- Do not install the linux.h or gnu.h headers + +* Tue Oct 30 2007 David Cantrell - 1.8.6-11 +- Do not install fdasd.h and vtoc.h header files + +* Thu Oct 04 2007 David Cantrell - 1.8.6-10 +- Do not install the testsuite tools + +* Thu Oct 04 2007 David Cantrell - 1.8.6-9 +- Always define PED_DEVICE_DM regardless of compile time options + +* Tue Aug 21 2007 David Cantrell - 1.8.6-8 +- Rebuild + +* Wed Aug 08 2007 David Cantrell - 1.8.6-7 +- Update License tag to GPLv2+ + +* Tue Aug 07 2007 David Cantrell - 1.8.6-6 +- Detect Xen virtual block devices and set model name appropriately + +* Thu Apr 19 2007 David Cantrell - 1.8.6-5 +- Spec file cleanups for merge review (#226230) + +* Fri Apr 13 2007 David Cantrell - 1.8.6-4 +- Fix primary partition cylinder alignment error for DOS disk labels (#229745) +- Do not build and package up libparted.a, only the shared library + +* Wed Apr 11 2007 David Cantrell - 1.8.6-3 +- Fix off-by-one bug in parted(8) when displaying disk label (#235901) + +* Wed Mar 21 2007 David Cantrell - 1.8.6-2 +- Do not translate partition name from disk label (#224182) + +* Tue Mar 20 2007 David Cantrell - 1.8.6-1 +- Upgrade to GNU parted-1.8.6, summary of major change(s): + a) Revert linux-swap(new) and linux-swap(old) fs types, it's + linux-swap for all swap types (#233085) + +* Tue Mar 20 2007 David Cantrell - 1.8.5-1 +- Upgrade to GNU parted-1.8.5 (added missing po files) + +* Fri Mar 16 2007 David Cantrell - 1.8.4-1 +- Upgrade to GNU parted-1.8.4, summary of major changes: + a) Update to use newest GNU developer tools + b) Use gnulib, the GNU portability library + c) HFS+ resize support + d) Windows Vista fixes + e) AIX disk label fixes + f) >512 byte logical sector read support on Linux +- Spec file cleanups per Fedora packaging guidelines + +* Thu Feb 08 2007 David Cantrell - 1.8.2-5 +- Remove period from end of summary line (package review) +- Use preferred BuildRoot (package review) +- BR device-mapper-devel + +* Tue Jan 30 2007 David Cantrell - 1.8.2-4 +- Patched parted.8 man page to show partition names apply to GPT disklabels + as well as Mac and PC98 disklabels (#221600) + +* Mon Jan 22 2007 David Cantrell - 1.8.2-3 +- Remove BR for libtermcap-devel +- Specifically preserve starting alignment of 0x800 on Windows Vista + (see http://support.microsoft.com/kb/923332 for details) +- Fix incorrect sector parameter used to initialize a new PedAlignment + +* Thu Jan 18 2007 David Cantrell - 1.8.2-2 +- Preserve starting sector for primary NTFS 3.1 partitions (Windows + Vista) when modifying the DOS disk label. NTFS 3.1 partitions do + not start on the 2nd head of the 1st cylinder at the beginning of + the drive. + +* Fri Jan 12 2007 David Cantrell - 1.8.2-1 +- Upgrade to GNU parted-1.8.2 + +* Fri Dec 15 2006 David Cantrell - 1.8.1-2 +- Fix a segfault when initializing new volumes (pjones) + +* Mon Dec 04 2006 David Cantrell - 1.8.1-1 +- Upgrade to GNU parted-1.8.1 + +* Fri Nov 17 2006 David Cantrell - 1.8.0-1 +- Upgrade to GNU parted-1.8.0 + +* Thu Nov 02 2006 David Cantrell - 1.7.1-18 +- Detect Apple_Boot partition types correctly (#204714) + +* Thu Oct 26 2006 David Cantrell - 1.7.1-17 +- For init_generic() failures on user-mode Linux block devices, goto + error_free_arch_specific instead of error_free_dev. + +* Wed Oct 04 2006 David Cantrell - 1.7.1-16 +- Don't throw PED_EXCEPTION_ERROR in ped_geometry_read() if accessing + sectors outside of partition boundary, since returning false will + shift ped_geometry_check() to the correct sectors. + +* Wed Aug 23 2006 David Cantrell - 1.7.1-15 +- Fixed gpt patch (*asked_already -> asked_already, whoops) + +* Tue Aug 22 2006 David Cantrell - 1.7.1-14 +- Improve error message returned by _parse_header() on GPT-labeled disks + so users actually have an idea of how to correct the problem +- Fix off-by-one error with LastUsableLBA and PartitionEntryLBA overlap + to prevent possible data corruption when using non-parted GPT editing + tools + +* Mon Aug 21 2006 Peter Jones - 1.7.1-13 +- Don't use the "volume name" as the device node name on dm device + partitions, it isn't really what we want at all. + +* Thu Aug 17 2006 David Cantrell - 1.7.1-12 +- Updated O_DIRECT patch to work around s390 problems +- Update LastUsableLBA on GPT-labeled disks after LUN resize (#194238) +- Fix exception when backup GPT table is not in the correction location + and parted tries to move it (#194238) + +* Tue Aug 15 2006 David Cantrell - 1.7.1-11 +- Expand error buffer to 8192 bytes in vtoc_error() +- Do not apply O_DIRECT patch on S/390 or S/390x platforms + +* Mon Aug 14 2006 David Cantrell - 1.7.1-10 +- Removed bad header file patch (#200577) + +* Wed Jul 12 2006 Jesse Keating - 1.7.1-9.1 +- rebuild + +* Wed Jul 5 2006 Peter Jones - 1.7.1-9 +- add ped_exception_get_handler() + +* Mon Jun 26 2006 Florian La Roche - 1.7.1-8 +- remove info files in preun + +* Thu Jun 22 2006 David Cantrell - 1.7.1-7 +- PED_SECTOR_SIZE -> PED_SECTOR_SIZE_DEFAULT + +* Thu Jun 22 2006 David Cantrell - 1.7.1-6 +- Roll dasd patches together +- Use O_DIRECT to prevent first partition corruption on GPT disks + +* Thu Jun 15 2006 Jeremy Katz - 1.7.1-5 +- fix segfaults with dasd devices + +* Wed Jun 7 2006 Jeremy Katz - 1.7.1-4 +- move .so symlink to -devel subpackage + +* Sun May 28 2006 David Cantrell - 1.7.1-3 +- Rebuild + +* Sun May 28 2006 David Cantrell - 1.7.1-2 +- Removed mac-swraid patch (added upstream) +- Updated device-mapper patch for parted-1.7.1 + +* Sat May 27 2006 David Cantrell - 1.7.1-1 +- Upgraded to parted-1.7.1 + +* Fri May 19 2006 David Cantrell - 1.7.0-1 +- Upgraded to parted-1.7.0 + +* Thu Apr 13 2006 David Cantrell - 1.6.25.1-1 +- Upgraded to parted-1.6.25.1 +- BuildRequires libtool + +* Tue Mar 14 2006 Jeremy Katz - 1.6.25-8 +- fix ppc swraid +- BR gettext-devel + +* Wed Feb 22 2006 Peter Jones - 1.6.25-7 +- close /proc/devices correctly + +* Fri Feb 10 2006 Jesse Keating - 1.6.25-6.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 7 2006 Peter Jones 1.6.25-6 +- Fix dm partition naming. + +* Tue Feb 7 2006 Jesse Keating 1.6.25-5.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 9 2005 Jesse Keating +- rebuilt + +* Fri Dec 2 2005 Peter Jones 1.6.25-5 +- rebuild for new device-mapper + +* Thu Dec 1 2005 Peter Jones 1.6.25-4 +- change device-mapper code to call dm_task_update_nodes() after + tasks which change device nodes. + +* Wed Nov 16 2005 Peter Jones 1.6.25-3 +- fix /proc/devices parser bug + +* Tue Nov 15 2005 Peter Jones 1.6.25-2 +- add support for partitions on dm devices + +* Wed Nov 09 2005 Chris Lumens 1.6.25-1 +- Updated to 1.6.25. +- Update DASD, iseries, and SX8 patches. + +* Tue Aug 30 2005 Chris Lumens 1.6.24-1 +- Updated to 1.6.24. + +* Mon Jul 18 2005 Chris Lumens 1.6.23-2 +- Add buildreq for texinfo. + +* Fri Jul 08 2005 Chris Lumens 1.6.23-1 +- Updated to 1.6.23. +- Get rid of separate Mac patches that are now included in upstream. +- Update DASD and AIX patches. + +* Tue Jun 07 2005 Chris Lumens 1.6.22-3 +- Modified Apple_Free patch to take care of the case where the partitions + are unnamed, causing many errors to be printed (#159047). + +* Thu May 05 2005 Chris Lumens 1.6.22-2 +- Added upstream patch to display certain Apple_Free partitions (#154479). + +* Wed Mar 23 2005 Chris Lumens 1.6.22-1 +- Updated to 1.6.22. +- Get rid of separate gc4 patch that's now included upstream. +- Take Mac LVM patch from parted CVS. + +* Mon Mar 14 2005 Chris Lumens 1.6.21-3 +- Include patches from parted CVS for new gcc4 warnings. + +* Sun Feb 20 2005 Paul Nasrat 1.6.21-2 +- Support lvm flags on mac partitions (#121266) + +* Fri Jan 21 2005 Chris Lumens 1.6.21-1 +- Updated to 1.6.21 + +* Wed Jan 12 2005 Tim Waugh 1.6.20-2 +- Rebuilt for new readline. + +* Fri Jan 07 2005 Chris Lumens 1.6.20-1 +- Updated to 1.6.20 (#139257, #142100). +- Updated DASD and AIX patches for 1.6.20. + +* Tue Dec 14 2004 Jeremy Katz - 1.6.19-2 +- add support for Promise SX8 devices + +* Sun Nov 28 2004 Jeremy Katz - 1.6.19-1 +- update to 1.6.19 (#138419) + +* Sun Nov 21 2004 Jeremy Katz - 1.6.18-1 +- update to 1.6.18 + +* Sat Nov 20 2004 Miloslav Trmac - 1.6.16-3 +- Convert pt_BR-parted.8 to UTF-8 + +* Thu Nov 11 2004 Jeremy Katz - 1.6.16-2 +- add patch from Matt Domsch to fix consistency of GPT disk labels + with the EFI specification for disks > 2TB (#138480) +- understand the new Sun UFS partition ID +- merge the new geometry probing from CVS to see if that helps the + assertions people are seeing (#138419) + +* Mon Nov 8 2004 Jeremy Katz - 1.6.16-1 +- update to 1.6.16 +- rebuild for python 2.4 + +* Mon Oct 18 2004 Jeremy Katz - 1.6.15-5 +- add patch from Matt Domsch to add a unique signature to new DOS labels + so that we can later determine which BIOS disk is which (#106674) + +* Fri Oct 15 2004 Phil Knirsch 1.6.15-4 +- Fixed dasd patch (had some duplicate file patches in it) +- Fixed problem with parted segfaulting on SCSI discs on s390 (#133997) + +* Tue Oct 12 2004 Jeremy Katz - 1.6.15-3 +- add patch from peterm to fix printing of the size of large devices (#135468) + +* Thu Oct 07 2004 Phil Knirsch 1.6.15-2 +- Fixed geometry calculation for bios_geo in dasd_init() + +* Mon Sep 20 2004 Jeremy Katz - 1.6.15-1 +- 1.6.15 + +* Fri Sep 10 2004 Jeremy Katz - 1.6.14-1 +- update to 1.6.14 + +* Tue Aug 24 2004 Jeremy Katz - 1.6.12-2 +- fix assertion error when checking flags on non-active partition (#130692) +- buildrequires: gettext-devel + +* Mon Aug 16 2004 Jeremy Katz - 1.6.12-1 +- update to 1.6.12 with major changes to CHS handling to hopefully fix #115980 +- adjust dasd patch accordingly, drop some included patches + +* Mon Jul 19 2004 Karsten Hopp 1.6.11-4 +- update dasd patch for dos-type partitions on mainframes (scsi disks) + +* Fri Jun 25 2004 Jeremy Katz - 1.6.11-3 +- install-info (#77687) + +* Tue Jun 15 2004 Elliot Lee - 1.6.11-2 +- rebuilt + +* Tue Jun 1 2004 Jeremy Katz +- -devel requires main package (#124938) + +* Thu May 13 2004 Jeremy Katz - 1.6.11-1 +- update to 1.6.11 + +* Tue May 11 2004 Jeremy Katz - 1.6.9-4 +- add patch from Matt Domsch to not use the get/set last sector ioctls + with a 2.6 kernel (#121455) + +* Thu Apr 15 2004 David Woodhouse - 1.6.9-3 +- Fix Mac partition detection to close #112937 + +* Tue Apr 13 2004 Jeremy Katz - 1.6.9-2 +- another minor tweak for 2.6's lack of sane geometry handling + +* Mon Apr 12 2004 Jeremy Katz - 1.6.9-1 +- update to 1.6.9 +- need automake17 +- python-devel is superfluous with pyparted as a separate package +- lose the fake-libtool stuff, 1.6.9 was disted with newer auto* + +* Mon Mar 15 2004 Elliot Lee 1.6.6-2 +- Fix parted's "part-static" option to close #118183. Woohoo, a fake-libtool.sh :) + +* Fri Mar 12 2004 Jeremy Katz - 1.6.6-1 +- update to 1.6.6 +- split dasd into a patch instead of included in the tarball +- python module is now in the pyparted package (separate src.rpm) +- ExcludeArch: ppc64 (#118183) + +* Tue Mar 02 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Fri Feb 6 2004 Jeremy Katz +- add automake buildrequires (#115063) + +* Thu Jan 22 2004 Jeremy Katz 1.6.3-33 +- 2.6 removes the geometry fixups that used to be present for IDE disks. + According to Andries, just follow what's in the partition table and don't + worry about what Linux "detects" + +* Thu Nov 6 2003 Jeremy Katz 1.6.3-32 +- rebuild for python 2.3 + +* Mon Oct 27 2003 Jeremy Katz 1.6.3-31 +- add patch from Michael Schwendt for segfault + +* Wed Sep 17 2003 Jeremy Katz 1.6.3-30 +- rebuild + +* Wed Sep 17 2003 Jeremy Katz 1.6.3-29 +- and don't barf on the old (broken) 1.02 gpt rev + +* Tue Sep 16 2003 Jeremy Katz 1.6.3-28 +- rebuild + +* Tue Sep 16 2003 Jeremy Katz 1.6.3-27 +- write out the correct gpt revision (#103664) +- add buildrequires on ncurses-devel + +* Thu Sep 4 2003 Bill Nottingham 1.6.3-26 +- rebuild + +* Thu Sep 4 2003 Bill Nottingham 1.6.3-25 +- don't buildreq libunicode-devel + +* Thu Aug 07 2003 Elliot Lee 1.6.3-24 +- Fix libtool + +* Wed Jul 09 2003 Phil Knirsch 1.6.3-23 +- Fixed dasd_write and dasd_read to support lvm and raid partitions. + +* Wed Jun 18 2003 Phil Knirsch 1.6.3-22 +- Fixed a small bug in VTOC fdasd_check_volume() (#97300). + +* Wed Jun 04 2003 Elliot Lee 1.6.3-21 +- rebuilt + +* Wed Jun 4 2003 Matt Wilson 1.6.3-20 +- don't detect AIX physical volumes as msdos partition tables (#91748) +- added stubbed code for manipulating AIX PVs, enough to clobber the + signature. (#91748) + +* Wed Jun 04 2003 Phil Knirsch 1.6.3-19 +- Added LDL disk layout support for s390(x). + +* Sun May 18 2003 Matt Wilson 1.6.3-18 +- use metadata partitions to protect DASD VTOC +- stash DASD specific data in disk specific areas, not arch specific + areas. + +* Fri May 16 2003 Matt Wilson 1.6.3-18 +- recongnize iseries viodasd (#90449) + +* Thu May 08 2003 Phil Knirsch 1.6.3-17 +- Fixed problem with probing partitions on s390(x) with new partition code. + +* Mon May 05 2003 Phil Knirsch 1.6.3-16 +- Fixed partiton reread code for s390(x). + +* Fri May 02 2003 Phil Knirsch 1.6.3-15 +- Rewrote partition handling for s390(x) dasd devices. No more empty partitions. + +* Wed Mar 12 2003 Phil Knirsch 1.6.3-13 +- Finished updating vtoc and fdasd code to latest s390-utils version. + +* Thu Mar 06 2003 Phil Knirsch 1.6.3-12 +- Fixed vtoc handling on s390(x) dasd devices. + +* Thu Feb 06 2003 Karsten Hopp 1.6.3-11 +- use different define to enable DASD debugging + Otherwise we'll get a lot of dasd debug output because DEBUG is + always defined + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Wed Jan 22 2003 Karsten Hopp 1.6.3-9 +- missed one debug message + +* Tue Jan 21 2003 Karsten Hopp 1.6.3-8 +- add patch from CVS to disable debug messages on s390 + +* Tue Jan 14 2003 Matt Wilson 1.6.3-7 +- updated to a new tarball of parted that includes a fs.probe_specific binding + +* Sun Dec 1 2002 Matt Wilson 1.6.3-6 +- hack in partition.native_type (#78118) + +* Thu Nov 7 2002 Matt Wilson +- added a patch to avoid SIGFPE when fat sector size is 0 + +* Tue Nov 5 2002 Matt Wilson +- use --disable-dynamic-loading + +* Mon Nov 4 2002 Matt Wilson +- add device.disk_new_fresh() + +* Fri Nov 1 2002 Matt Wilson +- 1.6.3 + +* Fri Oct 4 2002 Jeremy Katz 1.4.24-7 +- use make LIBTOOL=/usr/bin/libtool instead of recreating everything +- add patch from Jack Howarth to self host properly +- add patch to treat GPT structs as little-endian always and treat GUIDS + as little-endian blobs +- add patch to recognize hp service partitions + +* Wed Sep 25 2002 Jeremy Katz 1.4.24-6hammer +- libtoolize, etc for x86_64 +- hack to get the python module in the right place until python.m4 + from automake is fixed + +* Fri Jun 21 2002 Tim Powers 1.4.24-6 +- automated rebuild + +* Sun May 26 2002 Tim Powers 1.4.24-5 +- automated rebuild + +* Wed May 22 2002 Jeremy Katz 1.4.24-4 +- rebuild in new environment + +* Fri Mar 22 2002 Matt Wilson 1.4.24-3 +- fixed the probe-with-open behavior (again) + +* Fri Feb 22 2002 Matt Wilson 1.4.24-1 +- rebuild + +* Tue Feb 12 2002 Matt Wilson 1.4.24-1 +- 1.4.24 + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Mon Jan 7 2002 Jeremy Katz 1.4.20-4 +- build with final python 2.2 + +* Wed Dec 12 2001 Jeremy Katz 1.4.20-3 +- update from CVS and rebuild in new environment + +* Thu Oct 25 2001 Jeremy Katz 1.4.20-2 +- build both python1.5 and python2 modules + +* Fri Oct 19 2001 Matt Wilson 1.4.20-1 +- 1.4.20 final + +* Thu Oct 11 2001 Matt Wilson 1.4.20-0.1pre3 +- new dist from CVS with new autoconf and automake +- gpt is in 1.4.20, removed patch1 (gpt support) +- partstatic is in 1.4.20, removed patch2 (partstatic patch) + +* Tue Aug 28 2001 Matt Wilson 1.4.16-8 +- new dist from cvs with changes to the python binding: register + DEVICE_I20 and DEVICE_ATARAID, check to make sure that a partition + exists in the PedDisk when using it to find ped_disk_next_partition + +* Tue Aug 21 2001 Matt Wilson 1.4.16-7 +- really disable pc98 support (SF #51632) + +* Fri Aug 17 2001 Matt Wilson 1.4.16-6 +- added a patch (Patch1) to link the c library in dynamically, the + rest of the libs statically for the parted binary (MF #49358) + +* Tue Aug 7 2001 Matt Wilson +- made a new dist from CVS that includes binding for + disk.get_partition_by_sector and accessing the name of a disk type + +* Mon Aug 6 2001 Matt Wilson 1.4.16-4 +- created a new dist from CVS that fixes ext3 detection when + _probe_with_open is needed (#50292) + +* Fri Jul 20 2001 Matt Wilson +- rewrite scsi id code (#49533) + +* Fri Jul 20 2001 Matt Wilson +- added build requires (#49549) + +* Tue Jul 17 2001 Matt Wilson +- 1.4.16 +- regenerated gpt patch against 1.4.16, incorporated + parted-1.4.15-pre1-gpt-printf.patch into the same patch, removed Patch1 + +* Tue Jul 10 2001 Matt Wilson +- added a new dist tarball that contains python wrappers to get disk types + +* Tue Jul 10 2001 Tim Powers +- run ldconfig on un/install + +* Tue Jul 10 2001 Matt Wilson +- added a fix from clausen for border case when there is an extended + on the last cyl + +* Mon Jul 9 2001 Matt Wilson +- 1.4.15 + +* Thu Jul 5 2001 Matt Wilson +- added patch from Arjan to enable ataraid support + +* Wed Jul 4 2001 Matt Wilson +- imported 1.4.15-pre2 into CVS and made a new dist tarball + +* Tue Jun 26 2001 Matt Wilson +- added a new dist tarball that contains a check in python code to + make sure that a partition exists within a disk before trying to + remove it from the disk +- also changed _probe_with_open to make the first probed filesystem win + +* Tue Jun 26 2001 Bill Nottingham +- fix filesystem type reading on GPT disks + +* Tue Jun 26 2001 Matt Wilson +- added another fix for ext2/ext3 +- added Patch4 to move the crc32 function into its own namespace so + we don't colide with zlib when both are in the same executable space + +* Mon Jun 25 2001 Matt Wilson +- added a new dist tarball from CVS that includes + ext3 probing + +* Wed Jun 6 2001 Matt Wilson +- updated dist with binding for partition.geom.disk + +* Tue Jun 5 2001 Matt Wilson +- make a new dist tarball that has new python binding changes + +* Tue May 29 2001 Bill Nottingham +- add major numbers for cciss +- add libunicode-devel buildprereq + +* Sun May 27 2001 Matthew Wilson +- added type, heads, and sectors to the python binding for PedDevice + +* Fri May 4 2001 Matt Wilson +- added parted-1.4.11-gpt-pmbralign.patch from Matt Domsch + +* Wed May 2 2001 Matt Wilson +- include python binding +- enable shared library (for python binding, we want fpic code) + with --enable-shared +- build parted binary static with --enable-all-static +- don't run libtoolize on this. + +* Wed May 02 2001 Bill Nottingham +- update to 1.4.11 +- add EFI GPT patch from Matt Domsch () +- don't run autoconf, it relies on a newer non-released version + of autoconf... + +* Fri Feb 23 2001 Trond Eivind Glomsrød +- langify + +* Wed Jan 17 2001 Florian La Roche +- update to 1.4.7 + +* Thu Dec 14 2000 Bill Nottingham +- rebuild because of broken fileutils + +* Fri Nov 03 2000 Florian La Roche +- update to 1.2.12 + +* Wed Nov 01 2000 Florian La Roche +- update to 1.2.11 + +* Tue Oct 17 2000 Florian La Roche +- update to 1.2.10 + +* Sun Sep 10 2000 Florian La Roche +- update to 1.2.9 + +* Tue Aug 29 2000 Florian La Roche +- fix bug when just hitting "return" with no user input + +* Sun Aug 20 2000 Florian La Roche +- 1.2.8 +- blksize patch not needed anymore +- move changelog to the end of the spec file + +* Wed Aug 16 2000 Matt Wilson +- 1.2.7 +- patched configure script to ignore the 2.4 blkpg.h header (fixes #15835). + +* Fri Aug 4 2000 Florian La Roche +- update to 1.2.6 + +* Sat Jul 22 2000 Florian La Roche +- update to 1.2.5 +- add more docu + +* Wed Jul 12 2000 Prospector +- automatic rebuild + +* Mon Jun 12 2000 Matt Wilson +- initialization of spec file.