From 295facd1e7f494f653c76de856776adcc2a3a3da0b69a76cec4eb6ec8a47869b Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Thu, 29 May 2014 13:02:44 +0000 Subject: [PATCH] - Allow bigger snap radius if cylinders are used as units (bnc#879387): - add: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=94 --- ...er-snap-radius-if-cylinders-are-used.patch | 43 +++++++++++++++++++ parted.changes | 7 +++ parted.spec | 2 + 3 files changed, 52 insertions(+) create mode 100644 libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch diff --git a/libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch b/libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch new file mode 100644 index 0000000..c60c651 --- /dev/null +++ b/libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch @@ -0,0 +1,43 @@ +From 2ef86fbe0fd8a6c4b48dd8edfbe41728a7343dac Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Thu, 29 May 2014 14:50:31 +0200 +Subject: [PATCH] libparted: allow bigger snap radius if cylinders are used + +This is partial revert of commit + + commit 18e727d492933ae1ebb16961e1df553f9299af8b + Author: Brian C. Lane + Date: Tue Jun 21 10:44:15 2011 -0700 + + libparted: fix snap radius so that it is using half (#665496) + + The snap radius didn't match the documentation, it has been + using +/- unit size instead +/- 0.5 * unit (eg. 500KB for a MB + unit). This caused problems when specifying 1MB, 1GB, etc. as a + partition start or end resulting in partitions being created + that were nowhere near the specified size. + +Only revert to the old behavior if cylinders are used in order to +give parted more flexibility when snapping the partition start/end. + +References: bnc#879387 +--- + libparted/unit.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +Index: parted-3.1/libparted/unit.c +=================================================================== +--- parted-3.1.orig/libparted/unit.c ++++ parted-3.1/libparted/unit.c +@@ -540,7 +540,10 @@ ped_unit_parse_custom (const char* str, + } + + unit_size = ped_unit_get_size (dev, unit); +- radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1; ++ if (unit == PED_UNIT_CYLINDER) ++ radius = ped_div_round_up (unit_size, dev->sector_size) - 1; ++ else ++ radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1; + if (radius < 0) + radius = 0; + /* If the user specifies units in a power of 2, e.g., 4MiB, as in diff --git a/parted.changes b/parted.changes index 0fe54ef..8b02706 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu May 29 12:55:29 UTC 2014 - puzel@suse.com + +- Allow bigger snap radius if cylinders are used as units + (bnc#879387): + - add: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch + ------------------------------------------------------------------- Tue May 20 10:27:17 UTC 2014 - puzel@suse.com diff --git a/parted.spec b/parted.spec index 2da7b6e..fb91180 100644 --- a/parted.spec +++ b/parted.spec @@ -58,6 +58,7 @@ Patch30: libparted-initialize-dasd-part-type.patch Patch31: libparted-use-BLKRRPART-for-DASD.patch.patch Patch32: libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch Patch33: Fix-help-text-for-disk_-set-toggle.patch +Patch34: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch Patch100: parted-fatresize-autoconf.patch Requires: /sbin/udevadm BuildRequires: check-devel @@ -138,6 +139,7 @@ to develop applications that require these. %patch31 -p1 %patch32 -p1 %patch33 -p1 +%patch34 -p1 %patch100 -p1 %build